diff options
author | Dan Murphy <D.Murphy@motorola.com> | 2009-08-27 14:59:03 -0500 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2009-09-15 02:29:15 -0400 |
commit | 951764b97010dfa073126f52b43ea1bdf1b35998 (patch) | |
tree | a4385faacb89cb30250d2a8ce0da611d1eefddc2 /packages | |
parent | 151921a62485f2141ad1316076c196ef00e1b421 (diff) | |
download | frameworks_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')
-rw-r--r-- | packages/SettingsProvider/res/values/defaults.xml | 1 | ||||
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 21 |
2 files changed, 21 insertions, 1 deletions
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index 6b20445..d5f1c61 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -27,6 +27,7 @@ <bool name="def_accelerometer_rotation">true</bool> <!-- Default screen brightness, from 0 to 255. 102 is 40%. --> <integer name="def_screen_brightness">102</integer> + <bool name="def_screen_brightness_automatic_mode">false</bool> <fraction name="def_window_animation_scale">100%</fraction> <fraction name="def_window_transition_scale">0%</fraction> 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, |