|
@@ -79,12 +79,6 @@ public class AnrFcExceptionUtil implements Thread.UncaughtExceptionHandler {
|
|
|
//如果用户没有处理则让系统默认的异常处理器来处理
|
|
|
mDefaultHandler.uncaughtException(thread, ex);
|
|
|
} else {
|
|
|
- try {
|
|
|
- Thread.sleep(5000);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- Log.e(TAG, "error : ", e);
|
|
|
- }
|
|
|
-
|
|
|
//restartApp();
|
|
|
AppUpdateHelper.reboot(application);
|
|
|
}
|
|
@@ -110,7 +104,9 @@ public class AnrFcExceptionUtil implements Thread.UncaughtExceptionHandler {
|
|
|
Looper.loop();
|
|
|
}
|
|
|
}.start();*/
|
|
|
- saveCrashInfo2File(ex);
|
|
|
+ //saveCrashInfo2File(ex);
|
|
|
+
|
|
|
+ AppUpdateHelper.reboot(application);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -227,38 +223,8 @@ 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);
|
|
|
- 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());*/
|
|
|
-
|
|
|
- //记录anr发生时间
|
|
|
- /*try {
|
|
|
- long timestamp = System.currentTimeMillis();
|
|
|
- String time = format.format(new Date());
|
|
|
- format.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
|
- String fileName = "anr-" + time + "-" + timestamp + ".txt";
|
|
|
- if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
|
|
- String path = Environment.getExternalStorageDirectory() + "/anr/";
|
|
|
- File dir = new File(path);
|
|
|
- if (!dir.exists()) {
|
|
|
- dir.mkdirs();
|
|
|
- }
|
|
|
- FileOutputStream fos = new FileOutputStream(path + fileName);
|
|
|
- fos.write(fileName.getBytes());
|
|
|
- fos.close();
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- }*/
|
|
|
-
|
|
|
Log.d("anr", "Anr restart app...");
|
|
|
- if ("rk3128".equals(Build.MODEL) || "WDMK_I".equals(Build.MODEL) || "WDMKI".equals(Build.MODEL)) {
|
|
|
- AppUpdateHelper.reboot(application);
|
|
|
- } else {
|
|
|
- restartApp();
|
|
|
- }
|
|
|
+ AppUpdateHelper.reboot(application);
|
|
|
}
|
|
|
}).start();
|
|
|
|