summaryrefslogtreecommitdiffstats
path: root/packages/SettingsProvider/src
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2011-01-07 11:32:30 -0800
committerAmith Yamasani <yamasani@google.com>2011-01-07 11:32:30 -0800
commitf50c5113d0a426ba0a689b5a827f80bf9d2467e1 (patch)
treede1f1244d9a0b6772547e37451d0088535988f35 /packages/SettingsProvider/src
parent808751fe7ac16bf7224cba284a318695d8093355 (diff)
downloadframeworks_base-f50c5113d0a426ba0a689b5a827f80bf9d2467e1.zip
frameworks_base-f50c5113d0a426ba0a689b5a827f80bf9d2467e1.tar.gz
frameworks_base-f50c5113d0a426ba0a689b5a827f80bf9d2467e1.tar.bz2
Update default for auto-brightness.
Bug: 3297046 Change-Id: I92e34a85332988bb3faa1e1997ccc85abf4b5dec
Diffstat (limited to 'packages/SettingsProvider/src')
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java35
1 files changed, 22 insertions, 13 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index d11a18e..bc7473e 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -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 = 62;
+ private static final int DATABASE_VERSION = 63;
private Context mContext;
@@ -441,18 +441,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
}
if (upgradeVersion == 39) {
- db.beginTransaction();
- try {
- String value =
- mContext.getResources().getBoolean(
- R.bool.def_screen_brightness_automatic_mode) ? "1" : "0";
- db.execSQL("INSERT OR IGNORE INTO system(name,value) values('" +
- Settings.System.SCREEN_BRIGHTNESS_MODE + "','" + value + "');");
- db.setTransactionSuccessful();
- } finally {
- db.endTransaction();
- }
-
+ upgradeAutoBrightness(db);
upgradeVersion = 40;
}
@@ -802,6 +791,12 @@ public class DatabaseHelper extends SQLiteOpenHelper {
upgradeVersion = 62;
}
+ // Change the default for screen auto-brightness mode
+ if (upgradeVersion == 62) {
+ upgradeAutoBrightness(db);
+ upgradeVersion = 63;
+ }
+
// *** Remember to update DATABASE_VERSION above!
if (upgradeVersion != currentVersion) {
@@ -924,6 +919,20 @@ public class DatabaseHelper extends SQLiteOpenHelper {
}
}
+ private void upgradeAutoBrightness(SQLiteDatabase db) {
+ db.beginTransaction();
+ try {
+ String value =
+ mContext.getResources().getBoolean(
+ R.bool.def_screen_brightness_automatic_mode) ? "1" : "0";
+ db.execSQL("INSERT OR REPLACE INTO system(name,value) values('" +
+ Settings.System.SCREEN_BRIGHTNESS_MODE + "','" + value + "');");
+ db.setTransactionSuccessful();
+ } finally {
+ db.endTransaction();
+ }
+ }
+
/**
* Loads the default set of bookmarked shortcuts from an xml file.
*