From 45c1f6bc2775cf6f9fea33c53591dbd3188f2677 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 23 Oct 2019 06:43:08 -0400 Subject: [PATCH] Fix restore manager when running as stub --- .../com/topjohnwu/magisk/model/download/ManagerUpgrade.kt | 7 ++----- .../topjohnwu/magisk/model/download/RemoteFileService.kt | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/model/download/ManagerUpgrade.kt b/app/src/main/java/com/topjohnwu/magisk/model/download/ManagerUpgrade.kt index f75a8a0c1..b4d6d8cc5 100644 --- a/app/src/main/java/com/topjohnwu/magisk/model/download/ManagerUpgrade.kt +++ b/app/src/main/java/com/topjohnwu/magisk/model/download/ManagerUpgrade.kt @@ -1,9 +1,6 @@ package com.topjohnwu.magisk.model.download -import com.topjohnwu.magisk.BuildConfig -import com.topjohnwu.magisk.Config -import com.topjohnwu.magisk.R -import com.topjohnwu.magisk.cmp +import com.topjohnwu.magisk.* import com.topjohnwu.magisk.model.entity.internal.Configuration.APK.Restore import com.topjohnwu.magisk.model.entity.internal.Configuration.APK.Upgrade import com.topjohnwu.magisk.model.entity.internal.DownloadSubject @@ -14,7 +11,7 @@ import com.topjohnwu.superuser.Shell import java.io.File private fun RemoteFileService.patchPackage(apk: File, id: Int) { - if (packageName != BuildConfig.APPLICATION_ID) { + if (!isRunningAsStub && packageName != BuildConfig.APPLICATION_ID) { update(id) { notification -> notification.setProgress(0, 0, true) .setProgress(0, 0, true) diff --git a/app/src/main/java/com/topjohnwu/magisk/model/download/RemoteFileService.kt b/app/src/main/java/com/topjohnwu/magisk/model/download/RemoteFileService.kt index 8e6dfa6be..febd7fb2f 100644 --- a/app/src/main/java/com/topjohnwu/magisk/model/download/RemoteFileService.kt +++ b/app/src/main/java/com/topjohnwu/magisk/model/download/RemoteFileService.kt @@ -12,7 +12,6 @@ import com.topjohnwu.magisk.extensions.writeTo import com.topjohnwu.magisk.model.entity.internal.DownloadSubject import com.topjohnwu.magisk.model.entity.internal.DownloadSubject.* import com.topjohnwu.magisk.utils.ProgressInputStream -import com.topjohnwu.magisk.isRunningAsStub import com.topjohnwu.magisk.view.Notifications import com.topjohnwu.superuser.ShellUtils import io.reactivex.Completable @@ -72,7 +71,7 @@ abstract class RemoteFileService : NotificationService() { else -> Completable.fromAction { stream.writeTo(subject.file) } } }.doOnComplete { - if (!isRunningAsStub && subject is Manager) + if (subject is Manager) handleAPK(subject) } @@ -116,4 +115,4 @@ abstract class RemoteFileService : NotificationService() { const val ARG_URL = "arg_url" } -} \ No newline at end of file +}