summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2009-11-01 08:16:33 -0500
committerMike Lockwood <lockwood@android.com>2009-11-01 08:20:42 -0500
commit4984e73dc5fc3df757e4ac8dd333b88151deb3ea (patch)
tree436b874efd259c1c81bdcebd979f77d26932e184 /services
parentdf024920ebc63a82f570105c7a26e339ff244afd (diff)
downloadframeworks_base-4984e73dc5fc3df757e4ac8dd333b88151deb3ea.zip
frameworks_base-4984e73dc5fc3df757e4ac8dd333b88151deb3ea.tar.gz
frameworks_base-4984e73dc5fc3df757e4ac8dd333b88151deb3ea.tar.bz2
Manage button and keyboard backlights with light sensor in both manual and automatic mode.
Now the manual brightness mode only applies to the LCD backlight and button and keyboard backlights are always managed automatically. Fixes bug b/2195798 (Passion capacitive key backlights don't always come on) This change only affects the framework based auto-brightness implementation. Hardware auto-brightness is not affected. Change-Id: Ib88310d642d498591e8879c8269d630ff3f7c8af Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/PowerManagerService.java29
1 files changed, 15 insertions, 14 deletions
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 455ae46..d90235f 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -487,7 +487,7 @@ class PowerManagerService extends IPowerManager.Stub
// And explicitly do the initial update of our cached settings
updateGservicesValues();
- if (mUseSoftwareAutoBrightness && mAutoBrightessEnabled) {
+ if (mUseSoftwareAutoBrightness) {
// turn the screen on
setPowerState(SCREEN_BRIGHT);
} else {
@@ -589,7 +589,7 @@ class PowerManagerService extends IPowerManager.Stub
switch (wl.flags & LOCK_MASK)
{
case PowerManager.FULL_WAKE_LOCK:
- if (mAutoBrightessEnabled && mUseSoftwareAutoBrightness) {
+ if (mUseSoftwareAutoBrightness) {
wl.minState = SCREEN_BRIGHT;
} else {
wl.minState = (mKeyboardVisible ? ALL_BRIGHT : SCREEN_BUTTON_BRIGHT);
@@ -1300,7 +1300,7 @@ class PowerManagerService extends IPowerManager.Stub
private int setScreenStateLocked(boolean on) {
int err = Power.setScreenState(on);
if (err == 0 && mUseSoftwareAutoBrightness) {
- enableLightSensor(on && mAutoBrightessEnabled);
+ enableLightSensor(on);
if (!on) {
// make sure button and key backlights are off too
mHardware.setLightBrightness_UNCHECKED(HardwareService.LIGHT_ID_BUTTONS, 0);
@@ -1346,7 +1346,7 @@ class PowerManagerService extends IPowerManager.Stub
return;
}
- if (!mDoneBooting && !(mAutoBrightessEnabled && mUseSoftwareAutoBrightness)) {
+ if (!mDoneBooting && !mUseSoftwareAutoBrightness) {
newState |= ALL_BRIGHT;
}
@@ -1858,8 +1858,7 @@ class PowerManagerService extends IPowerManager.Stub
if ((mUserActivityAllowed && !mProximitySensorActive) || force) {
// Only turn on button backlights if a button was pressed
// and auto brightness is disabled
- if (eventType == BUTTON_EVENT &&
- !(mAutoBrightessEnabled && mUseSoftwareAutoBrightness)) {
+ if (eventType == BUTTON_EVENT && !mUseSoftwareAutoBrightness) {
mUserState = (mKeyboardVisible ? ALL_BRIGHT : SCREEN_BUTTON_BRIGHT);
} else {
// don't clear button/keyboard backlights when the screen is touched.
@@ -1937,7 +1936,7 @@ class PowerManagerService extends IPowerManager.Stub
}
boolean startAnimation = false;
- if (mScreenBrightnessOverride < 0) {
+ if (mAutoBrightessEnabled && mScreenBrightnessOverride < 0) {
if (ANIMATE_SCREEN_LIGHTS) {
if (mScreenBrightness.setTargetLocked(lcdValue,
AUTOBRIGHTNESS_ANIM_STEPS, INITIAL_SCREEN_BRIGHTNESS,
@@ -2049,7 +2048,7 @@ class PowerManagerService extends IPowerManager.Stub
// will take care of turning on due to a true change to the lid
// switch and synchronized with the lock screen.
if ((mPowerState & SCREEN_ON_BIT) != 0) {
- if (mAutoBrightessEnabled && mUseSoftwareAutoBrightness) {
+ if (mUseSoftwareAutoBrightness) {
// force recompute of backlight values
if (mLightSensorValue >= 0) {
int value = (int)mLightSensorValue;
@@ -2084,11 +2083,13 @@ class PowerManagerService extends IPowerManager.Stub
if (screenIsOn()) {
setBacklightBrightness((int)mScreenBrightness.curValue);
}
- } else if (mUseSoftwareAutoBrightness) {
- // reset computed brightness
- mLightSensorValue = -1;
- mLightSensorBrightness = -1;
- enableLightSensor(screenIsOn() && enabled);
+ } else if (mUseSoftwareAutoBrightness && screenIsOn()) {
+ // force recompute of backlight values
+ if (mLightSensorValue >= 0) {
+ int value = (int)mLightSensorValue;
+ mLightSensorValue = -1;
+ lightSensorChangedLocked(value);
+ }
}
}
}
@@ -2244,7 +2245,7 @@ class PowerManagerService extends IPowerManager.Stub
// don't bother with the light sensor if auto brightness is handled in hardware
if (mUseSoftwareAutoBrightness) {
mLightSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
- enableLightSensor(mAutoBrightessEnabled);
+ enableLightSensor(true);
}
synchronized (mLocks) {