mHandler.postDelayed(new Runnable() {
@Override
public void run() {
- Util.shutdown();
+ Util.shutdown(context);
}
}, 1000);
}
.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)));
}
}
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())) {
//创建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 专用功能拍照时检测用户体温心率
} else {
Util.ShowToast(paramRuntime, "Do poweroff!");
}
- mSendMSGHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- Util.shutdown();
- }
- }, 2000);
+ mSendMSGHandler.postDelayed(() ->
+ Util.shutdown(paramRuntime.getContextProxy().context), 2000);
return true;
} else if ("FactoryResetCheckSim".equals(paramStringMessage.cmd())) {
mSendMSGHandler.postDelayed(new Runnable() {
@Override
public void run() {
- Util.shutdown();
+ Util.shutdown(paramRuntime.getContextProxy().context);
}
}, 2000);
return true;
} else if ("heartbeat".equals(paramStringMessage.cmd())) {
//每次心跳,查询一下 是否有语音消息需要接收。
// paramConnection.send(protocolAPIHelper.genStringMessage("AP05",protocolAPIHelper.AP05(true)));
-
} else if ("getWeather".equals(paramStringMessage.cmd())) {
ICLogger.i("获取天气");
mConnection.send(protocolAPIHelper.getWeatherMSG(mRuntime));
context.sendBroadcast(intent);
}
} else if ("findDev".equals(paramStringMessage.cmd())) {
+ ICLogger.d("find device...");
mSendMSGHandler.postDelayed(() -> {
final Context context = (mRuntime.getContextProxy()).context;
Intent intent = new Intent();
ICLogger.d(Constants.ACTION_MESSAGE_RECEIVED + " " + paramStringMessage.isFromCache());
//显示提示窗口
intent.setAction(DIALOG_ACTION);
- intent.putExtra("findDev", "Find Device");
+ intent.putExtra("findDev", context.getString(R.string.find_device_text));
+ intent.setPackage(context.getPackageName());
+ ICLogger.d("send find device action...");
context.sendBroadcast(intent);
}, 500);
* * * 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", "");
}
private CustomDialog getDialogInstance() {
-
this.mDialog = new CustomDialog(this.context, R.style.Dialog);
LayoutInflater var1 = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view;
contentBuilder.append(" ");
contentBuilder.append(fromWhere);
contentBuilder.append(context.getString(R.string.voiceMessageEnd));
- mCustomDialog = tmpDialog.setMessage(contentBuilder.toString()).setPositiveButton(context.getString(R.string.ok), new DialogInterface.OnClickListener() {
+ 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",
VibrateUtil.getInstance(context).vibrateOn(false);
}
}).create();
- mCustomDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_TOAST);
+ mCustomDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
mCustomDialog.show();
} else if (app_id == 2) {
tmpDialog = this.mDialog.setTitle(context.getString(R.string.hht_misscall_call)).setApp(app_id);
VibrateUtil.getInstance(context).vibrateOn(false);
}
}).create();
- mCustomDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_TOAST);
+ mCustomDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
mCustomDialog.show();
} else if (app_id == 3) {
tmpDialog = this.mDialog.setTitle(context.getString(R.string.sms_title)).setApp(1);
VibrateUtil.getInstance(context).vibrateOn(false);
}
}).create();
- mCustomDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_TOAST);
+ mCustomDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
mCustomDialog.show();
} else if (app_id == 4) {
tmpDialog = this.mDialog.setTitle("WEB" + context.getString(R.string.sms_title)).setApp(1);
}
}).create();
}
- mCustomDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_TOAST);
+ mCustomDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
mCustomDialog.show();
} else if (app_id == 5) {
tmpDialog = this.mDialog.setTitle(context.getString(R.string.findDev)).setApp(1);
stopmediaplayer();
}
}).create();
- mCustomDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_TOAST);
+ mCustomDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
mCustomDialog.show();
} else if (app_id == 6) {
tmpDialog = this.mDialog.setTitle(context.getString(R.string.notification_title)).setApp(1);
}
}
}).create();
- mCustomDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_TOAST);
+ mCustomDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
mCustomDialog.show();
}
}
playshutdownsound(paramContext);
- Util.shutdown();
+ Util.shutdown(paramContext);
return;
} else if (ACTION_PLAYTIME.equals(str)) {
LedUtil.setBlueLedOn(true);
- mHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- LedUtil.setBlueLedOn(false);
- }
- }, 2000L);
+ mHandler.postDelayed(() -> LedUtil.setBlueLedOn(false), 2000L);
return;
} else if (ACTION_REMOTE_CAMERA.equals(str)) {
if (paramIntent.hasExtra("remote_number")) {
return;
} else if (DIALOG_ACTION.equals(str)) {
+ ICLogger.d("receive DIALOG_ACTION");
if (paramIntent.hasExtra("contact")) {
contact = (Contact) paramIntent.getParcelableExtra("contact");
SharePreferenceUtil.getPrefBoolean(paramContext, "key_is_resume", false);
this.screenOn(paramContext);
}
} else if (paramIntent.hasExtra("findDev")) {
- String finddevtxt = paramIntent.getStringExtra("findDev");
+ ICLogger.d("hasExtra(findDev)");
+ String findDevTxt = paramIntent.getStringExtra("findDev");
SharePreferenceUtil.getPrefBoolean(paramContext, "key_is_resume", false);
isSilence = SharePreferenceUtil.getPrefBoolean(paramContext, "KEY_ISSILENCE", false);
- if (finddevtxt != null && !isSilence) {
- this.initMyDialog(paramContext, null, 5, finddevtxt, false);
+ ICLogger.d("isSilence ==> " + isSilence);
+ ICLogger.d("findDevTxt ==> " + findDevTxt);
+ if (findDevTxt != null && !isSilence) {
+ this.initMyDialog(paramContext, null, 5, findDevTxt, false);
this.playFindDevVoice(paramContext);
VibrateUtil.getInstance(paramContext).vibrateOn(true);
-
this.screenOn(paramContext);
}
} else if (paramIntent.hasExtra("takephoto")) {
private static String FT6236U_upgrade_dev = "/sys/devices/platform/soc/soc:ap-apb/70800000.i2c/i2c-3/3-0038/ftsfwupdate";
private static String FT6236U_getver_dev = "/sys/devices/platform/soc/soc:ap-apb/70800000.i2c/i2c-3/3-0038/ftstpfwver";
- public static boolean needResizeSquare(){
- String modelname=getSystemProperties("ro.product.model","");
- return (modelname.contains("C46")||modelname.contains("C48"));
+ public static boolean needResizeSquare() {
+ String modelname = getSystemProperties("ro.product.model", "");
+ return (modelname.contains("C46") || modelname.contains("C48"));
}
+
public static void mSleep(int ms) {
try {
Thread.yield();
}
- public static void shutdown() {
+ public static void shutdown(Context context) {
try {
ICLogger.i("do shutdown!");
//获得ServiceManager类
Method shutdown = oIPowerManager.getClass().getMethod("shutdown", boolean.class, boolean.class);
//调用shutdown()方法
shutdown.invoke(oIPowerManager, false, true);
-
} catch (Exception e) {
e.printStackTrace();
ICLogger.e(e.getMessage(), e);
+ //如果出错了,就调用8.1的关机,发个广播完事
+ Intent intent = new Intent();
+ intent.setAction("com.ic.action.SYSTEM_POWER_OFF_NO_CONFIRM");
+ context.sendBroadcast(intent);
}
}
<?xml version="1.0" encoding="utf-8"?>\r
-<FrameLayout android:orientation="vertical" android:padding="20.0dip" android:clickable="true" android:layout_width="fill_parent" android:layout_height="fill_parent"\r
- xmlns:android="http://schemas.android.com/apk/res/android">\r
- <LinearLayout android:layout_gravity="center" android:orientation="vertical" android:background="@drawable/dialog_bottom_bg" android:layout_width="fill_parent" android:layout_height="wrap_content">\r
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+ android:layout_width="fill_parent"\r
+ android:layout_height="fill_parent"\r
+ android:clickable="true"\r
+ android:orientation="vertical"\r
+ android:padding="20.0dip">\r
+\r
+ <LinearLayout\r
+ android:layout_width="fill_parent"\r
+ android:layout_height="wrap_content"\r
+ android:layout_gravity="center"\r
+ android:background="@drawable/dialog_bottom_bg"\r
+ android:orientation="vertical">\r
\r
<TextView\r
android:id="@+id/title"\r
android:layout_height="40.0dip"\r
android:gravity="center"\r
android:text="@string/title_alert"\r
- android:textSize="30sp"\r
+ android:textSize="26sp"\r
android:visibility="visible" />\r
- <LinearLayout android:gravity="center" android:id="@+id/noticeContent" android:layout_width="fill_parent" android:layout_height="wrap_content">\r
+\r
+ <LinearLayout\r
+ android:id="@+id/noticeContent"\r
+ android:layout_width="fill_parent"\r
+ android:layout_height="wrap_content"\r
+ android:gravity="center">\r
\r
<TextView\r
android:id="@+id/message"\r
android:paddingBottom="15.0dip"\r
android:textSize="25sp" />\r
</LinearLayout>\r
+\r
<View\r
- android:background="#ffd0d0d0"\r
android:layout_width="fill_parent"\r
- android:layout_height="1.0px" />\r
+ android:layout_height="1.0px"\r
+ android:background="#ffd0d0d0" />\r
+\r
<LinearLayout\r
- android:gravity="center"\r
+ android:layout_width="fill_parent"\r
+ android:layout_height="60.0dip"\r
android:layout_gravity="bottom"\r
- android:orientation="horizontal"\r
android:background="@drawable/bg_bombbox"\r
- android:layout_width="fill_parent"\r
- android:layout_height="60.0dip">\r
+ android:gravity="center"\r
+ android:orientation="horizontal">\r
+\r
<Button\r
- android:textColor="#ff000000"\r
- android:gravity="center"\r
android:id="@+id/positiveButton"\r
- android:background="@drawable/btn_query"\r
+ style="@style/text_16_666666"\r
android:layout_width="wrap_content"\r
android:layout_height="wrap_content"\r
+ android:background="@drawable/btn_query"\r
+ android:gravity="center"\r
android:text="@string/ok"\r
- style="@style/text_16_666666" />\r
+ android:textColor="#ff000000"\r
+ android:textSize="20sp" />\r
+\r
<ImageButton\r
- android:gravity="center"\r
android:id="@+id/negativeButton"\r
- android:background="#00000000"\r
- android:visibility="gone"\r
+ style="@style/text_15_666666_sdw"\r
android:layout_width="wrap_content"\r
android:layout_height="wrap_content"\r
android:layout_marginLeft="20.0dip"\r
+ android:background="#00000000"\r
+ android:gravity="center"\r
android:src="@drawable/btn_cancel_selector"\r
android:text="@string/cancel"\r
- style="@style/text_15_666666_sdw" />\r
+ android:visibility="gone" />\r
</LinearLayout>\r
</LinearLayout>\r
</FrameLayout>
\ No newline at end of file
android:padding="10dp"\r
android:text="@string/title_alert"\r
android:textColor="#000000"\r
- android:textSize="30sp"\r
+ android:textSize="26sp"\r
android:visibility="visible" />\r
\r
<View\r
android:background="@drawable/selector_btn_confirm"\r
android:gravity="center"\r
android:padding="20dp"\r
+ android:textSize="20sp"\r
android:text="@string/ok"\r
android:textColor="@color/white" />\r
\r
android:background="@drawable/selector_btn_cancel"\r
android:gravity="center"\r
android:padding="20dp"\r
+ android:textSize="20sp"\r
android:text="@string/cancel"\r
android:textColor="@color/white" />\r
</LinearLayout>\r
<string name="send_success_tips_text">发送成功</string>\r
<string name="back_text">返回</string>\r
<string name="send_text">发送</string>\r
+ <string name="find_device_text">设备查找</string>\r
</resources>\r
<string name="send_success_tips_text">发送成功</string>\r
<string name="back_text">返回</string>\r
<string name="send_text">发送</string>\r
+ <string name="find_device_text">设备查找</string>\r
</resources>\r
<string name="send_success_tips_text">发送成功</string>\r
<string name="back_text">返回</string>\r
<string name="send_text">发送</string>\r
+ <string name="find_device_text">设备查找</string>\r
</resources>\r
<string name="send_success_tips_text">发送成功</string>
<string name="back_text">返回</string>
<string name="send_text">发送</string>
+ <string name="find_device_text">设备查找</string>
</resources>
<string name="send_success_tips_text">发送成功</string>
<string name="back_text">返回</string>
<string name="send_text">发送</string>
+ <string name="find_device_text">设备查找</string>
</resources>
\ No newline at end of file
<string name="send_success_tips_text">发送成功</string>
<string name="back_text">返回</string>
<string name="send_text">发送</string>
+ <string name="find_device_text">设备查找</string>
</resources>
<string name="send_success_tips_text">发送成功</string>
<string name="back_text">返回</string>
<string name="send_text">发送</string>
+ <string name="find_device_text">设备查找</string>
</resources>