|
@@ -242,6 +242,25 @@ public class AnrFcExceptionUtil implements Thread.UncaughtExceptionHandler {
|
|
|
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...");
|
|
|
AppUpdateHelper.reboot(application);
|
|
|
}
|