diff --git a/app-core/src/main/java/com/topjohnwu/magisk/Const.java b/app-core/src/main/java/com/topjohnwu/magisk/Const.java index dd0be4ddb..ea646b51d 100644 --- a/app-core/src/main/java/com/topjohnwu/magisk/Const.java +++ b/app-core/src/main/java/com/topjohnwu/magisk/Const.java @@ -46,7 +46,7 @@ public class Const { public static final int USER_ID = Process.myUid() / 100000; public static final class MAGISK_VER { - /* Currently no backwards compatibility needed */ + public static final int MIN_SUPPORT = 18000; } public static class ID { diff --git a/app/src/full/java/com/topjohnwu/magisk/SplashActivity.java b/app/src/full/java/com/topjohnwu/magisk/SplashActivity.java index 0710e4bec..bbb4d5e66 100644 --- a/app/src/full/java/com/topjohnwu/magisk/SplashActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/SplashActivity.java @@ -15,15 +15,14 @@ import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.net.Networking; import com.topjohnwu.superuser.Shell; +import androidx.appcompat.app.AlertDialog; + public class SplashActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // Dynamic detect all locales - LocaleManager.loadAvailableLocales(R.string.app_changelog); - String pkg = Config.get(Config.Key.SU_MANAGER); if (pkg != null && getPackageName().equals(BuildConfig.APPLICATION_ID)) { Config.remove(Config.Key.SU_MANAGER); @@ -37,6 +36,22 @@ public class SplashActivity extends BaseActivity { } catch (PackageManager.NameNotFoundException ignored) {} } + if (Config.magiskVersionCode > 0 && Config.magiskVersionCode < Const.MAGISK_VER.MIN_SUPPORT) { + new AlertDialog.Builder(this) + .setTitle(R.string.unsupport_magisk_title) + .setMessage(R.string.unsupport_magisk_message) + .setNegativeButton(R.string.ok, null) + .setOnDismissListener(dialog -> finish()) + .show(); + } else { + initAndStart(); + } + } + + private void initAndStart() { + // Dynamic detect all locales + LocaleManager.loadAvailableLocales(R.string.app_changelog); + // Set default configs Config.initialize(); diff --git a/app/src/full/res/values/strings.xml b/app/src/full/res/values/strings.xml index 4a7cb0bc8..57f9b71cf 100644 --- a/app/src/full/res/values/strings.xml +++ b/app/src/full/res/values/strings.xml @@ -7,6 +7,8 @@ Log Settings Install + Unsupported Magisk Version + This version of Magisk Manager does not support Magisk version lower than v18.0.\n\nYou can either manually upgrade Magisk, or downgrade the app to an older version. Magisk is not installed.