mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 23:27:38 +00:00
Prevent upgrading database before upgrading to v17.0
This commit is contained in:
parent
298d5e197b
commit
ff3dad2457
@ -57,6 +57,7 @@ public class Const {
|
||||
public static final int REMOVE_LEGACY_LINK = 1630;
|
||||
public static final int SEPOL_REFACTOR = 1640;
|
||||
public static final int FIX_ENV = 1650;
|
||||
public static final int DBVER_SIX = 17000;
|
||||
}
|
||||
|
||||
public static class ID {
|
||||
|
@ -32,6 +32,7 @@ import java.util.List;
|
||||
public class MagiskDatabaseHelper {
|
||||
|
||||
private static final int DATABASE_VER = 6;
|
||||
private static final int OLD_DATABASE_VER = 5;
|
||||
private static final String POLICY_TABLE = "policies";
|
||||
private static final String LOG_TABLE = "logs";
|
||||
private static final String SETTINGS_TABLE = "settings";
|
||||
@ -57,13 +58,15 @@ public class MagiskDatabaseHelper {
|
||||
pm = mm.getPackageManager();
|
||||
db = openDatabase(mm);
|
||||
db.disableWriteAheadLogging();
|
||||
int version = db.getVersion();
|
||||
if (version < DATABASE_VER) {
|
||||
onUpgrade(db, version);
|
||||
} else if (version > DATABASE_VER) {
|
||||
int version = Data.magiskVersionCode >= Const.MAGISK_VER.DBVER_SIX ? DATABASE_VER : OLD_DATABASE_VER;
|
||||
int curVersion = db.getVersion();
|
||||
if (curVersion < version) {
|
||||
onUpgrade(db, curVersion);
|
||||
} else if (curVersion > DATABASE_VER) {
|
||||
/* Higher than we can possibly support */
|
||||
onDowngrade(db);
|
||||
}
|
||||
db.setVersion(DATABASE_VER);
|
||||
db.setVersion(version);
|
||||
clearOutdated();
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
### 5.9.1
|
||||
- Prevent upgrading database before upgrading to v17.0
|
||||
|
||||
### v5.9.0
|
||||
- No more on boot notifications
|
||||
- Support new mechanism for installing to inactive slot for OTAs on A/B devices
|
||||
|
Loading…
x
Reference in New Issue
Block a user