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
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user