mirror of
https://github.com/TonyJiangWJ/Auto.js.git
synced 2026-06-21 21:01:43 +08:00
fix: app ANR when crash
This commit is contained in:
parent
1f31dd51d1
commit
0473dfbf60
@ -1 +1 @@
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1},"path":"inrt-release.apk","properties":{"packageId":"com.stardust.auojs.inrt","split":"","minSdkVersion":"17"}}]
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":231},"path":"release-3.0.0 Alpha31.apk","properties":{"packageId":"com.stardust.scriptdroid","split":"","minSdkVersion":"17"}}]
|
||||
@ -14,7 +14,7 @@ function showLoginUI(){
|
||||
</linear>
|
||||
<linear>
|
||||
<text w="56" gravity="center" color="#111111" size="16">密码</text>
|
||||
<input id="password" w="*" h="40" inputType="password"/>
|
||||
<input id="password" w="*" h="40" password="true"/>
|
||||
</linear>
|
||||
<linear gravity="center">
|
||||
<button id="login" text="登录"/>
|
||||
|
||||
@ -4,6 +4,7 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.support.multidex.MultiDexApplication;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
@ -57,6 +58,8 @@ public class App extends MultiDexApplication {
|
||||
}
|
||||
|
||||
private void setUpStaticsTool() {
|
||||
if (BuildConfig.DEBUG)
|
||||
return;
|
||||
new FlurryAgent.Builder()
|
||||
.withLogEnabled(BuildConfig.DEBUG)
|
||||
.build(this, "D42MH48ZN4PJC5TKNYZD");
|
||||
@ -68,8 +71,8 @@ public class App extends MultiDexApplication {
|
||||
return;
|
||||
}
|
||||
LeakCanary.install(this);
|
||||
if (!BuildConfig.DEBUG)
|
||||
Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(ErrorReportActivity.class));
|
||||
//if (!BuildConfig.DEBUG)
|
||||
Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(ErrorReportActivity.class));
|
||||
}
|
||||
|
||||
private void init() {
|
||||
|
||||
@ -6,14 +6,15 @@ package com.stardust.scriptdroid.tool;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.stardust.scriptdroid.App;
|
||||
import com.stardust.scriptdroid.R;
|
||||
import com.stardust.scriptdroid.accessibility.AccessibilityService;
|
||||
import com.stardust.util.IntentUtil;
|
||||
import com.stardust.view.accessibility.AccessibilityService;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
@ -37,13 +38,19 @@ public class CrashHandler implements UncaughtExceptionHandler {
|
||||
}
|
||||
try {
|
||||
Log.e(TAG, "Uncaught Exception", ex);
|
||||
AccessibilityService service = AccessibilityService.getInstance();
|
||||
if (service != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
service.disableSelf();
|
||||
}
|
||||
if (crashTooManyTimes())
|
||||
return;
|
||||
String msg = App.getApp().getString(R.string.sorry_for_crash) + ex.toString();
|
||||
startErrorReportActivity(msg, throwableToString(ex));
|
||||
System.exit(0);
|
||||
} catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static boolean causedByBadWindowToken(Throwable e) {
|
||||
|
||||
@ -313,20 +313,25 @@ public class ScriptRuntime {
|
||||
}
|
||||
|
||||
public void onExit() {
|
||||
threads.shutDownAll();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
images.releaseScreenCapturer();
|
||||
}
|
||||
if (mRootShell != null) {
|
||||
mRootShell.exitAndWaitFor();
|
||||
}
|
||||
mRootShell = null;
|
||||
mShellSupplier = null;
|
||||
if (events != null) {
|
||||
events.recycle();
|
||||
}
|
||||
if (loopers != null) {
|
||||
loopers.quitAll();
|
||||
try {
|
||||
threads.shutDownAll();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
images.releaseScreenCapturer();
|
||||
}
|
||||
|
||||
if (events != null) {
|
||||
events.recycle();
|
||||
}
|
||||
if (loopers != null) {
|
||||
loopers.quitAll();
|
||||
}
|
||||
if (mRootShell != null) {
|
||||
mRootShell.exitAndWaitFor();
|
||||
}
|
||||
mRootShell = null;
|
||||
mShellSupplier = null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user