summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alex Stetson <alexstetson@google.com> 2023-03-22 13:58:12 -0700
committer Alex Stetson <alexstetson@google.com> 2023-03-23 18:44:36 +0000
commita84c0e39d38759c9e8c8f08b2605a3a2597b7be7 (patch)
tree5a5d6b474df98b213474090c08f1b19adf71c117
parent7cfe709dc889b67ebf847c2dc550830853854f6d (diff)
Clear and re-focus pin password entry field
Under certain conditions, this field can enter an unpredictable state where it's not focused but the request focus call fails because the focus flag is set. By clearing the focus before re-requesting, a fully focused state can be guaranteed. Bug: 263440452 Test: atest android.appsecurity.cts.DirectBootHostTest#testDirectBootNative Change-Id: Ib8f0de99abbf99cdbed4c3228c44ee3db105f952
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java
index 559db76748ed..ded1238742fb 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java
@@ -127,6 +127,11 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB
@Override
public void onResume(int reason) {
super.onResume(reason);
+ // It's possible to reach a state here where mPasswordEntry believes it is focused
+ // but it is not actually focused. This state will prevent the view from gaining focus,
+ // as requestFocus will no-op since the focus flag is already set. By clearing focus first,
+ // it's guaranteed that the view has focus.
+ mPasswordEntry.clearFocus();
mPasswordEntry.requestFocus();
}