From 5aeb3b79e2b8d0e4ac9207a76c4789a26d827132 Mon Sep 17 00:00:00 2001 From: Milk <1871357815@qq.com> Date: Mon, 7 Jun 2021 23:42:47 +0800 Subject: [PATCH] fix process bug --- .../top/niunaijun/blackbox/core/VMCore.java | 1 + .../blackdex/data/DexDumpRepository.kt | 19 +++++++------------ .../blackdex/view/main/MainActivity.kt | 2 +- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Bcore/src/main/java/top/niunaijun/blackbox/core/VMCore.java b/Bcore/src/main/java/top/niunaijun/blackbox/core/VMCore.java index e4f0c28..4fadd56 100644 --- a/Bcore/src/main/java/top/niunaijun/blackbox/core/VMCore.java +++ b/Bcore/src/main/java/top/niunaijun/blackbox/core/VMCore.java @@ -67,6 +67,7 @@ public class VMCore { long cookie = cookies.get(i); if (cookie == 0) { countDownLatch.countDown(); + BlackBoxCore.getBDumpManager().noticeMonitor(result.dumpProcess(cookies.size(), atomicInteger.getAndIncrement())); continue; } FileUtils.mkdirs(file); diff --git a/app/src/main/java/top/niunaijun/blackdex/data/DexDumpRepository.kt b/app/src/main/java/top/niunaijun/blackdex/data/DexDumpRepository.kt index 9a4939e..21b0d18 100644 --- a/app/src/main/java/top/niunaijun/blackdex/data/DexDumpRepository.kt +++ b/app/src/main/java/top/niunaijun/blackdex/data/DexDumpRepository.kt @@ -32,7 +32,7 @@ class DexDumpRepository { fun getAppList(mAppListLiveData: MutableLiveData>) { val installedApplications: List = - getPackageManager().getInstalledApplications(0) + getPackageManager().getInstalledApplications(0) val installedList = mutableListOf() for (installedApplication in installedApplications) { @@ -44,9 +44,9 @@ class DexDumpRepository { val info = AppInfo( - installedApplication.loadLabel(getPackageManager()).toString(), - installedApplication.packageName, - installedApplication.loadIcon(getPackageManager()) + installedApplication.loadLabel(getPackageManager()).toString(), + installedApplication.packageName, + installedApplication.loadIcon(getPackageManager()) ) installedList.add(info) } @@ -83,22 +83,17 @@ class DexDumpRepository { private fun startCountdown(dexDumpLiveData: MutableLiveData) { GlobalScope.launch { val tempId = dumpTaskId - - while (BlackDexCore.get().isRunning){ + while (BlackDexCore.get().isRunning) { delay(10000) //10s - - if(!AppManager.mBlackBoxLoader.isFixCodeItem()){ - break + if (!AppManager.mBlackBoxLoader.isFixCodeItem()) { + break } //fixCodeItem 需要长时间运行,普通内存dump不需要 } - - if (tempId == dumpTaskId) { dexDumpLiveData.postValue(DumpInfo(DumpInfo.TIMEOUT)) } } - } } \ No newline at end of file diff --git a/app/src/main/java/top/niunaijun/blackdex/view/main/MainActivity.kt b/app/src/main/java/top/niunaijun/blackdex/view/main/MainActivity.kt index cd32d3a..989ea8a 100644 --- a/app/src/main/java/top/niunaijun/blackdex/view/main/MainActivity.kt +++ b/app/src/main/java/top/niunaijun/blackdex/view/main/MainActivity.kt @@ -161,7 +161,7 @@ class MainActivity : PermissionActivity() { private val mMonitor = object : IBDumpMonitor.Stub() { override fun onDump(result: DumpResult?) { result?.let { - + Log.e("onDump", result.toString()) // 此处做进度条 if (result.isRunning) { loadingView?.setProgress(result.currProcess, result.totalProcess)