From 52fe0c6abbb7bf90e48b5798ec8266f7712acc87 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 31 Jul 2018 01:05:56 +0800 Subject: [PATCH] Fix restore manager on Android P --- .../full/java/com/topjohnwu/magisk/SettingsActivity.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/full/java/com/topjohnwu/magisk/SettingsActivity.java b/app/src/full/java/com/topjohnwu/magisk/SettingsActivity.java index 673570733..8dd7deb5d 100644 --- a/app/src/full/java/com/topjohnwu/magisk/SettingsActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/SettingsActivity.java @@ -174,8 +174,13 @@ public class SettingsActivity extends Activity implements Topic.Subscriber { @Override public void onDownloadDone(Context context, Uri uri) { mm.dumpPrefs(); - if (ShellUtils.fastCmdResult("pm install " + uri.getPath())) + Shell.su("cp " + uri.getPath() + " /data/local/tmp/manager.apk").exec(); + if (ShellUtils.fastCmdResult("pm install /data/local/tmp/manager.apk")) { + Shell.su("rm -f /data/local/tmp/manager.apk").exec(); RootUtils.uninstallPkg(context.getPackageName()); + return; + } + Shell.su("rm -f /data/local/tmp/manager.apk").exec(); } }, mm.managerLink,