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

Commit 512234f1 authored by Yohei Yukawa's avatar Yohei Yukawa Committed by Android (Google) Code Review
Browse files

Merge "Close input session when the view is detached from the window." into mnc-dev

parents 3d7e0d8e b13f015a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -14506,6 +14506,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        onDetachedFromWindow();
        onDetachedFromWindowInternal();
        InputMethodManager imm = InputMethodManager.peekInstance();
        if (imm != null) {
            imm.onViewDetachedFromWindow(this);
        }
        ListenerInfo li = mListenerInfo;
        final CopyOnWriteArrayList<OnAttachStateChangeListener> listeners =
                li != null ? li.mOnAttachStateChangeListeners : null;
+16 −0
Original line number Diff line number Diff line
@@ -1320,6 +1320,22 @@ public final class InputMethodManager {
        }
    }

    /**
     * Call this when a view is being detached from a {@link android.view.Window}.
     * @hide
     */
    public void onViewDetachedFromWindow(View view) {
        synchronized (mH) {
            if (DEBUG) Log.v(TAG, "onViewDetachedFromWindow: " + view
                    + " mServedView=" + mServedView
                    + " hasWindowFocus=" + view.hasWindowFocus());
            if (mServedView == view && view.hasWindowFocus()) {
                mNextServedView = null;
                scheduleCheckFocusLocked(view);
            }
        }
    }

    static void scheduleCheckFocusLocked(View view) {
        ViewRootImpl viewRootImpl = view.getViewRootImpl();
        if (viewRootImpl != null) {