DO NOT MERGE Change display state modification during dozing
Check that the BrightnessRamp animation has completed before updating
the display state to STATE_DOZING.
Bug: 13472578
Change-Id: Ib9751f7a987463e4df98571e846d829ec8e73b5e
Signed-off-by: Prashant Malani <pmalani@google.com>
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
index 47406a1..1a36cbf 100644
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
@@ -706,8 +706,14 @@
// Turn the screen on. The contents of the screen may not yet
// be visible if the electron beam has not been dismissed because
// its last frame of animation is solid black.
- setScreenState(mPowerRequest.screenState == DisplayPowerRequest.SCREEN_STATE_DOZE
- ? Display.STATE_DOZING : Display.STATE_ON);
+
+ if (mPowerRequest.screenState == DisplayPowerRequest.SCREEN_STATE_DOZE) {
+ if (!mScreenBrightnessRampAnimator.isAnimating()) {
+ setScreenState(Display.STATE_DOZING);
+ }
+ } else {
+ setScreenState(Display.STATE_ON);
+ }
if (mPowerRequest.blockScreenOn
&& mPowerState.getElectronBeamLevel() == 0.0f) {