Merge "Add VIBRATE_IN_SILENT to the settings database & backup."
This commit is contained in:
committed by
Android (Google) Code Review
commit
8957da23aa
@@ -1708,6 +1708,7 @@ public final class Settings {
|
||||
VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE,
|
||||
VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE,
|
||||
VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE,
|
||||
VIBRATE_IN_SILENT,
|
||||
TEXT_AUTO_REPLACE,
|
||||
TEXT_AUTO_CAPS,
|
||||
TEXT_AUTO_PUNCTUATE,
|
||||
|
||||
@@ -70,4 +70,7 @@
|
||||
<string name="def_lock_sound" translatable="false">/system/media/audio/ui/Lock.ogg</string>
|
||||
<string name="def_unlock_sound" translatable="false">/system/media/audio/ui/Unlock.ogg</string>
|
||||
|
||||
<!-- Default for Settings.System.VIBRATE_IN_SILENT -->
|
||||
<bool name="def_vibrate_in_silent">true</bool>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -61,7 +61,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 = 52;
|
||||
private static final int DATABASE_VERSION = 53;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
@@ -634,7 +634,26 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
upgradeVersion = 52;
|
||||
}
|
||||
|
||||
if (upgradeVersion != currentVersion) {
|
||||
if (upgradeVersion == 52) {
|
||||
// new vibration/silent mode settings
|
||||
db.beginTransaction();
|
||||
try {
|
||||
SQLiteStatement stmt = db.compileStatement("INSERT INTO system(name,value)"
|
||||
+ " VALUES(?,?);");
|
||||
loadBooleanSetting(stmt, Settings.System.VIBRATE_IN_SILENT,
|
||||
R.bool.def_vibrate_in_silent);
|
||||
stmt.close();
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
|
||||
upgradeVersion = 53;
|
||||
}
|
||||
|
||||
// *** Remember to update DATABASE_VERSION above!
|
||||
|
||||
if (upgradeVersion != currentVersion) {
|
||||
Log.w(TAG, "Got stuck trying to upgrade from version " + upgradeVersion
|
||||
+ ", must wipe the settings provider");
|
||||
db.execSQL("DROP TABLE IF EXISTS system");
|
||||
@@ -930,6 +949,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
|
||||
loadUISoundEffectsSettings(stmt);
|
||||
|
||||
loadBooleanSetting(stmt, Settings.System.VIBRATE_IN_SILENT,
|
||||
R.bool.def_vibrate_in_silent);
|
||||
|
||||
stmt.close();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user