summaryrefslogtreecommitdiffstats
path: root/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
diff options
context:
space:
mode:
authorDan Murphy <D.Murphy@motorola.com>2009-08-27 14:59:03 -0500
committerMike Lockwood <lockwood@android.com>2009-09-15 02:29:15 -0400
commit951764b97010dfa073126f52b43ea1bdf1b35998 (patch)
treea4385faacb89cb30250d2a8ce0da611d1eefddc2 /packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
parent151921a62485f2141ad1316076c196ef00e1b421 (diff)
downloadframeworks_base-951764b97010dfa073126f52b43ea1bdf1b35998.zip
frameworks_base-951764b97010dfa073126f52b43ea1bdf1b35998.tar.gz
frameworks_base-951764b97010dfa073126f52b43ea1bdf1b35998.tar.bz2
Add automatic lighting control framework
Add changes to have the ability to turn on and off the automatic light sensing for the device. This is fully configurable and is by default not present. Vendors should override the ALS setting to enable the automatic lighting controls. These changes will add a check box to the Brightness settings menu to give control to the user to allow the device's display lighting to be controlled via the slide bar or the auto lighting system. If the user selects auto then the slide bar will become invisible. Manual mode will present the slide bar to the user. Change-Id: I146a6d75b99b08c9b839218ce6b85adf21f9fd73 Signed-off-by: Dan Murphy <D.Murphy@motorola.com> Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java')
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index 2524a30..f99eb58 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -71,7 +71,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 = 39;
+ private static final int DATABASE_VERSION = 40;
private Context mContext;
@@ -465,6 +465,22 @@ public class DatabaseHelper extends SQLiteOpenHelper {
upgradeVersion = 39;
}
+ 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();
+ }
+
+ upgradeVersion = 40;
+ }
+
if (upgradeVersion != currentVersion) {
Log.w(TAG, "Got stuck trying to upgrade from version " + upgradeVersion
+ ", must wipe the settings provider");
@@ -701,6 +717,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {
loadIntegerSetting(stmt, Settings.System.SCREEN_BRIGHTNESS,
R.integer.def_screen_brightness);
+ loadBooleanSetting(stmt, Settings.System.SCREEN_BRIGHTNESS_MODE,
+ R.bool.def_screen_brightness_automatic_mode);
+
loadDefaultAnimationSettings(stmt);
loadBooleanSetting(stmt, Settings.System.ACCELEROMETER_ROTATION,