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

Commit 33538249 authored by Prashant Malani's avatar Prashant Malani
Browse files

Don't animate screen brightness if there is a pending off transition

When the DisplayPowerRequest policy is POLICY_OFF, a screen state
transition animation to DISPLAY_OFF is intiated. However, in
updatePowerState() the screen brightness setting, based on the current
display state, is set to normal brightness and an animation is
triggered. This causes a transient flash on some devices, which are
transitioning from a dimmed screen to screen off.

This change checks for a pending screen off transition before
triggering a screen brightness animation, to prevent the flashes.

Bug: 18136235
Change-Id: I37f9fb28b3ec8a4fdbb45920c40d25ebd50c220b
parent 4cc7bbc9
Loading
Loading
Loading
Loading
+7 −5
Original line number Original line Diff line number Diff line
@@ -654,12 +654,14 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call


        // Animate the screen brightness when the screen is on or dozing.
        // Animate the screen brightness when the screen is on or dozing.
        // Skip the animation when the screen is off or suspended.
        // Skip the animation when the screen is off or suspended.
        if (!mPendingScreenOff) {
            if (state == Display.STATE_ON || state == Display.STATE_DOZE) {
            if (state == Display.STATE_ON || state == Display.STATE_DOZE) {
                animateScreenBrightness(brightness,
                animateScreenBrightness(brightness,
                        slowChange ? BRIGHTNESS_RAMP_RATE_SLOW : BRIGHTNESS_RAMP_RATE_FAST);
                        slowChange ? BRIGHTNESS_RAMP_RATE_SLOW : BRIGHTNESS_RAMP_RATE_FAST);
            } else {
            } else {
                animateScreenBrightness(brightness, 0);
                animateScreenBrightness(brightness, 0);
            }
            }
        }


        // Determine whether the display is ready for use in the newly requested state.
        // Determine whether the display is ready for use in the newly requested state.
        // Note that we do not wait for the brightness ramp animation to complete before
        // Note that we do not wait for the brightness ramp animation to complete before