mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Use ClassMaps to prevent errors
This commit is contained in:
parent
2fba3f213b
commit
47c860142e
@ -5,6 +5,14 @@ import android.os.Handler;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.Xml;
|
import android.util.Xml;
|
||||||
|
|
||||||
|
import com.topjohnwu.magisk.components.AboutCardRow;
|
||||||
|
import com.topjohnwu.magisk.receivers.BootReceiver;
|
||||||
|
import com.topjohnwu.magisk.receivers.ManagerUpdate;
|
||||||
|
import com.topjohnwu.magisk.receivers.PackageReceiver;
|
||||||
|
import com.topjohnwu.magisk.receivers.RebootReceiver;
|
||||||
|
import com.topjohnwu.magisk.receivers.ShortcutReceiver;
|
||||||
|
import com.topjohnwu.magisk.services.OnBootService;
|
||||||
|
import com.topjohnwu.magisk.services.UpdateCheckService;
|
||||||
import com.topjohnwu.magisk.utils.FingerprintHelper;
|
import com.topjohnwu.magisk.utils.FingerprintHelper;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
import com.topjohnwu.superuser.Shell;
|
import com.topjohnwu.superuser.Shell;
|
||||||
@ -18,11 +26,14 @@ import org.xmlpull.v1.XmlPullParserException;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class Data {
|
public class Data {
|
||||||
// Global app instance
|
// Global app instance
|
||||||
public static WeakReference<MagiskManager> weakApp;
|
public static WeakReference<MagiskManager> weakApp;
|
||||||
public static Handler mainHandler = new Handler(Looper.getMainLooper());
|
public static Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
public static Map<Class, Class> classMap = new HashMap<>();
|
||||||
|
|
||||||
// Current status
|
// Current status
|
||||||
public static String magiskVersionString;
|
public static String magiskVersionString;
|
||||||
@ -60,6 +71,25 @@ public class Data {
|
|||||||
public static int updateChannel;
|
public static int updateChannel;
|
||||||
public static int repoOrder;
|
public static int repoOrder;
|
||||||
|
|
||||||
|
static {
|
||||||
|
classMap.put(MagiskManager.class, a.a.class);
|
||||||
|
classMap.put(MainActivity.class, a.b.class);
|
||||||
|
classMap.put(SplashActivity.class, a.c.class);
|
||||||
|
classMap.put(AboutActivity.class, a.d.class);
|
||||||
|
classMap.put(DonationActivity.class, a.e.class);
|
||||||
|
classMap.put(FlashActivity.class, a.f.class);
|
||||||
|
classMap.put(NoUIActivity.class, a.g.class);
|
||||||
|
classMap.put(BootReceiver.class, a.h.class);
|
||||||
|
classMap.put(PackageReceiver.class, a.i.class);
|
||||||
|
classMap.put(ManagerUpdate.class, a.j.class);
|
||||||
|
classMap.put(RebootReceiver.class, a.k.class);
|
||||||
|
classMap.put(ShortcutReceiver.class, a.l.class);
|
||||||
|
classMap.put(OnBootService.class, a.m.class);
|
||||||
|
classMap.put(UpdateCheckService.class, a.n.class);
|
||||||
|
classMap.put(AboutCardRow.class, a.o.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static void loadMagiskInfo() {
|
public static void loadMagiskInfo() {
|
||||||
try {
|
try {
|
||||||
magiskVersionString = ShellUtils.fastCmd("magisk -v").split(":")[0];
|
magiskVersionString = ShellUtils.fastCmd("magisk -v").split(":")[0];
|
||||||
|
@ -48,7 +48,7 @@ public class MainActivity extends BaseActivity
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(final Bundle savedInstanceState) {
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
if (!mm.hasInit) {
|
if (!mm.hasInit) {
|
||||||
startActivity(new Intent(this, a.c.class));
|
startActivity(new Intent(this, Data.classMap.get(SplashActivity.class)));
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,11 +194,11 @@ public class MainActivity extends BaseActivity
|
|||||||
displayFragment(new SettingsFragment(), true);
|
displayFragment(new SettingsFragment(), true);
|
||||||
break;
|
break;
|
||||||
case R.id.app_about:
|
case R.id.app_about:
|
||||||
startActivity(new Intent(this, a.d.class));
|
startActivity(new Intent(this, Data.classMap.get(AboutActivity.class)));
|
||||||
mDrawerItem = bak;
|
mDrawerItem = bak;
|
||||||
break;
|
break;
|
||||||
case R.id.donation:
|
case R.id.donation:
|
||||||
startActivity(new Intent(this, a.e.class));
|
startActivity(new Intent(this, Data.classMap.get(DonationActivity.class)));
|
||||||
mDrawerItem = bak;
|
mDrawerItem = bak;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,12 @@ import com.topjohnwu.magisk.asyncs.CheckUpdates;
|
|||||||
import com.topjohnwu.magisk.asyncs.UpdateRepos;
|
import com.topjohnwu.magisk.asyncs.UpdateRepos;
|
||||||
import com.topjohnwu.magisk.components.BaseActivity;
|
import com.topjohnwu.magisk.components.BaseActivity;
|
||||||
import com.topjohnwu.magisk.database.RepoDatabaseHelper;
|
import com.topjohnwu.magisk.database.RepoDatabaseHelper;
|
||||||
|
import com.topjohnwu.magisk.receivers.ShortcutReceiver;
|
||||||
import com.topjohnwu.magisk.utils.Download;
|
import com.topjohnwu.magisk.utils.Download;
|
||||||
import com.topjohnwu.magisk.utils.LocaleManager;
|
import com.topjohnwu.magisk.utils.LocaleManager;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
import com.topjohnwu.superuser.Shell;
|
import com.topjohnwu.superuser.Shell;
|
||||||
|
|
||||||
import a.l;
|
|
||||||
|
|
||||||
public class SplashActivity extends BaseActivity {
|
public class SplashActivity extends BaseActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,7 +44,7 @@ public class SplashActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup shortcuts
|
// Setup shortcuts
|
||||||
sendBroadcast(new Intent(this, l.class));
|
sendBroadcast(new Intent(this, Data.classMap.get(ShortcutReceiver.class)));
|
||||||
|
|
||||||
if (Download.checkNetworkStatus(this)) {
|
if (Download.checkNetworkStatus(this)) {
|
||||||
// Fire update check
|
// Fire update check
|
||||||
@ -59,7 +58,7 @@ public class SplashActivity extends BaseActivity {
|
|||||||
|
|
||||||
mm.hasInit = true;
|
mm.hasInit = true;
|
||||||
|
|
||||||
Intent intent = new Intent(this, a.b.class);
|
Intent intent = new Intent(this, Data.classMap.get(MainActivity.class));
|
||||||
intent.putExtra(Const.Key.OPEN_SECTION, getIntent().getStringExtra(Const.Key.OPEN_SECTION));
|
intent.putExtra(Const.Key.OPEN_SECTION, getIntent().getStringExtra(Const.Key.OPEN_SECTION));
|
||||||
intent.putExtra(BaseActivity.INTENT_PERM, getIntent().getStringExtra(BaseActivity.INTENT_PERM));
|
intent.putExtra(BaseActivity.INTENT_PERM, getIntent().getStringExtra(BaseActivity.INTENT_PERM));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
@ -8,6 +8,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import com.topjohnwu.magisk.Const;
|
import com.topjohnwu.magisk.Const;
|
||||||
import com.topjohnwu.magisk.Data;
|
import com.topjohnwu.magisk.Data;
|
||||||
|
import com.topjohnwu.magisk.FlashActivity;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
import com.topjohnwu.magisk.components.BaseActivity;
|
import com.topjohnwu.magisk.components.BaseActivity;
|
||||||
import com.topjohnwu.magisk.components.SnackbarMaker;
|
import com.topjohnwu.magisk.components.SnackbarMaker;
|
||||||
@ -140,7 +141,7 @@ public class ProcessRepoZip extends ParallelTask<Void, Object, Boolean> {
|
|||||||
if (result) {
|
if (result) {
|
||||||
Uri uri = Uri.fromFile(mFile);
|
Uri uri = Uri.fromFile(mFile);
|
||||||
if (mInstall) {
|
if (mInstall) {
|
||||||
Intent intent = new Intent(activity, a.f.class);
|
Intent intent = new Intent(activity, Data.classMap.get(FlashActivity.class));
|
||||||
intent.setData(uri).putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_ZIP);
|
intent.setData(uri).putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_ZIP);
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
} else {
|
} else {
|
||||||
|
@ -8,6 +8,7 @@ import android.widget.Toast;
|
|||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
import com.topjohnwu.magisk.Const;
|
import com.topjohnwu.magisk.Const;
|
||||||
import com.topjohnwu.magisk.Data;
|
import com.topjohnwu.magisk.Data;
|
||||||
|
import com.topjohnwu.magisk.FlashActivity;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
import com.topjohnwu.magisk.receivers.DownloadReceiver;
|
import com.topjohnwu.magisk.receivers.DownloadReceiver;
|
||||||
import com.topjohnwu.magisk.utils.Download;
|
import com.topjohnwu.magisk.utils.Download;
|
||||||
@ -37,7 +38,7 @@ class InstallMethodDialog extends AlertDialog.Builder {
|
|||||||
(requestCode, resultCode, data) -> {
|
(requestCode, resultCode, data) -> {
|
||||||
if (requestCode == Const.ID.SELECT_BOOT &&
|
if (requestCode == Const.ID.SELECT_BOOT &&
|
||||||
resultCode == BaseActivity.RESULT_OK && data != null) {
|
resultCode == BaseActivity.RESULT_OK && data != null) {
|
||||||
Intent i = new Intent(activity, a.f.class)
|
Intent i = new Intent(activity, Data.classMap.get(FlashActivity.class))
|
||||||
.putExtra(Const.Key.FLASH_SET_BOOT, data.getData())
|
.putExtra(Const.Key.FLASH_SET_BOOT, data.getData())
|
||||||
.putExtra(Const.Key.FLASH_ACTION, Const.Value.PATCH_BOOT);
|
.putExtra(Const.Key.FLASH_ACTION, Const.Value.PATCH_BOOT);
|
||||||
activity.startActivity(i);
|
activity.startActivity(i);
|
||||||
@ -55,7 +56,7 @@ class InstallMethodDialog extends AlertDialog.Builder {
|
|||||||
}, Data.magiskLink, filename);
|
}, Data.magiskLink, filename);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
intent = new Intent(activity, a.f.class)
|
intent = new Intent(activity, Data.classMap.get(FlashActivity.class))
|
||||||
.putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_MAGISK);
|
.putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_MAGISK);
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
break;
|
break;
|
||||||
@ -65,7 +66,7 @@ class InstallMethodDialog extends AlertDialog.Builder {
|
|||||||
.setMessage(R.string.install_inactive_slot_msg)
|
.setMessage(R.string.install_inactive_slot_msg)
|
||||||
.setCancelable(true)
|
.setCancelable(true)
|
||||||
.setPositiveButton(R.string.yes, (d, i) -> {
|
.setPositiveButton(R.string.yes, (d, i) -> {
|
||||||
Intent it = new Intent(activity, a.f.class)
|
Intent it = new Intent(activity, Data.classMap.get(FlashActivity.class))
|
||||||
.putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_INACTIVE_SLOT);
|
.putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_INACTIVE_SLOT);
|
||||||
activity.startActivity(it);
|
activity.startActivity(it);
|
||||||
})
|
})
|
||||||
|
@ -9,9 +9,9 @@ import com.topjohnwu.magisk.Data;
|
|||||||
import com.topjohnwu.magisk.MagiskManager;
|
import com.topjohnwu.magisk.MagiskManager;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
import com.topjohnwu.magisk.asyncs.MarkDownWindow;
|
import com.topjohnwu.magisk.asyncs.MarkDownWindow;
|
||||||
|
import com.topjohnwu.magisk.receivers.ManagerUpdate;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
|
|
||||||
import a.j;
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
public class ManagerInstallDialog extends CustomAlertDialog {
|
public class ManagerInstallDialog extends CustomAlertDialog {
|
||||||
@ -26,7 +26,7 @@ public class ManagerInstallDialog extends CustomAlertDialog {
|
|||||||
setCancelable(true);
|
setCancelable(true);
|
||||||
setPositiveButton(R.string.install, (d, i) -> activity.runWithPermission(
|
setPositiveButton(R.string.install, (d, i) -> activity.runWithPermission(
|
||||||
new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, () -> {
|
new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, () -> {
|
||||||
Intent intent = new Intent(mm, j.class);
|
Intent intent = new Intent(mm, Data.classMap.get(ManagerUpdate.class));
|
||||||
intent.putExtra(Const.Key.INTENT_SET_LINK, Data.managerLink);
|
intent.putExtra(Const.Key.INTENT_SET_LINK, Data.managerLink);
|
||||||
intent.putExtra(Const.Key.INTENT_SET_FILENAME, filename);
|
intent.putExtra(Const.Key.INTENT_SET_FILENAME, filename);
|
||||||
mm.sendBroadcast(intent);
|
mm.sendBroadcast(intent);
|
||||||
|
@ -10,6 +10,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import com.topjohnwu.magisk.Const;
|
import com.topjohnwu.magisk.Const;
|
||||||
import com.topjohnwu.magisk.Data;
|
import com.topjohnwu.magisk.Data;
|
||||||
|
import com.topjohnwu.magisk.FlashActivity;
|
||||||
import com.topjohnwu.magisk.MagiskManager;
|
import com.topjohnwu.magisk.MagiskManager;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
import com.topjohnwu.magisk.receivers.DownloadReceiver;
|
import com.topjohnwu.magisk.receivers.DownloadReceiver;
|
||||||
@ -44,7 +45,7 @@ public class UninstallDialog extends CustomAlertDialog {
|
|||||||
Download.receive(activity, new DownloadReceiver() {
|
Download.receive(activity, new DownloadReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onDownloadDone(Context context, Uri uri) {
|
public void onDownloadDone(Context context, Uri uri) {
|
||||||
Intent intent = new Intent(context, a.f.class)
|
Intent intent = new Intent(context, Data.classMap.get(FlashActivity.class))
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
.setData(uri)
|
.setData(uri)
|
||||||
.putExtra(Const.Key.FLASH_ACTION, Const.Value.UNINSTALL);
|
.putExtra(Const.Key.FLASH_ACTION, Const.Value.UNINSTALL);
|
||||||
|
@ -13,6 +13,8 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.Const;
|
import com.topjohnwu.magisk.Const;
|
||||||
|
import com.topjohnwu.magisk.Data;
|
||||||
|
import com.topjohnwu.magisk.FlashActivity;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
import com.topjohnwu.magisk.ViewBinder;
|
import com.topjohnwu.magisk.ViewBinder;
|
||||||
import com.topjohnwu.magisk.adapters.ModulesAdapter;
|
import com.topjohnwu.magisk.adapters.ModulesAdapter;
|
||||||
@ -90,7 +92,7 @@ public class ModulesFragment extends BaseFragment implements Topic.Subscriber {
|
|||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if (requestCode == Const.ID.FETCH_ZIP && resultCode == Activity.RESULT_OK && data != null) {
|
if (requestCode == Const.ID.FETCH_ZIP && resultCode == Activity.RESULT_OK && data != null) {
|
||||||
// Get the URI of the selected file
|
// Get the URI of the selected file
|
||||||
Intent intent = new Intent(getActivity(), a.f.class);
|
Intent intent = new Intent(getActivity(), Data.classMap.get(FlashActivity.class));
|
||||||
intent.setData(data.getData()).putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_ZIP);
|
intent.setData(data.getData()).putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_ZIP);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import com.topjohnwu.magisk.Const;
|
|||||||
import com.topjohnwu.magisk.Data;
|
import com.topjohnwu.magisk.Data;
|
||||||
import com.topjohnwu.magisk.MagiskManager;
|
import com.topjohnwu.magisk.MagiskManager;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
|
import com.topjohnwu.magisk.SplashActivity;
|
||||||
import com.topjohnwu.superuser.Shell;
|
import com.topjohnwu.superuser.Shell;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -36,7 +37,7 @@ public class ShortcutReceiver extends BroadcastReceiver {
|
|||||||
Data.multiuserMode == Const.Value.MULTIUSER_MODE_OWNER_MANAGED)) {
|
Data.multiuserMode == Const.Value.MULTIUSER_MODE_OWNER_MANAGED)) {
|
||||||
shortCuts.add(new ShortcutInfo.Builder(mm, "superuser")
|
shortCuts.add(new ShortcutInfo.Builder(mm, "superuser")
|
||||||
.setShortLabel(mm.getString(R.string.superuser))
|
.setShortLabel(mm.getString(R.string.superuser))
|
||||||
.setIntent(new Intent(mm, a.c.class)
|
.setIntent(new Intent(mm, Data.classMap.get(SplashActivity.class))
|
||||||
.putExtra(Const.Key.OPEN_SECTION, "superuser")
|
.putExtra(Const.Key.OPEN_SECTION, "superuser")
|
||||||
.setAction(Intent.ACTION_VIEW)
|
.setAction(Intent.ACTION_VIEW)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
|
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
|
||||||
@ -48,7 +49,7 @@ public class ShortcutReceiver extends BroadcastReceiver {
|
|||||||
&& mm.prefs.getBoolean(Const.Key.MAGISKHIDE, false)) {
|
&& mm.prefs.getBoolean(Const.Key.MAGISKHIDE, false)) {
|
||||||
shortCuts.add(new ShortcutInfo.Builder(mm, "magiskhide")
|
shortCuts.add(new ShortcutInfo.Builder(mm, "magiskhide")
|
||||||
.setShortLabel(mm.getString(R.string.magiskhide))
|
.setShortLabel(mm.getString(R.string.magiskhide))
|
||||||
.setIntent(new Intent(mm, a.c.class)
|
.setIntent(new Intent(mm, Data.classMap.get(SplashActivity.class))
|
||||||
.putExtra(Const.Key.OPEN_SECTION, "magiskhide")
|
.putExtra(Const.Key.OPEN_SECTION, "magiskhide")
|
||||||
.setAction(Intent.ACTION_VIEW)
|
.setAction(Intent.ACTION_VIEW)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
|
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
|
||||||
@ -59,7 +60,7 @@ public class ShortcutReceiver extends BroadcastReceiver {
|
|||||||
if (!mm.prefs.getBoolean(Const.Key.COREONLY, false) && root && Data.magiskVersionCode >= 0) {
|
if (!mm.prefs.getBoolean(Const.Key.COREONLY, false) && root && Data.magiskVersionCode >= 0) {
|
||||||
shortCuts.add(new ShortcutInfo.Builder(mm, "modules")
|
shortCuts.add(new ShortcutInfo.Builder(mm, "modules")
|
||||||
.setShortLabel(mm.getString(R.string.modules))
|
.setShortLabel(mm.getString(R.string.modules))
|
||||||
.setIntent(new Intent(mm, a.c.class)
|
.setIntent(new Intent(mm, Data.classMap.get(SplashActivity.class))
|
||||||
.putExtra(Const.Key.OPEN_SECTION, "modules")
|
.putExtra(Const.Key.OPEN_SECTION, "modules")
|
||||||
.setAction(Intent.ACTION_VIEW)
|
.setAction(Intent.ACTION_VIEW)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
|
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
|
||||||
@ -68,7 +69,7 @@ public class ShortcutReceiver extends BroadcastReceiver {
|
|||||||
.build());
|
.build());
|
||||||
shortCuts.add(new ShortcutInfo.Builder(mm, "downloads")
|
shortCuts.add(new ShortcutInfo.Builder(mm, "downloads")
|
||||||
.setShortLabel(mm.getString(R.string.download))
|
.setShortLabel(mm.getString(R.string.download))
|
||||||
.setIntent(new Intent(mm, a.c.class)
|
.setIntent(new Intent(mm, Data.classMap.get(SplashActivity.class))
|
||||||
.putExtra(Const.Key.OPEN_SECTION, "downloads")
|
.putExtra(Const.Key.OPEN_SECTION, "downloads")
|
||||||
.setAction(Intent.ACTION_VIEW)
|
.setAction(Intent.ACTION_VIEW)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
|
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
|
||||||
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.Const;
|
import com.topjohnwu.magisk.Const;
|
||||||
|
import com.topjohnwu.magisk.Data;
|
||||||
import com.topjohnwu.magisk.utils.NotificationMgr;
|
import com.topjohnwu.magisk.utils.NotificationMgr;
|
||||||
import com.topjohnwu.superuser.Shell;
|
import com.topjohnwu.superuser.Shell;
|
||||||
import com.topjohnwu.superuser.ShellUtils;
|
import com.topjohnwu.superuser.ShellUtils;
|
||||||
@ -14,7 +15,7 @@ import androidx.core.app.JobIntentService;
|
|||||||
public class OnBootService extends JobIntentService {
|
public class OnBootService extends JobIntentService {
|
||||||
|
|
||||||
public static void enqueueWork(Context context) {
|
public static void enqueueWork(Context context) {
|
||||||
enqueueWork(context, OnBootService.class, Const.ID.ONBOOT_SERVICE_ID, new Intent());
|
enqueueWork(context, Data.classMap.get(OnBootService.class), Const.ID.ONBOOT_SERVICE_ID, new Intent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,9 +9,10 @@ import com.topjohnwu.magisk.Const;
|
|||||||
import com.topjohnwu.magisk.Data;
|
import com.topjohnwu.magisk.Data;
|
||||||
import com.topjohnwu.magisk.MagiskManager;
|
import com.topjohnwu.magisk.MagiskManager;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
|
import com.topjohnwu.magisk.SplashActivity;
|
||||||
|
import com.topjohnwu.magisk.receivers.ManagerUpdate;
|
||||||
|
import com.topjohnwu.magisk.receivers.RebootReceiver;
|
||||||
|
|
||||||
import a.j;
|
|
||||||
import a.k;
|
|
||||||
import androidx.core.app.NotificationCompat;
|
import androidx.core.app.NotificationCompat;
|
||||||
import androidx.core.app.TaskStackBuilder;
|
import androidx.core.app.TaskStackBuilder;
|
||||||
|
|
||||||
@ -20,10 +21,10 @@ public class NotificationMgr {
|
|||||||
public static void magiskUpdate() {
|
public static void magiskUpdate() {
|
||||||
MagiskManager mm = Data.MM();
|
MagiskManager mm = Data.MM();
|
||||||
|
|
||||||
Intent intent = new Intent(mm, a.c.class);
|
Intent intent = new Intent(mm, Data.classMap.get(SplashActivity.class));
|
||||||
intent.putExtra(Const.Key.OPEN_SECTION, "magisk");
|
intent.putExtra(Const.Key.OPEN_SECTION, "magisk");
|
||||||
TaskStackBuilder stackBuilder = TaskStackBuilder.create(mm);
|
TaskStackBuilder stackBuilder = TaskStackBuilder.create(mm);
|
||||||
stackBuilder.addParentStack(a.c.class);
|
stackBuilder.addParentStack(Data.classMap.get(SplashActivity.class));
|
||||||
stackBuilder.addNextIntent(intent);
|
stackBuilder.addNextIntent(intent);
|
||||||
PendingIntent pendingIntent = stackBuilder.getPendingIntent(Const.ID.MAGISK_UPDATE_NOTIFICATION_ID,
|
PendingIntent pendingIntent = stackBuilder.getPendingIntent(Const.ID.MAGISK_UPDATE_NOTIFICATION_ID,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
@ -46,7 +47,7 @@ public class NotificationMgr {
|
|||||||
String filename = Utils.fmt("MagiskManager-v%s(%d).apk",
|
String filename = Utils.fmt("MagiskManager-v%s(%d).apk",
|
||||||
Data.remoteManagerVersionString, Data.remoteManagerVersionCode);
|
Data.remoteManagerVersionString, Data.remoteManagerVersionCode);
|
||||||
|
|
||||||
Intent intent = new Intent(mm, j.class);
|
Intent intent = new Intent(mm, Data.classMap.get(ManagerUpdate.class));
|
||||||
intent.putExtra(Const.Key.INTENT_SET_LINK, Data.managerLink);
|
intent.putExtra(Const.Key.INTENT_SET_LINK, Data.managerLink);
|
||||||
intent.putExtra(Const.Key.INTENT_SET_FILENAME, filename);
|
intent.putExtra(Const.Key.INTENT_SET_FILENAME, filename);
|
||||||
PendingIntent pendingIntent = PendingIntent.getBroadcast(mm,
|
PendingIntent pendingIntent = PendingIntent.getBroadcast(mm,
|
||||||
@ -68,7 +69,7 @@ public class NotificationMgr {
|
|||||||
public static void dtboPatched() {
|
public static void dtboPatched() {
|
||||||
MagiskManager mm = Data.MM();
|
MagiskManager mm = Data.MM();
|
||||||
|
|
||||||
Intent intent = new Intent(mm, k.class);
|
Intent intent = new Intent(mm, Data.classMap.get(RebootReceiver.class));
|
||||||
PendingIntent pendingIntent = PendingIntent.getBroadcast(mm,
|
PendingIntent pendingIntent = PendingIntent.getBroadcast(mm,
|
||||||
Const.ID.DTBO_NOTIFICATION_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
Const.ID.DTBO_NOTIFICATION_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user