mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-28 21:37:39 +00:00
Prevent outdated modules to be shown
This commit is contained in:
parent
684c5d225a
commit
ce2e6b7d35
@ -106,9 +106,9 @@ public class MagiskManager extends Shell.ContainerApp {
|
||||
@Override
|
||||
public void onRootShellInit(@NonNull Shell shell) {
|
||||
try (InputStream utils = getAssets().open(Const.UTIL_FUNCTIONS);
|
||||
InputStream sudb = getResources().openRawResource(R.raw.magiskdb)) {
|
||||
InputStream magiskDB = getResources().openRawResource(R.raw.magiskdb)) {
|
||||
shell.loadInputStream(null, null, utils);
|
||||
shell.loadInputStream(null, null, sudb);
|
||||
shell.loadInputStream(null, null, magiskDB);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -140,7 +140,6 @@ public class MagiskManager extends Shell.ContainerApp {
|
||||
mDB = MagiskDatabaseHelper.getInstance(this);
|
||||
}
|
||||
|
||||
repoDB = new RepoDatabaseHelper(this);
|
||||
defaultLocale = Locale.getDefault();
|
||||
setLocale();
|
||||
loadConfig();
|
||||
|
@ -11,6 +11,7 @@ import com.topjohnwu.magisk.asyncs.LoadModules;
|
||||
import com.topjohnwu.magisk.asyncs.ParallelTask;
|
||||
import com.topjohnwu.magisk.asyncs.UpdateRepos;
|
||||
import com.topjohnwu.magisk.components.Activity;
|
||||
import com.topjohnwu.magisk.database.RepoDatabaseHelper;
|
||||
import com.topjohnwu.magisk.receivers.ShortcutReceiver;
|
||||
import com.topjohnwu.magisk.utils.Const;
|
||||
import com.topjohnwu.magisk.utils.Utils;
|
||||
@ -24,6 +25,7 @@ public class SplashActivity extends Activity {
|
||||
|
||||
MagiskManager mm = getMagiskManager();
|
||||
|
||||
mm.repoDB = new RepoDatabaseHelper(this);
|
||||
mm.loadMagiskInfo();
|
||||
mm.getDefaultInstallFlags();
|
||||
Utils.loadPrefs();
|
||||
|
@ -42,7 +42,7 @@ public class Repo extends BaseModule {
|
||||
if (getVersionCode() < 0) {
|
||||
throw new IllegalRepoException("Repo [" + repoName + "] does not contain versionCode");
|
||||
}
|
||||
if (getMinMagiskVersion() < Const.MIN_MODULE_VER) {
|
||||
if (getMinMagiskVersion() < Const.MIN_MODULE_VER()) {
|
||||
throw new IllegalRepoException("Repo [" + repoName + "] is outdated");
|
||||
}
|
||||
}
|
||||
|
@ -26,9 +26,9 @@ public class RepoDatabaseHelper extends SQLiteOpenHelper {
|
||||
mm = Utils.getMagiskManager(context);
|
||||
mDb = getWritableDatabase();
|
||||
|
||||
// Clear bad repos
|
||||
// Remove outdated repos
|
||||
mDb.delete(TABLE_NAME, "minMagisk<?",
|
||||
new String[] { String.valueOf(Const.MIN_MODULE_VER) });
|
||||
new String[] { String.valueOf(Const.MIN_MODULE_VER()) });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,7 +36,10 @@ public class Const {
|
||||
// Versions
|
||||
public static final int UPDATE_SERVICE_VER = 1;
|
||||
public static final int SNET_VER = 7;
|
||||
public static final int MIN_MODULE_VER = 1400;
|
||||
|
||||
public static int MIN_MODULE_VER() {
|
||||
return MagiskManager.get().magiskVersionCode >= 1630 ? 1500 : 1400;
|
||||
}
|
||||
|
||||
public synchronized static SuFile MAGISK_PATH() {
|
||||
SuFile file;
|
||||
|
Loading…
x
Reference in New Issue
Block a user