Commit 5fb96cdc authored by topjohnwu's avatar topjohnwu

Auto launch new app after repackaging/restoring Manager

parent e8cba352
......@@ -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;
}
......
......@@ -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();
......
......@@ -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();
......
......@@ -135,3 +135,10 @@ EOF
touch hosts/auto_mount
cd /
}
rm_launch() {
db_clean $1
pm uninstall $2
monkey -p $3 1
exit
}
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