|
@@ -13,6 +13,7 @@ import com.github.anrwatchdog.ANRError;
|
|
|
import com.github.anrwatchdog.ANRWatchDog;
|
|
|
import com.wdkl.callingbed.MyApplication;
|
|
|
import com.wdkl.callingbed.common.Constants;
|
|
|
+import com.wdkl.callingbed.util.AutoRebootUtil;
|
|
|
import com.wdkl.callingbed.util.LogUtil;
|
|
|
|
|
|
import java.io.File;
|
|
@@ -72,7 +73,7 @@ public class AnrFcExceptionUtil implements Thread.UncaughtExceptionHandler {
|
|
|
} catch (InterruptedException e) {
|
|
|
Log.e(TAG, "error : ", e);
|
|
|
}
|
|
|
- Intent intent = new Intent(application.getApplicationContext(), Constants.ANR_FC);
|
|
|
+ /*Intent intent = new Intent(application.getApplicationContext(), Constants.ANR_FC);
|
|
|
@SuppressLint("WrongConstant") PendingIntent restartIntent = PendingIntent.getActivity(
|
|
|
application.getApplicationContext(), 0, intent,
|
|
|
Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
@@ -81,7 +82,9 @@ public class AnrFcExceptionUtil implements Thread.UncaughtExceptionHandler {
|
|
|
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 1000,
|
|
|
restartIntent); // 1秒钟后重启应用
|
|
|
//杀死该应用进程
|
|
|
- android.os.Process.killProcess(android.os.Process.myPid());
|
|
|
+ android.os.Process.killProcess(android.os.Process.myPid());*/
|
|
|
+
|
|
|
+ AutoRebootUtil.restartApp();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -163,7 +166,7 @@ public class AnrFcExceptionUtil implements Thread.UncaughtExceptionHandler {
|
|
|
//设置该CrashHandler为程序的默认处理器
|
|
|
AnrFcExceptionUtil catchExcep = AnrFcExceptionUtil.getInstance(application);
|
|
|
Thread.setDefaultUncaughtExceptionHandler(catchExcep);
|
|
|
- mANRWatchDog = new ANRWatchDog(5000);
|
|
|
+ mANRWatchDog = new ANRWatchDog(8000);
|
|
|
mANRWatchDog.setInterruptionListener(new ANRWatchDog.InterruptionListener() {
|
|
|
@Override
|
|
|
public void onInterrupted(InterruptedException exception) {
|
|
@@ -171,12 +174,14 @@ public class AnrFcExceptionUtil implements Thread.UncaughtExceptionHandler {
|
|
|
}).setIgnoreDebugger(true).setANRListener(new ANRWatchDog.ANRListener() {
|
|
|
@Override
|
|
|
public void onAppNotResponding(ANRError error) {
|
|
|
- Intent mStartActivity = new Intent(application.getApplicationContext(), Constants.ANR_FC);
|
|
|
+ /*Intent mStartActivity = new Intent(application.getApplicationContext(), Constants.ANR_FC);
|
|
|
int mPendingIntentId = 123456;
|
|
|
PendingIntent mPendingIntent = PendingIntent.getActivity(application.getApplicationContext(), mPendingIntentId, mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
|
|
|
AlarmManager mgr = (AlarmManager) application.getApplicationContext().getSystemService(Context.ALARM_SERVICE);
|
|
|
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 1500, mPendingIntent);
|
|
|
- android.os.Process.killProcess(android.os.Process.myPid());
|
|
|
+ android.os.Process.killProcess(android.os.Process.myPid());*/
|
|
|
+
|
|
|
+ AutoRebootUtil.restartApp();
|
|
|
}
|
|
|
}).start();
|
|
|
|