Quellcode durchsuchen

<app卡死时直接重启设备>

weizhengliang vor 3 Jahren
Ursprung
Commit
e831b9a47f

+ 3 - 1
app/build.gradle

@@ -33,12 +33,14 @@ android {
 
     compileSdkVersion 26
     buildToolsVersion "26.0.1"
+    aaptOptions.noCompress("mp3","wav","apk")
+
     defaultConfig {
         applicationId "com.wdkl.callingbed"
         minSdkVersion 15
         targetSdkVersion 26
         versionCode 1
-        versionName "1.62"
+        versionName "1.63"
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
 
         buildConfigField "String", "BUILD_TIME", getDate()

+ 2 - 2
app/src/main/AndroidManifest.xml

@@ -71,11 +71,11 @@
 
         <activity android:name=".ui.CallingBedActivity"
             android:screenOrientation="landscape"
-            android:launchMode="singleTask"></activity>
+            android:launchMode="singleTask"/>
 
         <activity android:name=".ui.APPUpdateActivity"
             android:screenOrientation="landscape"
-            android:launchMode="singleTop"></activity>
+            android:launchMode="singleTop"/>
 
         <activity android:name=".ui.InitActivity"
             android:screenOrientation="landscape">

+ 4 - 1
app/src/main/java/com/wdkl/callingbed/util/anrfcutil/AnrFcExceptionUtil.java

@@ -16,6 +16,7 @@ import com.wdkl.callingbed.common.Constants;
 import com.wdkl.callingbed.util.AutoRebootUtil;
 import com.wdkl.callingbed.util.ClientUploadUtils;
 import com.wdkl.callingbed.util.LogUtil;
+import com.wdkl.callingbed.util.sendcommand.CallingBedSendCommand;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -190,7 +191,9 @@ public class AnrFcExceptionUtil implements Thread.UncaughtExceptionHandler {
                 mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 1500, mPendingIntent);
                 android.os.Process.killProcess(android.os.Process.myPid());*/
 
-                AutoRebootUtil.restartApp();
+                //AutoRebootUtil.restartApp();
+                AutoRebootUtil.reboot(MyApplication.getAppContext());
+                CallingBedSendCommand.setNetStatus(MyApplication.serialPortUtil, "1");
             }
         }).start();
 

+ 3 - 1
app/src/main/java/com/wdkl/callingbed/util/sendcommand/CallingBedSendCommand.java

@@ -55,7 +55,9 @@ public class CallingBedSendCommand {
      * data: 0 -- 断电,  1 -- 上电
      */
     public static void setNetStatus(SerialPortUtil serialPortUtil, String data) {
-        serialPortUtil.sendCommand(SerialPortUtil.NET_STATUS , data, "F");
+        if (serialPortUtil != null) {
+            serialPortUtil.sendCommand(SerialPortUtil.NET_STATUS, data, "F");
+        }
     }
 
     /**