From 6c1d067e9a31265c70c079f598cc9557470ff7ea Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Wed, 22 Jun 2022 13:42:44 -0400 Subject: Prevent re-entrant calls to onPause This can occur when launching an occluding activity where the user has user the password bouncer. The IME animation begins, but is then canceled in favor of the activity being launched, which begins a chain of events that start a second call to pause. Fixes: 236348317 Test: manual (follow steps in bug to launch occluding activity) Change-Id: I158504872d41c96f1f6f27cab481945cd11c27e0 --- .../src/com/android/keyguard/KeyguardPasswordViewController.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java index 8f44e97ef231..bfacc590dc52 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java @@ -59,6 +59,7 @@ public class KeyguardPasswordViewController private final boolean mShowImeAtScreenOn; private EditText mPasswordEntry; private ImageView mSwitchImeButton; + private boolean mPaused; private final OnEditorActionListener mOnEditorActionListener = (v, actionId, event) -> { // Check if this was the result of hitting the enter key @@ -202,6 +203,7 @@ public class KeyguardPasswordViewController @Override public void onResume(int reason) { super.onResume(reason); + mPaused = false; if (reason != KeyguardSecurityView.SCREEN_ON || mShowImeAtScreenOn) { showInput(); } @@ -222,6 +224,11 @@ public class KeyguardPasswordViewController @Override public void onPause() { + if (mPaused) { + return; + } + mPaused = true; + if (!mPasswordEntry.isVisibleToUser()) { // Reset all states directly and then hide IME when the screen turned off. super.onPause(); -- cgit v1.2.3-59-g8ed1b