Merge "Prevent re-entrant calls to onPause" into tm-dev am: d39f0f7cfd

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19034153

Change-Id: Ia55770dca6c1661016e885c01caddaab832bd647
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2022-06-23 15:12:45 +00:00
committed by Automerger Merge Worker

View File

@@ -59,6 +59,7 @@ public class KeyguardPasswordViewController
private final boolean mShowImeAtScreenOn; private final boolean mShowImeAtScreenOn;
private EditText mPasswordEntry; private EditText mPasswordEntry;
private ImageView mSwitchImeButton; private ImageView mSwitchImeButton;
private boolean mPaused;
private final OnEditorActionListener mOnEditorActionListener = (v, actionId, event) -> { private final OnEditorActionListener mOnEditorActionListener = (v, actionId, event) -> {
// Check if this was the result of hitting the enter key // Check if this was the result of hitting the enter key
@@ -202,6 +203,7 @@ public class KeyguardPasswordViewController
@Override @Override
public void onResume(int reason) { public void onResume(int reason) {
super.onResume(reason); super.onResume(reason);
mPaused = false;
if (reason != KeyguardSecurityView.SCREEN_ON || mShowImeAtScreenOn) { if (reason != KeyguardSecurityView.SCREEN_ON || mShowImeAtScreenOn) {
showInput(); showInput();
} }
@@ -222,6 +224,11 @@ public class KeyguardPasswordViewController
@Override @Override
public void onPause() { public void onPause() {
if (mPaused) {
return;
}
mPaused = true;
if (!mPasswordEntry.isVisibleToUser()) { if (!mPasswordEntry.isVisibleToUser()) {
// Reset all states directly and then hide IME when the screen turned off. // Reset all states directly and then hide IME when the screen turned off.
super.onPause(); super.onPause();