diff options
author | Amith Yamasani <yamasani@google.com> | 2011-12-13 10:38:47 -0800 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2011-12-13 10:38:47 -0800 |
commit | 398c83cc07354ca28c7108b712017146dadd41a0 (patch) | |
tree | 7763c5fdf8a18cd8bc0bae77db44205f086d96ab /packages/SettingsProvider | |
parent | 63b068040f5b8f561ae9d0b9b24bb405156d7029 (diff) | |
download | frameworks_base-398c83cc07354ca28c7108b712017146dadd41a0.zip frameworks_base-398c83cc07354ca28c7108b712017146dadd41a0.tar.gz frameworks_base-398c83cc07354ca28c7108b712017146dadd41a0.tar.bz2 |
Manual merge: Update VIBRATE_ON to a supported value when upgrading from GB.
Bug: 5738552
If value has ringer set to VIBRATE_OFF, we need to update it to the
now default, as VIBRATE_OFF is inconsistent with the new UI controls.
Make sure notification vibrate setting follows ringer vibrate setting.
Change-Id: I0f15a3d1ea8502d542e3178f732cc2503104458f
Diffstat (limited to 'packages/SettingsProvider')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index a6a3303..5a927c6 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -63,7 +63,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { // 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 // settings. - private static final int DATABASE_VERSION = 74; + private static final int DATABASE_VERSION = 75; private Context mContext; @@ -987,6 +987,11 @@ public class DatabaseHelper extends SQLiteOpenHelper { } if (upgradeVersion == 73) { + upgradeVibrateSettingFromNone(db); + upgradeVersion = 74; + } + + if (upgradeVersion == 74) { // URL from which WebView loads a JavaScript based screen-reader. db.beginTransaction(); SQLiteStatement stmt = null; @@ -999,7 +1004,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { db.endTransaction(); if (stmt != null) stmt.close(); } - upgradeVersion = 74; + upgradeVersion = 75; } // *** Remember to update DATABASE_VERSION above! @@ -1107,6 +1112,28 @@ public class DatabaseHelper extends SQLiteOpenHelper { } } + private void upgradeVibrateSettingFromNone(SQLiteDatabase db) { + int vibrateSetting = getIntValueFromSystem(db, Settings.System.VIBRATE_ON, 0); + // If the ringer vibrate value is invalid, set it to the default + if ((vibrateSetting & 3) == AudioManager.VIBRATE_SETTING_OFF) { + vibrateSetting = AudioService.getValueForVibrateSetting(0, + AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ONLY_SILENT); + } + // Apply the same setting to the notification vibrate value + vibrateSetting = AudioService.getValueForVibrateSetting(vibrateSetting, + AudioManager.VIBRATE_TYPE_NOTIFICATION, vibrateSetting); + + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT OR REPLACE INTO system(name,value)" + + " VALUES(?,?);"); + loadSetting(stmt, Settings.System.VIBRATE_ON, vibrateSetting); + } finally { + if (stmt != null) + stmt.close(); + } + } + private void upgradeScreenTimeout(SQLiteDatabase db) { // Change screen timeout to current default db.beginTransaction(); |