Commit 45c1f6bc authored by topjohnwu's avatar topjohnwu

Fix restore manager when running as stub

parent 0d31e5c8
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 ...@@ -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)
......
...@@ -12,7 +12,6 @@ import com.topjohnwu.magisk.extensions.writeTo ...@@ -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() { ...@@ -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)
} }
...@@ -116,4 +115,4 @@ abstract class RemoteFileService : NotificationService() { ...@@ -116,4 +115,4 @@ abstract class RemoteFileService : NotificationService() {
const val ARG_URL = "arg_url" const val ARG_URL = "arg_url"
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment