.append("\nDate ").append(msg.getDate()).append(msg.getTime())
.append("\nflag ").append(msg.haveSent())
.append("\ntopic ").append(msg.cmd());
- if(Config.protocol_no == Config.PROTOCOL_GATOR){
- if(msg.isFromCache().length()>8) {
+ if (Config.protocol_no == Config.PROTOCOL_GATOR) {
+ if (msg.isFromCache().length() > 8) {
sb.append("\norigin ").append(AESCipher.aesDecryptStringFixedKey(msg.isFromCache().substring(8)));
}
}
}
public PowerManager.WakeLock getWakeLock() {
- PowerManager.WakeLock wakeLock = ((PowerManager) (this.mRuntime.getContextProxy()).context.getSystemService(Context.POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Deliver.class.getSimpleName());
+ PowerManager.WakeLock wakeLock = ((PowerManager) (mRuntime.getContextProxy()).context.getSystemService(Context.POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Deliver.class.getSimpleName());
wakeLock.acquire(40000L);
return wakeLock;
}
if (mConnection instanceof NettyConnection) {
((NettyConnection) mConnection).sendMsg("RAWPACKET",
protocolAPIHelper.getVoicePacketItem(voicepacket.getSender(),
- voicepacket.getDurationHex(),voicepacket.getPacketTime(),
+ voicepacket.getDurationHex(), voicepacket.getPacketTime(),
voicepacket.getPacketCount(),
(voicepacket.getCurrentIndexToSent() + 1),
voicepacket.getVoicePacketWithIndex(voicepacket.getCurrentIndexToSent()).getPacketLen(),
);
}
} else {
- ICLogger.i("voicepacket Sender "+voicepacket.getSender()+" duration 0x"+voicepacket.getDurationHex()+" " + voicepacket.getName() + " filetype " + voicepacket.getFiletype() + " , datatype " + voicepacket.getDateType() + " " + voicepacket.getPacketTime() + " sent Done!");
+ ICLogger.i("voicepacket Sender " + voicepacket.getSender() + " duration 0x" + voicepacket.getDurationHex() + " " + voicepacket.getName() + " filetype " + voicepacket.getFiletype() + " , datatype " + voicepacket.getDateType() + " " + voicepacket.getPacketTime() + " sent Done!");
}
return true;
} else if ("PhotoRemoteTaken".equals(paramStringMessage.cmd())) {
contentValues);
ICLogger.i("receive taken photo to send " + msgUrl);
//保存到防走丢的数据库里
-
//创建voiceConent并添加到数据
final VoiceContent voiceContent = VoiceContent.placeHolderOut(CONTACT_CATEGORY_GROUP,
- "123", msgUrl,"0000", 2, 2);
-
+ "123", msgUrl, "0000", 2, 2);
// 把voiceContent拆解成1024的分包
- Util.parseToVoicePacketSent(voiceContent,1024);
+ Util.parseToVoicePacketSent(voiceContent, 1024);
//trigger 分包发送
if (CoreService.getInstance().getConnection() != null) {
//H88 专用功能拍照时检测用户体温心率
if (mRuntime.check_stat_do_temp_test()) {
TemperatureUtil.getInstance().DoTempTest(FROM_SERVER);
}
-
Util.mSleep(5000);
//开启测量PPG
if (mRuntime.check_stat_do_ppg_test()) {
}, 2000);
return true;
} else if ("FactoryResetCheckSim".equals(paramStringMessage.cmd())) {
-
if (SimSignalUtil.hasSimCard(paramRuntime.getContextProxy().context)) {
ICLogger.i("Has Sim Card Skip FactoryReset!");
Util.ShowToast(paramRuntime, "Has Sim Card Skip FactoryReset!");
-
return true;
} else {
Util.ShowToast(paramRuntime, "Do FactoryReset!");
}
- mSendMSGHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- Util.doMasterClear(paramRuntime.getContextProxy().context);
- }
- }, 2000);
+ mSendMSGHandler.postDelayed(() -> Util.doMasterClear(paramRuntime.getContextProxy().context), 2000);
return true;
} else if ("poweroff".equals(paramStringMessage.cmd())) {
paramRuntime.setShutdown(true);
- mSendMSGHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- Util.shutdown();
- }
- }, 2000);
+ mSendMSGHandler.postDelayed(() -> Util.shutdown(), 2000);
return true;
} else if ("FactoryReset".equals(paramStringMessage.cmd())) {
- mSendMSGHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- Util.doMasterClear(paramRuntime.getContextProxy().context);
- }
- }, 2000);
+ mSendMSGHandler.postDelayed(() -> Util.doMasterClear(paramRuntime.getContextProxy().context), 2000);
return true;
} else if ("Reboot".equals(paramStringMessage.cmd())) {
- mSendMSGHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- Util.reboot(paramRuntime.getContextProxy().context);
- }
- }, 2000);
+ mSendMSGHandler.postDelayed(() -> Util.reboot(paramRuntime.getContextProxy().context), 2000);
return true;
} else if ("heartbeat".equals(paramStringMessage.cmd())) {
//每次心跳,查询一下 是否有语音消息需要接收。
-// paramConnection.send(protocolAPIHelper.genStringMessage("AP05",protocolAPIHelper.AP05(true)));
-
+ //paramConnection.send(protocolAPIHelper.genStringMessage("AP05",protocolAPIHelper.AP05(true)));
} else if ("getWeather".equals(paramStringMessage.cmd())) {
ICLogger.i("获取天气");
mConnection.send(protocolAPIHelper.getWeatherMSG(mRuntime));
} else if ("NewVoice".equals(paramStringMessage.cmd())) {
- mSendMSGHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- final Context context = (Deliver.this.mRuntime.getContextProxy()).context;
- Contact param2Contact = new Contact(CATEGORY_GROUP,
- (mRuntime.getContextProxy()).context.getResources().getString(R.string.all_group),
- Contact.GROUP_ALL);
- int i = mRuntime.getContextProxy().getTelephonyManager().getCallState();
- if (!mRuntime.getBatteryLow() && 1 != i && 2 != i) {
- if (Config.do_broadCast_message) {
- ICLogger.d(Constants.ACTION_MESSAGE_RECEIVED + " " + paramStringMessage.isFromCache());
- //广播 voice消息
- Intent intent = new Intent();
- intent.setAction(Constants.ACTION_MESSAGE_RECEIVED);
- intent.putExtra(Constants.KEY_MESSAGE_TYPE, "voice");
- intent.putExtra(Constants.KEY_MESSAGE_FROM, "广播消息");
- intent.putExtra(Constants.KEY_MESSAGE_URL, paramStringMessage.isFromCache());
- //playVoice(context,paramStringMessage.isFromCache());
- context.sendBroadcast(intent);
- }
- if (!Config.noVoiceNotifyDialog) {
- Intent intent = new Intent();
- //显示提示窗口
- intent.setAction(DIALOG_ACTION);
- intent.putExtra("contact", param2Contact);
- context.sendBroadcast(intent);
- }
-
+ mSendMSGHandler.postDelayed(() -> {
+ final Context context = (Deliver.mRuntime.getContextProxy()).context;
+ Contact param2Contact = new Contact(CATEGORY_GROUP,
+ (mRuntime.getContextProxy()).context.getResources().getString(R.string.all_group),
+ Contact.GROUP_ALL);
+ int i = mRuntime.getContextProxy().getTelephonyManager().getCallState();
+ if (!mRuntime.getBatteryLow() && 1 != i && 2 != i) {
+ ICLogger.d("Config.do_broadCast_message == > " + Config.do_broadCast_message);
+ if (Config.do_broadCast_message) {
+ ICLogger.d(Constants.ACTION_MESSAGE_RECEIVED + " " + paramStringMessage.isFromCache());
+ //广播 voice消息
+ Intent intent = new Intent();
+ intent.setAction(Constants.ACTION_MESSAGE_RECEIVED);
+ intent.putExtra(Constants.KEY_MESSAGE_TYPE, "voice");
+ intent.putExtra(Constants.KEY_MESSAGE_FROM, "广播消息");
+ intent.putExtra(Constants.KEY_MESSAGE_URL, paramStringMessage.isFromCache());
+ //playVoice(context,paramStringMessage.isFromCache());
+ context.sendBroadcast(intent);
}
+ ICLogger.d("Config.noVoiceNotifyDialog ==> " + Config.noVoiceNotifyDialog);
+ if (!Config.noVoiceNotifyDialog) {
+ Intent intent = new Intent();
+ //显示提示窗口
+ intent.setAction(DIALOG_ACTION);
+ intent.putExtra("contact", param2Contact);
+ context.sendBroadcast(intent);
+ }
+
}
}, 500);
return true;
} else if ("NewTalkMsg".equals(paramStringMessage.cmd())) {
- final Context context = (Deliver.this.mRuntime.getContextProxy()).context;
+ final Context context = (Deliver.mRuntime.getContextProxy()).context;
String textData = paramStringMessage.isFromCache();
Contact param2Contact = new Contact(CATEGORY_GROUP,
- (mRuntime.getContextProxy()).context.getResources().getString(R.string.all_group),
+ (mRuntime.getContextProxy()).context.getResources()
+ .getString(R.string.receiver_we_talk_msg),
Contact.GROUP_ALL, textData);
if (!Config.noVoiceNotifyDialog) {
Intent intent = new Intent();
* * * 1 语音—— 1.监听语音 * 2.SOS语音 * 3.扩展
* * * 2 图片—— 1.签到图片 * 2.指令图片 * 3.设备图片 * 4.扩展
*/
- final VoiceContent voiceContent = VoiceContent.placeHolderOut(CONTACT_CATEGORY_GROUP, "123","0000", recordfilepath, 1, 1);
+ final VoiceContent voiceContent = VoiceContent.placeHolderOut(CONTACT_CATEGORY_GROUP, "123", "0000", recordfilepath, 1, 1);
// 把voiceContent拆解成1024的分包
- Util.parseToVoicePacketSent(voiceContent,1024);
+ Util.parseToVoicePacketSent(voiceContent, 1024);
//trigger 分包发送
if (CoreService.getInstance().getConnection() != null)
CoreService.getInstance().getConnection().DeliverCMDMessageToSystem("SentVoicePacket", "");
mCustomDialog = tmpDialog.setMessage(contentBuilder.toString()).setPositiveButton(context.getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface var1x, int var2x) {
var1x.dismiss();
- ComponentName var3 = new ComponentName("com.ic.icwetalk",
- "com.ic.icwetalk.MainActivity");
- Intent intent = new Intent("android.intent.action.MAIN");
+ ComponentName var3 = new ComponentName("com.ic.wetalk",
+ "com.ic.wetalk.MainActivity");
+ Intent intent = new Intent();
intent.putExtra("ACTIVITY_TYPE", 2);
intent.putExtra("contact", contact);
- intent.addCategory("android.intent.category.DEFAULT");
intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
intent.setComponent(var3);
VibrateUtil.getInstance(context).vibrateOn(false);
e.printStackTrace();
ICLogger.e(e.getMessage(), e);
}
-
- }
- }).setNegativeButton(context.getString(R.string.cancel), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface var1, int var2) {
- var1.dismiss();
- VibrateUtil.getInstance(context).vibrateOn(false);
}
+ }).setNegativeButton(context.getString(R.string.cancel), (var1, var2) -> {
+ var1.dismiss();
+ VibrateUtil.getInstance(context).vibrateOn(false);
}).create();
mCustomDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_TOAST);
mCustomDialog.show();
}
}
} else if (paramIntent.hasExtra("talkTextMsg")) {
- contact = (Contact) paramIntent.getParcelableExtra("talkTextMsg");
+ contact = paramIntent.getParcelableExtra("talkTextMsg");
SharePreferenceUtil.getPrefBoolean(paramContext, "key_is_resume", false);
isSilence = SharePreferenceUtil.getPrefBoolean(paramContext, "KEY_ISSILENCE", false);
if (contact != null && !isSilence) {
ArrayList<Contact> contactArray = new ArrayList<>();
ContentValues contentValues = new ContentValues();
ContentResolver resolver = runtime.getContextProxy().getResolver();
+ //白名单
resolver.delete(Uri.parse(ICMembersProvider.MEMBERS), "type=?", new String[]{
ICDatabaseHelper.MemberType.WHITE_LIST + ""
});
+ //微聊,gator的联系人,可以做白名单,也可以作为微聊的联系人
+ resolver.delete(Uri.parse(ICMembersProvider.MEMBERS), "type=?", new String[]{
+ ICDatabaseHelper.MemberType.FRIEND + ""
+ });
for (int i = 0; i < numbers.size(); i++) {
String phoneNum = numbers.get(i);
String name = names.get(i);
//后面所有地方都切换到新库了,才删除上面的代码
// TODO:需要修改白名单拦截的地方.
resolver.insert(Uri.parse(ICMembersProvider.MEMBERS), contentValues);
+ contentValues.put(ICDatabaseHelper.fType, ICDatabaseHelper.MemberType.FRIEND);
+ resolver.insert(Uri.parse(ICMembersProvider.MEMBERS), contentValues);
}
//TODO:保存到fzd的联系人列表,类型为白名单
runtime.getDbHelper().saveContacts(contactArray, false, false, true, false, false, false);
ArrayList<String> numbers = new ArrayList<>();
ArrayList<String> names = new ArrayList<>();
ArrayList<String> types = new ArrayList<>();
-
for (int i = 1; i < cmdlist1.length; i += 3) {
String number = cmdlist1[i];
String name = cmdlist1[i + 1];
}
}
appendContact(ds, numbers, names);
-
} else {
ICLogger.e("AP06 format error1 !");
connection.send(BPXX_REPLY(ds, CMD_TYPE.BP06, cmdlist[1], false));
}
-
ICLogger.d(sb.toString());
connection.send(BPXX_REPLY(ds, CMD_TYPE.BP06, cmdlist[1], true));
} else {
voicePacket.getInstance().appendVoice(sourceNumb, time, count, index, ipackagelen, packetData);
log("================" + voicePacket.getInstance().toString());
if (voicePacket.getInstance().isFinished()) {
-
String dir = Environment.getExternalStorageDirectory() + "/Android/VoiceCache";
String amrFilepath = Util.saveFile(voicePacket.getInstance().getVoicePacketBytes(), 0, voicePacket.getInstance().getVoicePacketLen(), new File(dir), "receive_" + voicePacket.getInstance().getPacketTime() + ".amr");
ICLogger.i("save Amr file to " + amrFilepath);
voiceContent.preview = String.valueOf(Util.getDuration(voiceContent.content));
ds.getDbHelper().updateMessage(voiceContent, uri2);
//插入到数据库中
- message2Db("", amrFilepath, ICDatabaseHelper.MessageType.VOICE);
-// runtime.getContextProxy().sendBroadcast(ACTION_IMESSAGE, runtime);
- connection.DeliverCMDMessageToSystem("NewVoice", amrFilepath);//通知下面线程状态变化
+ message2Db(sourceNumb, amrFilepath, ICDatabaseHelper.MessageType.VOICE);
+ //runtime.getContextProxy().sendBroadcast(ACTION_IMESSAGE, runtime);
+ connection.DeliverCMDMessageToSystem("NewTalkMsg", amrFilepath);//通知下面线程状态变化
}
} else {
ICLogger.e("AP12 format error");