Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5befc52 authored by Yohei Yukawa's avatar Yohei Yukawa Committed by android-build-merger
Browse files

Merge "Make IMM more robust to spurious window focus-in" into nyc-dev am: 50c33d1c

am: ef684746

* commit 'ef684746':
  Make IMM more robust to spurious window focus-in

Change-Id: I77ae5953aa9afc64ef1cd3252d6d2ff936890b62
parents 91122718 ef684746
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -1277,6 +1277,28 @@ public final class InputMethodManager {
                            return true;
                        }
                    }
                } else {
                    if (startInputReason
                            == InputMethodClient.START_INPUT_REASON_WINDOW_FOCUS_GAIN) {
                        // We are here probably because of an obsolete window-focus-in message sent
                        // to windowGainingFocus.  Since IMMS determines whether a Window can have
                        // IME focus or not by using the latest window focus state maintained in the
                        // WMS, this kind of race condition cannot be avoided.  One obvious example
                        // would be that we have already received a window-focus-out message but the
                        // UI thread is still handling previous window-focus-in message here.
                        // TODO: InputBindResult should have the error code.
                        if (DEBUG) Log.w(TAG, "startInputOrWindowGainedFocus failed. "
                                + "Window focus may have already been lost. "
                                + "win=" + windowGainingFocus + " view=" + dumpViewInfo(view));
                        if (!mActive) {
                            // mHasBeenInactive is a latch switch to forcefully refresh IME focus
                            // state when an inactive (mActive == false) client is gaining window
                            // focus. In case we have unnecessary disable the latch due to this
                            // spurious wakeup, we re-enable the latch here.
                            // TODO: Come up with more robust solution.
                            mHasBeenInactive = true;
                        }
                    }
                }
                if (mCurMethod != null && mCompletions != null) {
                    try {