Fix power manager issues.

1. If a new brightness animation is started while an unrelated one is
ongoing complete the old animation immediately. Unrelated means that
the old and new animations apply to different devices (button,
keyboard, or screen).

2. Do not interpret turning off the keyboard or button lights as
turning off the screen in isScreenTurningOffLocked().

Fixes bug 6519847.

Change-Id: I53a20951036bcdb793daeff84a9ebeed44be01fc
This commit is contained in:
Craig Mautner
2012-06-01 16:02:47 -07:00
parent bde32efa20
commit d29568cf5f

View File

@ -2283,6 +2283,10 @@ public class PowerManagerService extends IPowerManager.Stub
public void animateTo(int target, int sensorTarget, int mask, int animationDuration) {
synchronized(this) {
if (isAnimating() && (mask ^ currentMask) != 0) {
// current animation is unrelated to new animation, jump to final values
cancelAnimation();
}
startValue = currentValue;
endValue = target;
startSensorValue = mHighestLightSensorValue;
@ -2407,7 +2411,8 @@ public class PowerManagerService extends IPowerManager.Stub
private boolean isScreenTurningOffLocked() {
return (mScreenBrightnessAnimator.isAnimating()
&& mScreenBrightnessAnimator.endValue == PowerManager.BRIGHTNESS_OFF);
&& mScreenBrightnessAnimator.endValue == PowerManager.BRIGHTNESS_OFF
&& (mScreenBrightnessAnimator.currentMask & SCREEN_BRIGHT_BIT) != 0);
}
private boolean shouldLog(long time) {