|
@@ -39,7 +39,7 @@ public class XCrashUtils {
|
|
private final ICrashCallback callback = new ICrashCallback() {
|
|
private final ICrashCallback callback = new ICrashCallback() {
|
|
@Override
|
|
@Override
|
|
public void onCrash(String logPath, String emergency) {
|
|
public void onCrash(String logPath, String emergency) {
|
|
- Log.d(TAG, "log path: " + (logPath != null ? logPath : "(null)") + ", emergency: " + (emergency != null ? emergency : "(null)"));
|
|
|
|
|
|
+ Log.d(TAG, "java crash log path: " + (logPath != null ? logPath : "(null)") + ", emergency: " + (emergency != null ? emergency : "(null)"));
|
|
|
|
|
|
if (emergency != null) {
|
|
if (emergency != null) {
|
|
debug(logPath, emergency);
|
|
debug(logPath, emergency);
|
|
@@ -71,11 +71,22 @@ public class XCrashUtils {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ //native crash
|
|
|
|
+ private final ICrashCallback nativeCallback = new ICrashCallback() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onCrash(String logPath, String emergency) {
|
|
|
|
+ Log.d(TAG, "native crash log path: " + (logPath != null ? logPath : "(null)") + ", emergency: " + (emergency != null ? emergency : "(null)"));
|
|
|
|
+
|
|
|
|
+ //native crash to restart app
|
|
|
|
+ restartApp();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
//ANR Catcher
|
|
//ANR Catcher
|
|
private final ICrashCallback anrCallback = new ICrashCallback() {
|
|
private final ICrashCallback anrCallback = new ICrashCallback() {
|
|
@Override
|
|
@Override
|
|
public void onCrash(String logPath, String emergency) {
|
|
public void onCrash(String logPath, String emergency) {
|
|
- Log.d(TAG, "log path: " + (logPath != null ? logPath : "(null)") + ", emergency: " + (emergency != null ? emergency : "(null)"));
|
|
|
|
|
|
+ Log.d(TAG, "anr log path: " + (logPath != null ? logPath : "(null)") + ", emergency: " + (emergency != null ? emergency : "(null)"));
|
|
|
|
|
|
if (emergency != null) {
|
|
if (emergency != null) {
|
|
debug(logPath, emergency);
|
|
debug(logPath, emergency);
|
|
@@ -98,7 +109,7 @@ public class XCrashUtils {
|
|
if (Build.MODEL.equals("rk3128") || Build.MODEL.equals("rk3288")) {
|
|
if (Build.MODEL.equals("rk3128") || Build.MODEL.equals("rk3288")) {
|
|
AppUpdateHelper.reboot(app, false);
|
|
AppUpdateHelper.reboot(app, false);
|
|
} else {
|
|
} else {
|
|
- AppUpdateHelper.restartApp(app);
|
|
|
|
|
|
+ restartApp();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -119,7 +130,7 @@ public class XCrashUtils {
|
|
.setNativeLogCountMax(10)
|
|
.setNativeLogCountMax(10)
|
|
.setNativeDumpAllThreadsWhiteList(new String[]{"^xcrash\\.sample$", "^Signal Catcher$", "^Jit thread pool$", ".*(R|r)ender.*", ".*Chrome.*"})
|
|
.setNativeDumpAllThreadsWhiteList(new String[]{"^xcrash\\.sample$", "^Signal Catcher$", "^Jit thread pool$", ".*(R|r)ender.*", ".*Chrome.*"})
|
|
.setNativeDumpAllThreadsCountMax(10)
|
|
.setNativeDumpAllThreadsCountMax(10)
|
|
- .setNativeCallback(callback)
|
|
|
|
|
|
+ .setNativeCallback(nativeCallback)
|
|
.setAnrRethrow(true)
|
|
.setAnrRethrow(true)
|
|
.setAnrLogCountMax(10)
|
|
.setAnrLogCountMax(10)
|
|
.setAnrCallback(anrCallback)
|
|
.setAnrCallback(anrCallback)
|