Fix restore manager when running as stub

This commit is contained in:
topjohnwu 2019-10-23 06:43:08 -04:00
parent 0d31e5c8b1
commit 45c1f6bc27
2 changed files with 4 additions and 8 deletions

View File

@ -1,9 +1,6 @@
package com.topjohnwu.magisk.model.download package com.topjohnwu.magisk.model.download
import com.topjohnwu.magisk.BuildConfig import com.topjohnwu.magisk.*
import com.topjohnwu.magisk.Config
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.cmp
import com.topjohnwu.magisk.model.entity.internal.Configuration.APK.Restore 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.Configuration.APK.Upgrade
import com.topjohnwu.magisk.model.entity.internal.DownloadSubject import com.topjohnwu.magisk.model.entity.internal.DownloadSubject
@ -14,7 +11,7 @@ import com.topjohnwu.superuser.Shell
import java.io.File import java.io.File
private fun RemoteFileService.patchPackage(apk: File, id: Int) { private fun RemoteFileService.patchPackage(apk: File, id: Int) {
if (packageName != BuildConfig.APPLICATION_ID) { if (!isRunningAsStub && packageName != BuildConfig.APPLICATION_ID) {
update(id) { notification -> update(id) { notification ->
notification.setProgress(0, 0, true) notification.setProgress(0, 0, true)
.setProgress(0, 0, true) .setProgress(0, 0, true)

View File

@ -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.model.entity.internal.DownloadSubject.* import com.topjohnwu.magisk.model.entity.internal.DownloadSubject.*
import com.topjohnwu.magisk.utils.ProgressInputStream import com.topjohnwu.magisk.utils.ProgressInputStream
import com.topjohnwu.magisk.isRunningAsStub
import com.topjohnwu.magisk.view.Notifications import com.topjohnwu.magisk.view.Notifications
import com.topjohnwu.superuser.ShellUtils import com.topjohnwu.superuser.ShellUtils
import io.reactivex.Completable import io.reactivex.Completable
@ -72,7 +71,7 @@ abstract class RemoteFileService : NotificationService() {
else -> Completable.fromAction { stream.writeTo(subject.file) } else -> Completable.fromAction { stream.writeTo(subject.file) }
} }
}.doOnComplete { }.doOnComplete {
if (!isRunningAsStub && subject is Manager) if (subject is Manager)
handleAPK(subject) handleAPK(subject)
} }