Fix restore manager on Android P

This commit is contained in:
topjohnwu 2018-07-31 01:05:56 +08:00
parent 5cb3e5937f
commit 52fe0c6abb

View File

@ -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,