diff options
author | Amith Yamasani <yamasani@google.com> | 2011-11-16 11:19:48 -0800 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2011-11-16 18:09:15 -0800 |
commit | 5cd1500cc4229fa6a8ddb5c70b055bb2c936c650 (patch) | |
tree | a31c92ef92f59b087e521486f9ee9340a51a3a02 /packages/SettingsProvider | |
parent | 7dc81e06e4d0554683595e8d2e318837548e249a (diff) | |
download | frameworks_base-5cd1500cc4229fa6a8ddb5c70b055bb2c936c650.zip frameworks_base-5cd1500cc4229fa6a8ddb5c70b055bb2c936c650.tar.gz frameworks_base-5cd1500cc4229fa6a8ddb5c70b055bb2c936c650.tar.bz2 |
Don't upgrade some settings from GB to ICS.
Copy the value of AUTO_TIME to AUTO_TIME_ZONE.
Don't upgrade screen timeout and auto brightness.
Bug: 5607851, 5217460
Also fix the default for vibrate mode. Bug: 5553900
Change-Id: I1b8d5215d55953f2b686e77bf55fd07110a08b8d
Diffstat (limited to 'packages/SettingsProvider')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index 5495d08..aa08e64 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -723,6 +723,8 @@ public class DatabaseHelper extends SQLiteOpenHelper { upgradeVersion = 57; } + /************* The following are Honeycomb changes ************/ + if (upgradeVersion == 57) { /* * New settings to: @@ -751,13 +753,13 @@ public class DatabaseHelper extends SQLiteOpenHelper { if (upgradeVersion == 58) { /* Add default for new Auto Time Zone */ + int autoTimeValue = getIntValueFromSystem(db, Settings.System.AUTO_TIME, 0); db.beginTransaction(); SQLiteStatement stmt = null; try { - stmt = db.compileStatement("INSERT INTO secure(name,value)" - + " VALUES(?,?);"); - loadBooleanSetting(stmt, Settings.System.AUTO_TIME_ZONE, - R.bool.def_auto_time_zone); // Sync timezone to NITZ + stmt = db.compileStatement("INSERT INTO system(name,value)" + " VALUES(?,?);"); + loadSetting(stmt, Settings.System.AUTO_TIME_ZONE, + autoTimeValue); // Sync timezone to NITZ if auto_time was enabled db.setTransactionSuccessful(); } finally { db.endTransaction(); @@ -784,18 +786,24 @@ public class DatabaseHelper extends SQLiteOpenHelper { } if (upgradeVersion == 60) { - upgradeScreenTimeout(db); + // Don't do this for upgrades from Gingerbread + // Were only required for intra-Honeycomb upgrades for testing + // upgradeScreenTimeout(db); upgradeVersion = 61; } if (upgradeVersion == 61) { - upgradeScreenTimeout(db); + // Don't do this for upgrades from Gingerbread + // Were only required for intra-Honeycomb upgrades for testing + // upgradeScreenTimeout(db); upgradeVersion = 62; } // Change the default for screen auto-brightness mode if (upgradeVersion == 62) { - upgradeAutoBrightness(db); + // Don't do this for upgrades from Gingerbread + // Were only required for intra-Honeycomb upgrades for testing + // upgradeAutoBrightness(db); upgradeVersion = 63; } @@ -839,6 +847,8 @@ public class DatabaseHelper extends SQLiteOpenHelper { upgradeVersion = 65; } + /************* The following are Ice Cream Sandwich changes ************/ + if (upgradeVersion == 65) { /* * Animations are removed from Settings. Turned on by default @@ -1232,12 +1242,13 @@ public class DatabaseHelper extends SQLiteOpenHelper { stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" + " VALUES(?,?);"); - // Vibrate off by default for ringer, on for notification + // Vibrate on by default for ringer, on for notification int vibrate = 0; vibrate = AudioService.getValueForVibrateSetting(vibrate, - AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_ON); + AudioManager.VIBRATE_TYPE_NOTIFICATION, + AudioManager.VIBRATE_SETTING_ONLY_SILENT); vibrate |= AudioService.getValueForVibrateSetting(vibrate, - AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF); + AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ONLY_SILENT); loadSetting(stmt, Settings.System.VIBRATE_ON, vibrate); } finally { if (stmt != null) stmt.close(); @@ -1509,4 +1520,20 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadSetting(stmt, key, Float.toString(mContext.getResources().getFraction(resid, base, base))); } + + private int getIntValueFromSystem(SQLiteDatabase db, String name, int defaultValue) { + int value = defaultValue; + Cursor c = null; + try { + c = db.query("system", new String[] { Settings.System.VALUE }, "name='" + name + "'", + null, null, null, null); + if (c != null && c.moveToFirst()) { + String val = c.getString(0); + value = val == null ? defaultValue : Integer.parseInt(val); + } + } finally { + if (c != null) c.close(); + } + return value; + } } |