mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-18 05:58:30 +00:00
Auto launch new app after repackaging/restoring Manager
This commit is contained in:
parent
e8cba3524e
commit
5fb96cdcf4
@ -101,7 +101,7 @@ public class PatchAPK {
|
|||||||
|
|
||||||
mm.mDB.setStrings(Const.Key.SU_MANAGER, pkg);
|
mm.mDB.setStrings(Const.Key.SU_MANAGER, pkg);
|
||||||
Data.exportPrefs();
|
Data.exportPrefs();
|
||||||
RootUtils.uninstallPkg(Const.ORIG_PKG_NAME);
|
RootUtils.rmAndLaunch(Const.ORIG_PKG_NAME, pkg);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
|||||||
Shell.su("cp " + uri.getPath() + " /data/local/tmp/manager.apk").exec();
|
Shell.su("cp " + uri.getPath() + " /data/local/tmp/manager.apk").exec();
|
||||||
if (ShellUtils.fastCmdResult("pm install /data/local/tmp/manager.apk")) {
|
if (ShellUtils.fastCmdResult("pm install /data/local/tmp/manager.apk")) {
|
||||||
Shell.su("rm -f /data/local/tmp/manager.apk").exec();
|
Shell.su("rm -f /data/local/tmp/manager.apk").exec();
|
||||||
RootUtils.uninstallPkg(context.getPackageName());
|
RootUtils.rmAndLaunch(context.getPackageName(), Const.ORIG_PKG_NAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Shell.su("rm -f /data/local/tmp/manager.apk").exec();
|
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();
|
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
|
@Override
|
||||||
public boolean onInit(Context context, @NonNull Shell shell) {
|
public boolean onInit(Context context, @NonNull Shell shell) {
|
||||||
Shell.Job job = shell.newJob();
|
Shell.Job job = shell.newJob();
|
||||||
|
@ -135,3 +135,10 @@ EOF
|
|||||||
touch hosts/auto_mount
|
touch hosts/auto_mount
|
||||||
cd /
|
cd /
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rm_launch() {
|
||||||
|
db_clean $1
|
||||||
|
pm uninstall $2
|
||||||
|
monkey -p $3 1
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user