Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d29568cf authored by Craig Mautner's avatar Craig Mautner
Browse files

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
parent bde32efa
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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) {