summaryrefslogtreecommitdiffstats
path: root/services/core/java/com/android/server/power/PowerManagerService.java
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2019-08-01 18:33:20 +0100
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-09-20 04:04:53 +0000
commitd096899ce02d2ae8243f383b9c69c00261a12c84 (patch)
tree5d521b520e7ac86e357393b40a4b987fe379f7fc /services/core/java/com/android/server/power/PowerManagerService.java
parentec01463242d4ba9a376d69fc34729cf8cb8fb7b0 (diff)
downloadandroid_frameworks_base-d096899ce02d2ae8243f383b9c69c00261a12c84.tar.gz
android_frameworks_base-d096899ce02d2ae8243f383b9c69c00261a12c84.tar.bz2
android_frameworks_base-d096899ce02d2ae8243f383b9c69c00261a12c84.zip
Acquire display suspend blocker for DozeService
If DozeService explicitly requests the display state to be on, then PowerManager needs to acquire the display suspend blocker even while in DOZE mode to prevent the system from constantly trying to suspend. Bug: 138195405 Test: atest PowerManagerServiceTest Change-Id: I05f5b86789ced084d0814480b2fe89d74f96a54e (cherry picked from commit d9701abf0482d644551657124a315ee1e6638e85) (cherry picked from commit c8fa1c6be4a3e10bca93f6070e820580b7860133)
Diffstat (limited to 'services/core/java/com/android/server/power/PowerManagerService.java')
-rw-r--r--services/core/java/com/android/server/power/PowerManagerService.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index cfd3ae6ef59..aa49ba62f48 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -2724,6 +2724,14 @@ public final class PowerManagerService extends SystemService
return true;
}
}
+
+ if (mDisplayPowerRequest.policy == DisplayPowerRequest.POLICY_DOZE
+ && mDisplayPowerRequest.dozeScreenState == Display.STATE_ON) {
+ // Although we are in DOZE and would normally allow the device to suspend,
+ // the doze service has explicitly requested the display to remain in the ON
+ // state which means we should hold the display suspend blocker.
+ return true;
+ }
if (mScreenBrightnessBoostInProgress) {
return true;
}
@@ -4858,7 +4866,8 @@ public final class PowerManagerService extends SystemService
}
}
- private final class LocalService extends PowerManagerInternal {
+ @VisibleForTesting
+ final class LocalService extends PowerManagerInternal {
@Override
public void setScreenBrightnessOverrideFromWindowManager(int screenBrightness) {
if (screenBrightness < PowerManager.BRIGHTNESS_DEFAULT