Don't relaunch app immediately
This commit is contained in:
parent
1512c350df
commit
5133e5910e
@ -1,12 +1,13 @@
|
|||||||
package com.topjohnwu.magisk.model.download
|
package com.topjohnwu.magisk.model.download
|
||||||
|
|
||||||
import com.topjohnwu.magisk.*
|
import com.topjohnwu.magisk.BuildConfig
|
||||||
|
import com.topjohnwu.magisk.Config
|
||||||
|
import com.topjohnwu.magisk.R
|
||||||
|
import com.topjohnwu.magisk.isRunningAsStub
|
||||||
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
|
||||||
import com.topjohnwu.magisk.ui.SplashActivity
|
|
||||||
import com.topjohnwu.magisk.utils.PatchAPK
|
import com.topjohnwu.magisk.utils.PatchAPK
|
||||||
import com.topjohnwu.magisk.utils.Utils
|
|
||||||
import com.topjohnwu.superuser.Shell
|
import com.topjohnwu.superuser.Shell
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@ -35,9 +36,7 @@ private fun RemoteFileService.restore(apk: File, id: Int) {
|
|||||||
Config.export()
|
Config.export()
|
||||||
// Make it world readable
|
// Make it world readable
|
||||||
apk.setReadable(true, false)
|
apk.setReadable(true, false)
|
||||||
if (Shell.su("pm install $apk").exec().isSuccess) {
|
Shell.su("pm install $apk && pm uninstall $packageName").exec()
|
||||||
Utils.rmAndLaunch(packageName, SplashActivity::class.java.cmp())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun RemoteFileService.handleAPK(subject: DownloadSubject.Manager)
|
fun RemoteFileService.handleAPK(subject: DownloadSubject.Manager)
|
||||||
|
@ -9,7 +9,6 @@ import com.topjohnwu.magisk.extensions.DynamicClassLoader
|
|||||||
import com.topjohnwu.magisk.extensions.get
|
import com.topjohnwu.magisk.extensions.get
|
||||||
import com.topjohnwu.magisk.extensions.subscribeK
|
import com.topjohnwu.magisk.extensions.subscribeK
|
||||||
import com.topjohnwu.magisk.extensions.writeTo
|
import com.topjohnwu.magisk.extensions.writeTo
|
||||||
import com.topjohnwu.magisk.ui.SplashActivity
|
|
||||||
import com.topjohnwu.magisk.view.Notifications
|
import com.topjohnwu.magisk.view.Notifications
|
||||||
import com.topjohnwu.signing.JarMap
|
import com.topjohnwu.signing.JarMap
|
||||||
import com.topjohnwu.signing.SignAPK
|
import com.topjohnwu.signing.SignAPK
|
||||||
@ -109,7 +108,7 @@ object PatchAPK {
|
|||||||
|
|
||||||
Config.suManager = pkg
|
Config.suManager = pkg
|
||||||
Config.export()
|
Config.export()
|
||||||
Utils.rmAndLaunch(BuildConfig.APPLICATION_ID, SplashActivity::class.java.cmp(pkg))
|
Shell.su("pm uninstall ${BuildConfig.APPLICATION_ID}").submit()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.topjohnwu.magisk.utils
|
package com.topjohnwu.magisk.utils
|
||||||
|
|
||||||
import android.content.ComponentName
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
@ -73,8 +72,4 @@ object Utils {
|
|||||||
if ((exists() && isDirectory) || mkdirs()) this else null
|
if ((exists() && isDirectory) || mkdirs()) this else null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun rmAndLaunch(rm: String, component: ComponentName) {
|
|
||||||
Shell.su("(rm_launch $rm ${component.flattenToString()})").exec()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -109,9 +109,3 @@ EOF
|
|||||||
touch hosts/auto_mount
|
touch hosts/auto_mount
|
||||||
cd /
|
cd /
|
||||||
}
|
}
|
||||||
|
|
||||||
rm_launch() {
|
|
||||||
pm uninstall $1
|
|
||||||
am start -n $2
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user