Merge "Lock device on short power button press." into tm-qpr-dev am: 37929e00a5

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20583933

Change-Id: I2494354420ebfe49315462a9728641d2cba48eb6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
William Leshner
2022-12-10 03:52:47 +00:00
committed by Automerger Merge Worker

View File

@@ -1051,6 +1051,19 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return;
}
// Make sure the device locks. Unfortunately, this has the side-effect of briefly revealing
// the lock screen before the dream appears. Note that this locking behavior needs to
// happen regardless of whether we end up dreaming (below) or not.
// TODO(b/261662912): Find a better way to lock the device that doesn't result in jank.
lockNow(null);
// Don't dream if the user isn't user zero.
// TODO(b/261907079): Move this check to DreamManagerService#canStartDreamingInternal().
if (ActivityManager.getCurrentUser() != UserHandle.USER_SYSTEM) {
noDreamAction.run();
return;
}
final DreamManagerInternal dreamManagerInternal = getDreamManagerInternal();
if (dreamManagerInternal == null || !dreamManagerInternal.canStartDreaming(isScreenOn)) {
noDreamAction.run();