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>
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index ba65f01..e64a1de 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -52,6 +52,7 @@
import android.view.WindowManagerPolicy;
import static android.provider.Settings.System.DIM_SCREEN;
import static android.provider.Settings.System.SCREEN_BRIGHTNESS;
+import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE;
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
import static android.provider.Settings.System.STAY_ON_WHILE_PLUGGED_IN;
@@ -442,7 +443,11 @@
// turn everything on
setPowerState(ALL_BRIGHT);
-
+
+ // set auto brightness mode to user setting
+ boolean brightnessMode = Settings.System.getInt(resolver, SCREEN_BRIGHTNESS_MODE, 1) != 0;
+ mHardware.setAutoBrightness_UNCHECKED(brightnessMode);
+
synchronized (mHandlerThread) {
mInitComplete = true;
mHandlerThread.notifyAll();