Skip to content

Commit bf4e414

Browse files
author
Jeff Brown
committed
Fix a bug with screen brightness during screen off animation.
Due to a recent change there was a regression that caused the screen brightness to be animated down to 0 while the screen off animation was running. When the brightness was low this would cause the screen off animation to be cut short. This change ensures that we take into account the actual screen state instead of the desired screen state when making screen brightness decisions in case we are in the middle of a transition. The darkness came early. The pixel fairies trembled. Bug: 17718416 Change-Id: Ib4b55d61b359abbc70920e324f08a5db07bdd035
1 parent 134b62e commit bf4e414

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

services/core/java/com/android/server/display/DisplayPowerController.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,12 @@ private void updatePowerState() {
563563
state = Display.STATE_OFF;
564564
}
565565

566+
// Animate the screen state change unless already animating.
567+
// The transition may be deferred, so after this point we will use the
568+
// actual state instead of the desired one.
569+
animateScreenStateChange(state, performScreenOffTransition);
570+
state = mPowerState.getScreenState();
571+
566572
// Use zero brightness when screen is off.
567573
if (state == Display.STATE_OFF) {
568574
brightness = PowerManager.BRIGHTNESS_OFF;
@@ -636,13 +642,9 @@ private void updatePowerState() {
636642
mAppliedLowPower = true;
637643
}
638644

639-
// Animate the screen state change unless already animating.
640-
animateScreenStateChange(state, performScreenOffTransition);
641-
642645
// Animate the screen brightness when the screen is on or dozing.
643646
// Skip the animation when the screen is off or suspended.
644-
final int actualState = mPowerState.getScreenState();
645-
if (actualState == Display.STATE_ON || actualState == Display.STATE_DOZE) {
647+
if (state == Display.STATE_ON || state == Display.STATE_DOZE) {
646648
animateScreenBrightness(brightness,
647649
slowChange ? BRIGHTNESS_RAMP_RATE_SLOW : BRIGHTNESS_RAMP_RATE_FAST);
648650
} else {

0 commit comments

Comments
 (0)