Turn off the screen if no security lock

The lock or sleep power button behavior will lock the screen when the
screen is not in keyguard. It should turn off the screen directly if
there is no lock screen set.

Bug: 220814624
Test: manual
Change-Id: I94f7e5dbc15d16ec9e453a9b945d7fadb23ca004
This commit is contained in:
Arthur Hung
2022-03-17 14:57:22 +08:00
parent 751c5ffbe6
commit 8a100c132e

View File

@@ -1023,7 +1023,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
break;
}
case SHORT_PRESS_POWER_LOCK_OR_SLEEP: {
if (keyguardOn()) {
if (mKeyguardDelegate == null || !mKeyguardDelegate.hasKeyguard()
|| !mKeyguardDelegate.isSecure(mCurrentUserId) || keyguardOn()) {
sleepDefaultDisplayFromPowerButton(eventTime, 0);
} else {
lockNow(null /*options*/);