From d62bfd20d0df5540f10d40bd950ba6172c5f6f34 Mon Sep 17 00:00:00 2001 From: lumark Date: Thu, 10 Jan 2019 15:29:11 +0800 Subject: [PATCH] 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 --- .../src/com/android/keyguard/KeyguardAbsKeyInputView.java | 4 ++++ .../src/com/android/keyguard/KeyguardPasswordView.java | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java index 41e9ebaac4f66..a055950a55223 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java @@ -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 diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java index 41afa9a211281..3296c10f7a390 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java @@ -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) {