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

Commit 18651804 authored by Jim Miller's avatar Jim Miller
Browse files

Fix 6119433: disambiguate screen brightness changes from other lights

This fixes a bug where the code asked to change the keyboard brightness
on a device that doesn't support it.  Instead of animating the keyboard
brightness, it ended up animating the display brightness and invoking
the power off animation as a result.  The fix is to ignore keyboard
brightness because we don't have any devices that currently support it.

Change-Id: I672d89f92f991812ea676f19c40058b2d3008656
parent 4b972579
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -2234,15 +2234,19 @@ public class PowerManagerService extends IPowerManager.Stub
                }
                }


                if (target != currentValue) {
                if (target != currentValue) {
                    final boolean doScreenAnim = (mask & (SCREEN_BRIGHT_BIT | SCREEN_ON_BIT)) != 0;
                    final boolean turningOff = endValue == Power.BRIGHTNESS_OFF;
                    final boolean turningOff = endValue == Power.BRIGHTNESS_OFF;
                    if (turningOff && ((mask & (SCREEN_ON_BIT | SCREEN_BRIGHT_BIT)) != 0)) {
                    if (turningOff && doScreenAnim) {
                        // Cancel all pending animations since we're turning off
                        // Cancel all pending animations since we're turning off
                        mScreenBrightnessHandler.removeCallbacksAndMessages(null);
                        mScreenBrightnessHandler.removeCallbacksAndMessages(null);
                        screenOffFinishedAnimatingLocked(mScreenOffReason);
                        screenOffFinishedAnimatingLocked(mScreenOffReason);
                        duration = 200; // TODO: how long should this be?
                        duration = 200; // TODO: how long should this be?
                    }
                    }
                    if (doScreenAnim) {
                        animateInternal(mask, turningOff, 0);
                        animateInternal(mask, turningOff, 0);
                    }
                    }
                    // TODO: Handle keyboard light animation when we have devices that support it
                }
            }
            }
        }
        }