Don't allow dreaming for users that can't dream.

DreamManagerService#canStartDreaming should not return true if the
current user is not allowed to dream.

Bug: 261907079
Test: manually by switching to a user that can't dream and making
sure that the screen turns off on power press while docked.

Change-Id: Ia4a46dff5360d3565762b82fb4353e66f0b8f661
This commit is contained in:
Will Leshner
2022-12-08 14:59:28 -08:00
parent 1f9eb48888
commit a6000e21cb

View File

@@ -379,6 +379,10 @@ public final class DreamManagerService extends SystemService {
return false;
}
if (!dreamsEnabledForUser(ActivityManager.getCurrentUser())) {
return false;
}
if ((mWhenToDream & DREAM_ON_CHARGE) == DREAM_ON_CHARGE) {
return mIsCharging;
}