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 /services/jni | |
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 'services/jni')
-rw-r--r-- | services/jni/com_android_server_HardwareService.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/services/jni/com_android_server_HardwareService.cpp b/services/jni/com_android_server_HardwareService.cpp index 22d4bd8..a17e29f 100644 --- a/services/jni/com_android_server_HardwareService.cpp +++ b/services/jni/com_android_server_HardwareService.cpp @@ -100,6 +100,18 @@ static void finalize_native(JNIEnv *env, jobject clazz, int ptr) free(devices); } +static void setAutoBrightness_native(JNIEnv *env, jobject clazz, int ptr, + jboolean automatic) +{ + Devices* devices = (Devices*)ptr; + + if (devices->lights[LIGHT_INDEX_BACKLIGHT] == NULL) { + return; + } + + devices->lights[LIGHT_INDEX_BACKLIGHT]->set_als_mode(automatic ? 0 : 1); +} + static void setLight_native(JNIEnv *env, jobject clazz, int ptr, int light, int colorARGB, int flashMode, int onMS, int offMS) { @@ -134,6 +146,7 @@ static void vibratorOff(JNIEnv *env, jobject clazz) static JNINativeMethod method_table[] = { { "init_native", "()I", (void*)init_native }, { "finalize_native", "(I)V", (void*)finalize_native }, + { "setAutoBrightness_native", "(IZ)V", (void*)setAutoBrightness_native }, { "setLight_native", "(IIIIII)V", (void*)setLight_native }, { "vibratorOn", "(J)V", (void*)vibratorOn }, { "vibratorOff", "()V", (void*)vibratorOff } |