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

Commit dda2a05b authored by Christopher R. Palmer's avatar Christopher R. Palmer
Browse files

base: Fix screen on stats after a boot

Prior to this change, the following sequence:

  * Turn the display off
  * Issue a reboot via adb
  * Unlock the device (after rebooting) before the screen turns off

results in the screen being on but the battery stats not reflecting
this fact.

In general, the mismatch occurs when either there is no serialized
battery stats state or when it is serialized in a state where the
screen is off.

Change-Id: I17374553fae6a08a1be8fdf445967509474177a9
parent aa361334
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -642,6 +642,12 @@ final class DisplayPowerController {

        mScreenBrightnessRampAnimator = new RampAnimator<DisplayPowerState>(
                mPowerState, DisplayPowerState.SCREEN_BRIGHTNESS);

        if (mPowerState.isScreenOn()) {
            // If the screen is on then let the notifier know to ensure that
            // battery stats after a boot are correct.
            mNotifier.onScreenOn();
        }
    }

    private final Animator.AnimatorListener mAnimatorListener = new Animator.AnimatorListener() {