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