diff --git a/app/src/full/java/com/topjohnwu/magisk/asyncs/PatchAPK.java b/app/src/full/java/com/topjohnwu/magisk/asyncs/PatchAPK.java index 486824fc7..be53fdba3 100644 --- a/app/src/full/java/com/topjohnwu/magisk/asyncs/PatchAPK.java +++ b/app/src/full/java/com/topjohnwu/magisk/asyncs/PatchAPK.java @@ -101,7 +101,7 @@ public class PatchAPK { mm.mDB.setStrings(Const.Key.SU_MANAGER, pkg); Data.exportPrefs(); - RootUtils.uninstallPkg(Const.ORIG_PKG_NAME); + RootUtils.rmAndLaunch(Const.ORIG_PKG_NAME, pkg); return true; } diff --git a/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java index 4200f6470..971b93009 100644 --- a/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java @@ -93,7 +93,7 @@ public class SettingsFragment extends PreferenceFragmentCompat 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()); + RootUtils.rmAndLaunch(context.getPackageName(), Const.ORIG_PKG_NAME); return; } Shell.su("rm -f /data/local/tmp/manager.apk").exec(); diff --git a/app/src/full/java/com/topjohnwu/magisk/utils/RootUtils.java b/app/src/full/java/com/topjohnwu/magisk/utils/RootUtils.java index 0a587946e..dbf4e02a3 100644 --- a/app/src/full/java/com/topjohnwu/magisk/utils/RootUtils.java +++ b/app/src/full/java/com/topjohnwu/magisk/utils/RootUtils.java @@ -25,6 +25,10 @@ public class RootUtils extends Shell.Initializer { Shell.su("db_clean " + Const.USER_ID, "pm uninstall " + pkg).exec(); } + public static void rmAndLaunch(String rm, String launch) { + Shell.su(Utils.fmt("(rm_launch %d %s %s)&", Const.USER_ID, rm, launch)).exec(); + } + @Override public boolean onInit(Context context, @NonNull Shell shell) { Shell.Job job = shell.newJob(); diff --git a/app/src/full/res/raw/utils.sh b/app/src/full/res/raw/utils.sh index 65a92b1c7..111ef57d0 100644 --- a/app/src/full/res/raw/utils.sh +++ b/app/src/full/res/raw/utils.sh @@ -135,3 +135,10 @@ EOF touch hosts/auto_mount cd / } + +rm_launch() { + db_clean $1 + pm uninstall $2 + monkey -p $3 1 + exit +}