Also go to sleep when dozing

Since always-on-screen shows over an occluded activity, we also
need to go to sleep to in that case. Now, we could introduce
another sleep token that's controlled by SystemUI. But that's a
bit complicated. It's much simpler to unconditionally go to sleep
whenever we are dozing.

Test: With always-on-device, open occluded activity, turn off
screen, make sure activity pauses.
Fixes: 62679291

Change-Id: Icd64037d33cc523e498a0a9f5f7df939304e02ed
This commit is contained in:
Jorim Jaggi
2017-07-12 15:32:18 +02:00
parent 8b44d3722d
commit 96e3b2afb0

View File

@@ -12460,10 +12460,10 @@ public class ActivityManagerService extends IActivityManager.Stub
switch (mWakefulness) {
case PowerManagerInternal.WAKEFULNESS_AWAKE:
case PowerManagerInternal.WAKEFULNESS_DREAMING:
case PowerManagerInternal.WAKEFULNESS_DOZING:
// Pause applications whenever the lock screen is shown or any sleep
// tokens have been acquired.
return mKeyguardController.isKeyguardShowing() || !mSleepTokens.isEmpty();
case PowerManagerInternal.WAKEFULNESS_DOZING:
case PowerManagerInternal.WAKEFULNESS_ASLEEP:
default:
// If we're asleep then pause applications unconditionally.