diff --git a/build.gradle b/build.gradle index 24c35a5ef..77358e193 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 27 - buildToolsVersion "27.0.2" + buildToolsVersion "27.0.3" defaultConfig { applicationId "com.topjohnwu.magisk" diff --git a/src/main/java/com/topjohnwu/magisk/MagiskFragment.java b/src/main/java/com/topjohnwu/magisk/MagiskFragment.java index f62ee330f..9efc95679 100644 --- a/src/main/java/com/topjohnwu/magisk/MagiskFragment.java +++ b/src/main/java/com/topjohnwu/magisk/MagiskFragment.java @@ -91,7 +91,7 @@ public class MagiskFragment extends Fragment new CheckSafetyNet(getActivity()).exec(); collapse(); }; - if (mm.snetVersion < 0) { + if (!CheckSafetyNet.dexPath.exists()) { // Show dialog new AlertDialogBuilder(getActivity()) .setTitle(R.string.proprietary_title) diff --git a/src/main/java/com/topjohnwu/magisk/MagiskManager.java b/src/main/java/com/topjohnwu/magisk/MagiskManager.java index fc1eb5a44..d5e3ddcf8 100644 --- a/src/main/java/com/topjohnwu/magisk/MagiskManager.java +++ b/src/main/java/com/topjohnwu/magisk/MagiskManager.java @@ -49,7 +49,6 @@ public class MagiskManager extends Application { public int remoteManagerVersionCode = -1; public String managerLink; public String bootBlock = null; - public int snetVersion; public boolean keepVerity = false; public boolean keepEnc = false; @@ -145,7 +144,6 @@ public class MagiskManager extends Application { updateNotification = prefs.getBoolean(Const.Key.UPDATE_NOTIFICATION, true); updateChannel = Utils.getPrefsInt(prefs, Const.Key.UPDATE_CHANNEL, Const.Value.STABLE_CHANNEL); bootFormat = prefs.getString(Const.Key.BOOT_FORMAT, ".img"); - snetVersion = prefs.getInt(Const.Key.SNET_VER, -1); customChannelUrl = prefs.getString(Const.Key.CUSTOM_CHANNEL, ""); } diff --git a/src/main/java/com/topjohnwu/magisk/SplashActivity.java b/src/main/java/com/topjohnwu/magisk/SplashActivity.java index 2f3249c2e..454625b27 100644 --- a/src/main/java/com/topjohnwu/magisk/SplashActivity.java +++ b/src/main/java/com/topjohnwu/magisk/SplashActivity.java @@ -61,7 +61,7 @@ public class SplashActivity extends Activity { if (Shell.rootAccess() && mm.magiskVersionCode > 0) { // Add update checking service - if (Const.Value.UPDATE_SERVICE_VER > mm.prefs.getInt(Const.Key.UPDATE_SERVICE_VER, -1)) { + if (Const.UPDATE_SERVICE_VER > mm.prefs.getInt(Const.Key.UPDATE_SERVICE_VER, -1)) { ComponentName service = new ComponentName(this, UpdateCheckService.class); JobInfo info = new JobInfo.Builder(Const.ID.UPDATE_SERVICE_ID, service) .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY) @@ -95,7 +95,7 @@ public class SplashActivity extends Activity { .putString(Const.Key.UPDATE_CHANNEL, String.valueOf(mm.updateChannel)) .putString(Const.Key.LOCALE, mm.localeConfig) .putString(Const.Key.BOOT_FORMAT, mm.bootFormat) - .putInt(Const.Key.UPDATE_SERVICE_VER, Const.Value.UPDATE_SERVICE_VER) + .putInt(Const.Key.UPDATE_SERVICE_VER, Const.UPDATE_SERVICE_VER) .apply(); mm.hasInit = true; diff --git a/src/main/java/com/topjohnwu/magisk/asyncs/CheckSafetyNet.java b/src/main/java/com/topjohnwu/magisk/asyncs/CheckSafetyNet.java index 550e81fad..70c9f39d4 100644 --- a/src/main/java/com/topjohnwu/magisk/asyncs/CheckSafetyNet.java +++ b/src/main/java/com/topjohnwu/magisk/asyncs/CheckSafetyNet.java @@ -22,13 +22,13 @@ import dalvik.system.DexClassLoader; public class CheckSafetyNet extends ParallelTask { - private File dexPath; + public static final File dexPath = + new File(MagiskManager.get().getFilesDir().getParent() + "/snet", "snet.apk"); private DexClassLoader loader; private Class helperClazz, callbackClazz; public CheckSafetyNet(Activity activity) { super(activity); - dexPath = new File(activity.getCacheDir().getParent() + "/snet", "snet.apk"); } private void dlSnet() throws IOException { @@ -65,7 +65,7 @@ public class CheckSafetyNet extends ParallelTask { e.printStackTrace(); } - if (snet_ver != Const.Value.SNET_VER) { + if (snet_ver != Const.SNET_VER) { dlSnet(); loadClasses(); } @@ -79,8 +79,6 @@ public class CheckSafetyNet extends ParallelTask { @Override protected void onPostExecute(Exception err) { MagiskManager mm = MagiskManager.get(); - mm.snetVersion = Const.Value.SNET_VER; - mm.prefs.edit().putInt(Const.Key.SNET_VER, Const.Value.SNET_VER).apply(); try { if (err != null) throw err; Object helper = helperClazz.getConstructors()[0].newInstance( diff --git a/src/main/java/com/topjohnwu/magisk/container/Repo.java b/src/main/java/com/topjohnwu/magisk/container/Repo.java index 7a57e75f7..f5119b7e3 100644 --- a/src/main/java/com/topjohnwu/magisk/container/Repo.java +++ b/src/main/java/com/topjohnwu/magisk/container/Repo.java @@ -40,7 +40,7 @@ public class Repo extends BaseModule { if (getVersionCode() < 0) { throw new IllegalRepoException("Repo [" + repoName + "] does not contain versionCode"); } - if (getMinMagiskVersion() < Const.Value.MIN_MODULE_VER) { + if (getMinMagiskVersion() < Const.MIN_MODULE_VER) { throw new IllegalRepoException("Repo [" + repoName + "] is outdated"); } } diff --git a/src/main/java/com/topjohnwu/magisk/database/RepoDatabaseHelper.java b/src/main/java/com/topjohnwu/magisk/database/RepoDatabaseHelper.java index 6566522fb..dd8114c20 100644 --- a/src/main/java/com/topjohnwu/magisk/database/RepoDatabaseHelper.java +++ b/src/main/java/com/topjohnwu/magisk/database/RepoDatabaseHelper.java @@ -28,7 +28,7 @@ public class RepoDatabaseHelper extends SQLiteOpenHelper { // Clear bad repos mDb.delete(TABLE_NAME, "minMagisk