Ver código fonte

<修改重启操作>

weizhengliang 4 anos atrás
pai
commit
254ac82ad0

+ 4 - 4
app/src/main/java/com/wdkl/callingmainnurse/util/AnalysisUdpUtil.java

@@ -492,11 +492,11 @@ public class AnalysisUdpUtil {
                 case "MGR_SYSTEM_RESET"://系统重启
                     if (data[1].equals(Constants.MAC_ADDRESS)) {
 
-                        if (SerialPortUtil.systemVersionIsO()) {//安卓8.1.0 版用
-                            MyApplication.serialPortUtil.systemRestart();//调用吴总串口
-                        } else {
+                        //if (SerialPortUtil.systemVersionIsO()) {//安卓8.1.0 版用
+                        //    MyApplication.serialPortUtil.systemRestart();//调用吴总串口
+                        //} else {
                             AutoRebootUtil.reboot();//调用Linux-shell命令
-                        }
+                        //}
 
                     }
                     break;

+ 9 - 2
app/src/main/java/com/wdkl/callingmainnurse/util/AutoRebootUtil.java

@@ -5,6 +5,8 @@ import android.content.Intent;
 import android.os.SystemProperties;
 import android.util.Log;
 
+import com.wdkl.callingmainnurse.MyApplication;
+
 import serialporttest.utils.SerialPortUtil;
 
 import static com.wdkl.callingmainnurse.common.Constants.NET_ERROR_FIVE_AFTER_TOAST;
@@ -46,8 +48,13 @@ public class AutoRebootUtil {
             closeHeart();
             try {
                 if (SerialPortUtil.systemVersionIsO()) {// android8.1 //wuyq modify
-                    SystemProperties.set("persist.sys.reboot", "1");
-
+                    //SystemProperties.set("persist.sys.reboot", "1");
+                    Intent intent = new Intent(Intent.ACTION_REBOOT);
+                    intent.putExtra("nowait", 1);
+                    intent.putExtra("interval", 1);
+                    intent.putExtra("window", 0);
+                    MyApplication.getAppContext().sendBroadcast(intent);
+                    Log.d("wzlll", "reboot start");
                 } else {
                     Process proc = Runtime.getRuntime().exec(new String[]{"su", "-c", "/system/bin/reboot"});
                     proc.waitFor();