From a08d52535db71bcad173b8a70939f027f4e88fe5 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Fri, 28 Feb 2020 23:04:58 +0000 Subject: [PATCH] DO NOT MERGE: Revert: Freeup lock when IME is set inactive and unbound Reason for revert: Caused an unexpected regression Bug 144174015 Bug: 139806621 Bug: 144103599 Fix: 144174015 Test: Manually verified Bug 144174015 disappeared as follows 1. Open Gmail then start composing an email 2. Swipe up the home button to recents then re-launch Gmail 3. Do the step 2 several times. 4. Make sure that you can still type something on Gmail. Change-Id: I04a77afea17f9d3eb05017fa00313fad4e48cd5c (cherry picked from commit 9494c9dbb73b0ce237cb2f64fba90434b1b09c09) --- .../view/inputmethod/InputMethodManager.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index d3618adca6c49..d75810ad0e372 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -655,14 +655,14 @@ public final class InputMethodManager { } catch (RemoteException e) { } } - } - // Check focus again in case that "onWindowFocus" is called before - // handling this message. - if (mServedView != null && canStartInput(mServedView)) { - if (checkFocusNoStartInput(mRestartOnNextWindowFocus)) { - final int reason = active ? StartInputReason.ACTIVATED_BY_IMMS - : StartInputReason.DEACTIVATED_BY_IMMS; - startInputInner(reason, null, 0, 0, 0); + // Check focus again in case that "onWindowFocus" is called before + // handling this message. + if (mServedView != null && canStartInput(mServedView)) { + if (checkFocusNoStartInput(mRestartOnNextWindowFocus)) { + final int reason = active ? StartInputReason.ACTIVATED_BY_IMMS + : StartInputReason.DEACTIVATED_BY_IMMS; + startInputInner(reason, null, 0, 0, 0); + } } } return; @@ -1225,10 +1225,6 @@ public final class InputMethodManager { */ void clearBindingLocked() { if (DEBUG) Log.v(TAG, "Clearing binding!"); - if (mWindowFocusGainFuture != null) { - mWindowFocusGainFuture.cancel(false /* mayInterruptIfRunning */); - mWindowFocusGainFuture = null; - } clearConnectionLocked(); setInputChannelLocked(null); mBindSequence = -1;