Fix IME window pops up when unlock keyguard with fingerprint

When in KeyguardPasswordView, hide IME window manually with pressing
back key to back Keyguard view, and then unlock screen with fingerprint
will find IME window pop up suddently.

The reason is when KeyguardBouncer#hide will have a call path to pause
KeyguardPasswordView & reset the state, but in resetState() will call
IMM#showSoftInput even the password entry is invisible.

Make sure to not call IMM#showSoftInput when KeyguardPasswordView is
in pausing stage or password entry is invisible case to prevent
IME pops up in unexpected way.

Bug: 112811602
Test: manual as the issue description
Change-Id: I3c43d09d4206c48f1afcd8dad79e7978337f1b7d
This commit is contained in:
lumark
2019-01-10 15:29:11 +08:00
parent 3f215a1dea
commit d62bfd20d0
2 changed files with 9 additions and 0 deletions

View File

@@ -46,6 +46,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
protected View mEcaView;
protected boolean mEnableHaptics;
private boolean mDismissing;
protected boolean mResumed;
private CountDownTimer mCountdownTimer = null;
// To avoid accidental lockout due to events while the device in in the pocket, ignore
@@ -263,6 +264,8 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
@Override
public void onPause() {
mResumed = false;
if (mCountdownTimer != null) {
mCountdownTimer.cancel();
mCountdownTimer = null;
@@ -276,6 +279,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
@Override
public void onResume(int reason) {
mResumed = true;
}
@Override

View File

@@ -81,6 +81,11 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView
protected void resetState() {
mSecurityMessageDisplay.setMessage("");
final boolean wasDisabled = mPasswordEntry.isEnabled();
// Don't set enabled password entry & showSoftInput when PasswordEntry is invisible or in
// pausing stage.
if (!mResumed || !mPasswordEntry.isVisibleToUser()) {
return;
}
setPasswordEntryEnabled(true);
setPasswordEntryInputEnabled(true);
if (wasDisabled) {