fix process bug

pull/29/head
Milk 4 years ago
parent 865bad3b15
commit 5aeb3b79e2
  1. 1
      Bcore/src/main/java/top/niunaijun/blackbox/core/VMCore.java
  2. 19
      app/src/main/java/top/niunaijun/blackdex/data/DexDumpRepository.kt
  3. 2
      app/src/main/java/top/niunaijun/blackdex/view/main/MainActivity.kt

@ -67,6 +67,7 @@ public class VMCore {
long cookie = cookies.get(i); long cookie = cookies.get(i);
if (cookie == 0) { if (cookie == 0) {
countDownLatch.countDown(); countDownLatch.countDown();
BlackBoxCore.getBDumpManager().noticeMonitor(result.dumpProcess(cookies.size(), atomicInteger.getAndIncrement()));
continue; continue;
} }
FileUtils.mkdirs(file); FileUtils.mkdirs(file);

@ -32,7 +32,7 @@ class DexDumpRepository {
fun getAppList(mAppListLiveData: MutableLiveData<List<AppInfo>>) { fun getAppList(mAppListLiveData: MutableLiveData<List<AppInfo>>) {
val installedApplications: List<ApplicationInfo> = val installedApplications: List<ApplicationInfo> =
getPackageManager().getInstalledApplications(0) getPackageManager().getInstalledApplications(0)
val installedList = mutableListOf<AppInfo>() val installedList = mutableListOf<AppInfo>()
for (installedApplication in installedApplications) { for (installedApplication in installedApplications) {
@ -44,9 +44,9 @@ class DexDumpRepository {
val info = AppInfo( val info = AppInfo(
installedApplication.loadLabel(getPackageManager()).toString(), installedApplication.loadLabel(getPackageManager()).toString(),
installedApplication.packageName, installedApplication.packageName,
installedApplication.loadIcon(getPackageManager()) installedApplication.loadIcon(getPackageManager())
) )
installedList.add(info) installedList.add(info)
} }
@ -83,22 +83,17 @@ class DexDumpRepository {
private fun startCountdown(dexDumpLiveData: MutableLiveData<DumpInfo>) { private fun startCountdown(dexDumpLiveData: MutableLiveData<DumpInfo>) {
GlobalScope.launch { GlobalScope.launch {
val tempId = dumpTaskId val tempId = dumpTaskId
while (BlackDexCore.get().isRunning) {
while (BlackDexCore.get().isRunning){
delay(10000) delay(10000)
//10s //10s
if (!AppManager.mBlackBoxLoader.isFixCodeItem()) {
if(!AppManager.mBlackBoxLoader.isFixCodeItem()){ break
break
} }
//fixCodeItem 需要长时间运行,普通内存dump不需要 //fixCodeItem 需要长时间运行,普通内存dump不需要
} }
if (tempId == dumpTaskId) { if (tempId == dumpTaskId) {
dexDumpLiveData.postValue(DumpInfo(DumpInfo.TIMEOUT)) dexDumpLiveData.postValue(DumpInfo(DumpInfo.TIMEOUT))
} }
} }
} }
} }

@ -161,7 +161,7 @@ class MainActivity : PermissionActivity() {
private val mMonitor = object : IBDumpMonitor.Stub() { private val mMonitor = object : IBDumpMonitor.Stub() {
override fun onDump(result: DumpResult?) { override fun onDump(result: DumpResult?) {
result?.let { result?.let {
Log.e("onDump", result.toString())
// 此处做进度条 // 此处做进度条
if (result.isRunning) { if (result.isRunning) {
loadingView?.setProgress(result.currProcess, result.totalProcess) loadingView?.setProgress(result.currProcess, result.totalProcess)

Loading…
Cancel
Save