Mark all settings upgrade transactions as successful along the way
If you don't, then the upgrade gets rolled back by the open helper, and Bad Stuff Happens. Change-Id: I191263e5cceb21b96ef413d28e7ee00a924acfc2
This commit is contained in:
@@ -67,7 +67,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||||||
// database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
|
// database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
|
||||||
// is properly propagated through your change. Not doing so will result in a loss of user
|
// is properly propagated through your change. Not doing so will result in a loss of user
|
||||||
// settings.
|
// settings.
|
||||||
private static final int DATABASE_VERSION = 84;
|
private static final int DATABASE_VERSION = 85;
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private int mUserHandle;
|
private int mUserHandle;
|
||||||
@@ -1241,6 +1241,8 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||||||
loadBooleanSetting(stmt,
|
loadBooleanSetting(stmt,
|
||||||
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE,
|
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE,
|
||||||
R.bool.def_accessibility_display_magnification_auto_update);
|
R.bool.def_accessibility_display_magnification_auto_update);
|
||||||
|
|
||||||
|
db.setTransactionSuccessful();
|
||||||
} finally {
|
} finally {
|
||||||
db.endTransaction();
|
db.endTransaction();
|
||||||
if (stmt != null) stmt.close();
|
if (stmt != null) stmt.close();
|
||||||
@@ -1248,6 +1250,28 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||||||
upgradeVersion = 84;
|
upgradeVersion = 84;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (upgradeVersion == 84) {
|
||||||
|
db.beginTransaction();
|
||||||
|
SQLiteStatement stmt = null;
|
||||||
|
try {
|
||||||
|
// Patch up the slightly-wrong key migration from 82 -> 83
|
||||||
|
String[] settingsToMove = {
|
||||||
|
Settings.Secure.ADB_ENABLED,
|
||||||
|
Settings.Secure.BLUETOOTH_ON,
|
||||||
|
Settings.Secure.DATA_ROAMING,
|
||||||
|
Settings.Secure.DEVICE_PROVISIONED,
|
||||||
|
Settings.Secure.INSTALL_NON_MARKET_APPS,
|
||||||
|
Settings.Secure.USB_MASS_STORAGE_ENABLED
|
||||||
|
};
|
||||||
|
moveSettingsToNewTable(db, TABLE_SECURE, TABLE_GLOBAL, settingsToMove);
|
||||||
|
db.setTransactionSuccessful();
|
||||||
|
} finally {
|
||||||
|
db.endTransaction();
|
||||||
|
if (stmt != null) stmt.close();
|
||||||
|
}
|
||||||
|
upgradeVersion = 85;
|
||||||
|
}
|
||||||
|
|
||||||
// *** Remember to update DATABASE_VERSION above!
|
// *** Remember to update DATABASE_VERSION above!
|
||||||
|
|
||||||
if (upgradeVersion != currentVersion) {
|
if (upgradeVersion != currentVersion) {
|
||||||
|
|||||||
Reference in New Issue
Block a user