Keyguard can be on even if not showing
It is possible for keyguard to be in "restricted input" state even if
isKeyguardShowingAndNotOccluded returns false. The previous CL to
deprecate inKeyguardRestrictedInputMode has also changed the behaviour
of isKeyguardLocked. Return to the old behaviour here, but keep the API
deprecated.
Bug: 70411251
Test: 1) add Google account to phone 2) Enable google assistant and set
up active edge to trigger the assistant 3) Ensure phone is in the
always-on-display mode 4) Squeeze the phone to trigger the assistant.
Previously, the assistant would not launch. The expected behaviour is
that assistant gets launched. Without this change, display will turn on
but the assistant will not get launched.
Change-Id: Ic299f3fc223ebdc3b0f6eea97cb4a89a3142e44a
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 61591bb..29cdcc7 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -3392,7 +3392,7 @@
}
boolean keyguardOn() {
- return isKeyguardShowingAndNotOccluded();
+ return isKeyguardShowingAndNotOccluded() || inKeyguardRestrictedKeyInputMode();
}
private static final int[] WINDOW_TYPES_WHERE_HOME_DOESNT_WORK = {
@@ -6934,6 +6934,13 @@
return mKeyguardOccluded;
}
+ /** {@inheritDoc} */
+ @Override
+ public boolean inKeyguardRestrictedKeyInputMode() {
+ if (mKeyguardDelegate == null) return false;
+ return mKeyguardDelegate.isInputRestricted();
+ }
+
@Override
public void dismissKeyguardLw(IKeyguardDismissCallback callback) {
if (mKeyguardDelegate != null && mKeyguardDelegate.isShowing()) {
diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java
index bcb7212..cfe4088 100644
--- a/services/core/java/com/android/server/policy/WindowManagerPolicy.java
+++ b/services/core/java/com/android/server/policy/WindowManagerPolicy.java
@@ -1360,6 +1360,17 @@
public boolean isKeyguardTrustedLw();
/**
+ * inKeyguardRestrictedKeyInputMode
+ *
+ * If keyguard screen is showing or in restricted key input mode (i.e. in
+ * keyguard password emergency screen). When in such mode, certain keys,
+ * such as the Home key and the right soft keys, don't work.
+ *
+ * @return true if in keyguard restricted input mode.
+ */
+ public boolean inKeyguardRestrictedKeyInputMode();
+
+ /**
* Ask the policy to dismiss the keyguard, if it is currently shown.
*
* @param callback Callback to be informed about the result.
diff --git a/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java b/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
index 481c898..c735341 100644
--- a/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
+++ b/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
@@ -411,6 +411,11 @@
}
@Override
+ public boolean inKeyguardRestrictedKeyInputMode() {
+ return false;
+ }
+
+ @Override
public void dismissKeyguardLw(@Nullable IKeyguardDismissCallback callback) {
}