CMSettings: Fix upgrade from cm-12.1 after weather changes
* Only the owner can write to the global db Change-Id: Iec7736c28ff0bc7a35dae8bbc85ca2b1c137da49
This commit is contained in:
parent
b77b8b5a70
commit
4a0ad7cfbb
|
@ -202,17 +202,19 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upgradeVersion < 5) {
|
if (upgradeVersion < 5) {
|
||||||
db.beginTransaction();
|
if (mUserHandle == UserHandle.USER_OWNER) {
|
||||||
SQLiteStatement stmt = null;
|
db.beginTransaction();
|
||||||
try {
|
SQLiteStatement stmt = null;
|
||||||
stmt = db.compileStatement("INSERT INTO global(name,value)"
|
try {
|
||||||
+ " VALUES(?,?);");
|
stmt = db.compileStatement("INSERT INTO global(name,value)"
|
||||||
loadIntegerSetting(stmt, CMSettings.Global.WEATHER_TEMPERATURE_UNIT,
|
+ " VALUES(?,?);");
|
||||||
R.integer.def_temperature_unit);
|
loadIntegerSetting(stmt, CMSettings.Global.WEATHER_TEMPERATURE_UNIT,
|
||||||
db.setTransactionSuccessful();
|
R.integer.def_temperature_unit);
|
||||||
} finally {
|
db.setTransactionSuccessful();
|
||||||
if (stmt != null) stmt.close();
|
} finally {
|
||||||
db.endTransaction();
|
if (stmt != null) stmt.close();
|
||||||
|
db.endTransaction();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
upgradeVersion = 5;
|
upgradeVersion = 5;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue