卡顿优化

pull/2/head
Milk 4 years ago
parent f4260320e6
commit 6ba6895785
  1. 21
      Bcore/src/main/java/top/niunaijun/blackbox/app/BActivityThread.java
  2. 1
      Bcore/src/main/java/top/niunaijun/blackbox/proxy/ProxyActivity.java

@ -187,8 +187,8 @@ public class BActivityThread extends IBActivityThread.Stub {
try { try {
application = LoadedApk.makeApplication.call(loadedApk, false, null); application = LoadedApk.makeApplication.call(loadedApk, false, null);
} catch (Throwable e) { } catch (Throwable e) {
// Slog.e(TAG, "Unable to makeApplication"); Slog.e(TAG, "Unable to makeApplication");
// e.printStackTrace(); e.printStackTrace();
} }
mInitialApplication = application; mInitialApplication = application;
if (Objects.equals(packageName, processName)) { if (Objects.equals(packageName, processName)) {
@ -198,16 +198,31 @@ public class BActivityThread extends IBActivityThread.Stub {
} else { } else {
loader = application.getClassLoader(); loader = application.getClassLoader();
} }
VMCore.dumpDex(loader, processName); handleDumpDex(packageName, result, loader);
} }
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
result.dumpError(e.getMessage()); result.dumpError(e.getMessage());
mAppConfig = null;
BlackBoxCore.getBDumpManager().noticeMonitor(result);
BlackBoxCore.get().uninstallPackage(packageName);
}
}
private void handleDumpDex(String packageName, DumpResult result, ClassLoader classLoader) {
new Thread(() -> {
try {
Thread.sleep(500);
} catch (InterruptedException ignored) {
}
try {
VMCore.dumpDex(classLoader, packageName);
} finally { } finally {
mAppConfig = null; mAppConfig = null;
BlackBoxCore.getBDumpManager().noticeMonitor(result); BlackBoxCore.getBDumpManager().noticeMonitor(result);
BlackBoxCore.get().uninstallPackage(packageName); BlackBoxCore.get().uninstallPackage(packageName);
} }
}).start();
} }
private Context createPackageContext(ApplicationInfo info) { private Context createPackageContext(ApplicationInfo info) {

@ -27,7 +27,6 @@ public class ProxyActivity extends Activity {
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
finish(); finish();
Process.killProcess(Process.myPid());
} }
public static class P0 extends ProxyActivity { public static class P0 extends ProxyActivity {

Loading…
Cancel
Save