fix: app ANR when crash

This commit is contained in:
hyb1996
2017-12-04 23:28:29 +08:00
parent 1f31dd51d1
commit 0473dfbf60
5 changed files with 34 additions and 19 deletions

View File

@@ -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();
}
}