diff options
author | Michael Bestas <mikeioannina@cyanogenmod.org> | 2016-05-08 01:14:37 +0300 |
---|---|---|
committer | Michael Bestas <mikeioannina@cyanogenmod.org> | 2016-05-08 01:15:29 +0300 |
commit | 4a0ad7cfbb2851695b66f2075273a27202832d6b (patch) | |
tree | 9b0aa55817fb14ddfe94357a0912b044a162d78b | |
parent | b77b8b5a70b4a3d770dc2cee4ab78b49c82f5a28 (diff) | |
download | vendor_cmsdk-4a0ad7cfbb2851695b66f2075273a27202832d6b.zip vendor_cmsdk-4a0ad7cfbb2851695b66f2075273a27202832d6b.tar.gz vendor_cmsdk-4a0ad7cfbb2851695b66f2075273a27202832d6b.tar.bz2 |
CMSettings: Fix upgrade from cm-12.1 after weather changes
* Only the owner can write to the global db
Change-Id: Iec7736c28ff0bc7a35dae8bbc85ca2b1c137da49
-rw-r--r-- | packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMDatabaseHelper.java | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMDatabaseHelper.java b/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMDatabaseHelper.java index faf99d3..5a1e50d 100644 --- a/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMDatabaseHelper.java +++ b/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMDatabaseHelper.java @@ -202,17 +202,19 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{ } if (upgradeVersion < 5) { - db.beginTransaction(); - SQLiteStatement stmt = null; - try { - stmt = db.compileStatement("INSERT INTO global(name,value)" - + " VALUES(?,?);"); - loadIntegerSetting(stmt, CMSettings.Global.WEATHER_TEMPERATURE_UNIT, - R.integer.def_temperature_unit); - db.setTransactionSuccessful(); - } finally { - if (stmt != null) stmt.close(); - db.endTransaction(); + if (mUserHandle == UserHandle.USER_OWNER) { + db.beginTransaction(); + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT INTO global(name,value)" + + " VALUES(?,?);"); + loadIntegerSetting(stmt, CMSettings.Global.WEATHER_TEMPERATURE_UNIT, + R.integer.def_temperature_unit); + db.setTransactionSuccessful(); + } finally { + if (stmt != null) stmt.close(); + db.endTransaction(); + } } upgradeVersion = 5; } |