Cleanup scripts

This commit is contained in:
topjohnwu
2019-03-22 02:32:21 -04:00
parent eae1c17738
commit ecb33d3176
4 changed files with 23 additions and 14 deletions

View File

@ -1,9 +1,13 @@
package com.topjohnwu.magisk.utils;
import android.content.ComponentName;
import com.topjohnwu.magisk.App;
import com.topjohnwu.magisk.BuildConfig;
import com.topjohnwu.magisk.ClassMap;
import com.topjohnwu.magisk.Config;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.SplashActivity;
import com.topjohnwu.magisk.uicomponents.ProgressNotification;
import com.topjohnwu.net.Networking;
import com.topjohnwu.net.ResponseListener;
@ -85,7 +89,9 @@ public class DownloadApp {
// Make it world readable
apk.setReadable(true, false);
if (Shell.su("pm install " + apk).exec().isSuccess())
RootUtils.rmAndLaunch(app.getPackageName(), BuildConfig.APPLICATION_ID);
RootUtils.rmAndLaunch(app.getPackageName(),
new ComponentName(BuildConfig.APPLICATION_ID,
ClassMap.get(SplashActivity.class).getName()));
progress.dismiss();
}
}

View File

@ -1,14 +1,17 @@
package com.topjohnwu.magisk.utils;
import android.content.ComponentName;
import android.widget.Toast;
import androidx.core.app.NotificationCompat;
import com.topjohnwu.magisk.App;
import com.topjohnwu.magisk.BuildConfig;
import com.topjohnwu.magisk.ClassMap;
import com.topjohnwu.magisk.Config;
import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.SplashActivity;
import com.topjohnwu.magisk.uicomponents.Notifications;
import com.topjohnwu.signing.JarMap;
import com.topjohnwu.signing.SignAPK;
@ -109,7 +112,8 @@ public class PatchAPK {
Config.set(Config.Key.SU_MANAGER, pkg);
Config.export();
RootUtils.rmAndLaunch(BuildConfig.APPLICATION_ID, pkg);
RootUtils.rmAndLaunch(BuildConfig.APPLICATION_ID,
new ComponentName(pkg, ClassMap.get(SplashActivity.class).getName()));
return true;
}

View File

@ -1,5 +1,6 @@
package com.topjohnwu.magisk.utils;
import android.content.ComponentName;
import android.content.Context;
import androidx.annotation.NonNull;
@ -15,8 +16,8 @@ import java.io.InputStream;
public class RootUtils extends Shell.Initializer {
public static void rmAndLaunch(String rm, String launch) {
Shell.su(Utils.fmt("(rm_launch %s %s)&", rm, launch)).exec();
public static void rmAndLaunch(String rm, ComponentName component) {
Shell.su(Utils.fmt("(rm_launch %s %s)&", rm, component.flattenToString())).exec();
}
@Override