Jelajahi Sumber

<可以通过护士管理软件重启门口机>

weizhengliang 4 tahun lalu
induk
melakukan
d20ff238ec

+ 2 - 2
app/src/main/java/com/wdkl/callingdoor/util/AnalysisUdpUtil.java

@@ -248,10 +248,10 @@ public class AnalysisUdpUtil {
                         }
                         break;
                     case "MGR_SYSTEM_RESET"://系统重启
-                        if (data[1].equals(Constants.MAC_ADDRESS)) {
+                        //if (data[1].equals(Constants.MAC_ADDRESS)) {
                             //MyApplication.serialPortUtil.systemRestart();//调用吴总串口
                             AutoRebootUtil.reboot();//调用Linux-shell命令
-                        }
+                        //}
                         break;
                     //给出设备信息
                     case "MGR_REG_Q":

+ 8 - 2
app/src/main/java/com/wdkl/callingdoor/util/AutoRebootUtil.java

@@ -5,6 +5,8 @@ import android.content.Intent;
 import android.os.SystemProperties;
 import android.util.Log;
 
+import com.wdkl.callingdoor.MyApplication;
+
 import java.util.Calendar;
 
 import serialporttest.utils.SerialPortUtil;
@@ -62,8 +64,12 @@ 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);
                 } else {
                     Process proc = Runtime.getRuntime().exec(new String[]{"su", "-c", "/system/bin/reboot"});
                     proc.waitFor();