feat: uncaught exception on non-ui threads does not cause crash report any more
This commit is contained in:
@@ -7,6 +7,7 @@ package com.stardust.scriptdroid.tool;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@@ -34,6 +35,10 @@ public class CrashHandler implements UncaughtExceptionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void uncaughtException(Thread thread, Throwable ex) {
|
public void uncaughtException(Thread thread, Throwable ex) {
|
||||||
|
if (thread != Looper.getMainLooper().getThread()) {
|
||||||
|
Log.e(TAG, "Uncaught Exception", ex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
AccessibilityService service = AccessibilityService.getInstance();
|
AccessibilityService service = AccessibilityService.getInstance();
|
||||||
if (service != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (service != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
service.disableSelf();
|
service.disableSelf();
|
||||||
|
|||||||
Reference in New Issue
Block a user