diff options
author | Steve Kondik <shade@chemlab.org> | 2012-06-24 00:48:08 +0400 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.cyanogenmod.com> | 2012-06-24 00:48:08 +0400 |
commit | 740a737b8e9d64a6749c3786ad741be12453bdcf (patch) | |
tree | 0e603930b08ec81103cad5759cf751e09409211b | |
parent | 929787f76a98370338de1f41ca85809430bc77f1 (diff) | |
parent | 5ee3f9b91011c6713f7c4ae3e0076bd5923d4d7a (diff) | |
download | frameworks_base-740a737b8e9d64a6749c3786ad741be12453bdcf.zip frameworks_base-740a737b8e9d64a6749c3786ad741be12453bdcf.tar.gz frameworks_base-740a737b8e9d64a6749c3786ad741be12453bdcf.tar.bz2 |
Merge "Fixes to ensure keyboard backlight is lit when the keyboard is visible." into ics
-rw-r--r-- | services/java/com/android/server/PowerManagerService.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index 335af64..0878136 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -1825,7 +1825,7 @@ public class PowerManagerService extends IPowerManager.Stub } if (!mBootCompleted && !mAutoBrightnessButtonKeyboard) { - newState |= ALL_BRIGHT; + newState |= (mKeyboardVisible ? ALL_BRIGHT : SCREEN_BUTTON_BRIGHT); } boolean oldScreenOn = (mPowerState & SCREEN_ON_BIT) != 0; @@ -2422,7 +2422,11 @@ public class PowerManagerService extends IPowerManager.Stub // do not override brightness if the battery is low return state; } - if (!mKeyboardVisible) { + // Ignore mKeyboardVisible if KEYBOARD_BRIGHT_BIT is explicitly set, which + // it will only if the keyboard is visible at the time mPowerState is set. + // Otherwise, if mKeyboardVisible changes afterwards, it's possible for + // the backlight to mismatch mPowerState and remain off. + if (!mKeyboardVisible && (state & KEYBOARD_BRIGHT_BIT) == 0) { brightness = 0; } else if (mButtonBrightnessOverride >= 0) { brightness = mButtonBrightnessOverride; @@ -2817,14 +2821,10 @@ public class PowerManagerService extends IPowerManager.Stub int buttonValue = getAutoBrightnessValue(value, mLastButtonValue, (mCustomLightEnabled ? mCustomLightLevels : mAutoBrightnessLevels), (mCustomLightEnabled ? mCustomButtonValues : mButtonBacklightValues)); - int keyboardValue; - if (mKeyboardVisible) { - keyboardValue = getAutoBrightnessValue(value, mLastKeyboardValue, + int keyboardValue = getAutoBrightnessValue(value, mLastKeyboardValue, (mCustomLightEnabled ? mCustomLightLevels : mAutoBrightnessLevels), (mCustomLightEnabled ? mCustomKeyboardValues : mKeyboardBacklightValues)); - } else { - keyboardValue = 0; - } + mLightSensorScreenBrightness = lcdValue; mLightSensorButtonBrightness = buttonValue; mLightSensorKeyboardBrightness = keyboardValue; @@ -3327,7 +3327,7 @@ public class PowerManagerService extends IPowerManager.Stub setPowerState(SCREEN_BRIGHT); } else { // turn everything on - setPowerState(ALL_BRIGHT); + setPowerState(mKeyboardVisible ? ALL_BRIGHT : SCREEN_BUTTON_BRIGHT); } synchronized (mLocks) { |