summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Santos Cordon <santoscordon@google.com> 2019-08-23 20:09:37 -0700
committer android-build-merger <android-build-merger@google.com> 2019-08-23 20:09:37 -0700
commit23cdf1a48cf46d0b548e8d9a29131c39156bb1cb (patch)
treec11ccacc3d273e83e35dcda687c80300f8fc73d7
parent56b04b1721ea4e3ca23fe03e9231ef2d4d88d230 (diff)
parent48a86feefe0a5ca4b53155806131eb94d749599e (diff)
Merge "Hold Display suspend blocker until doze starts" into qt-r1-dev
am: 48a86feefe Change-Id: I15d47b96d0b937c720eca379d34a73da5f00a6d2
-rw-r--r--services/core/java/com/android/server/power/PowerManagerService.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index aa49ba62f48b..dc56b03bb100 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -2735,6 +2735,17 @@ public final class PowerManagerService extends SystemService
if (mScreenBrightnessBoostInProgress) {
return true;
}
+
+ // Because summoning the sandman is asyncronous, there is a time-gap where
+ // we release the display suspend blocker before the dream service acquires
+ // their own wakelock. Within this gap, we can end up suspending before
+ // dream service has a chance to start. To avoid this, we check if we want
+ // to doze and the sandman is scheduled and if so, keep the display on until
+ // that has passed.
+ if (mWakefulness == WAKEFULNESS_DOZING && mSandmanScheduled) {
+ return true;
+ }
+
// Let the system suspend if the screen is off or dozing.
return false;
}