From 294db93fdeb12a5c0db92aabd5981b75d0a9ad66 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 23 Oct 2019 17:20:55 -0400 Subject: [PATCH] Copy instead of move We might be copying from CE to DE storage, which cannot be moved --- .../com/topjohnwu/magisk/model/download/DownloadService.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/model/download/DownloadService.kt b/app/src/main/java/com/topjohnwu/magisk/model/download/DownloadService.kt index f22ba0af7..082978af0 100644 --- a/app/src/main/java/com/topjohnwu/magisk/model/download/DownloadService.kt +++ b/app/src/main/java/com/topjohnwu/magisk/model/download/DownloadService.kt @@ -13,6 +13,7 @@ import com.topjohnwu.magisk.extensions.chooser import com.topjohnwu.magisk.extensions.exists import com.topjohnwu.magisk.extensions.provide import com.topjohnwu.magisk.intent +import com.topjohnwu.magisk.isRunningAsStub import com.topjohnwu.magisk.model.entity.internal.Configuration.* import com.topjohnwu.magisk.model.entity.internal.Configuration.Flash.Secondary import com.topjohnwu.magisk.model.entity.internal.DownloadSubject @@ -20,7 +21,6 @@ import com.topjohnwu.magisk.model.entity.internal.DownloadSubject.* import com.topjohnwu.magisk.ui.flash.FlashActivity import com.topjohnwu.magisk.utils.APKInstall import com.topjohnwu.magisk.utils.DynAPK -import com.topjohnwu.magisk.isRunningAsStub import org.koin.core.get import java.io.File import kotlin.random.Random.Default.nextInt @@ -67,7 +67,8 @@ open class DownloadService : RemoteFileService() { when (subject.configuration) { is APK.Upgrade -> { if (isRunningAsStub) { - subject.file.renameTo(DynAPK.update(this)) + subject.file.copyTo(DynAPK.update(this), overwrite = true) + subject.file.delete() ProcessPhoenix.triggerRebirth(this) } else { APKInstall.install(this, subject.file) @@ -161,4 +162,4 @@ open class DownloadService : RemoteFileService() { } -} \ No newline at end of file +}