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

Commit 4478de3c authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Clear IMM references when window dismissed.

Match behavior of removeViewLocked(), where InputMethodManager clears
any strong references to Views, and also clear mCurRootView. Without
this, IMM can leak a DecorView instance after the user has left the
application.

Bug: 6413553
Change-Id: Iad09cf5dbb7f6f156fd39ed243431432e00f8945
parent f5d70fd2
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -340,6 +340,14 @@ public class WindowManagerImpl implements WindowManager {
            View curView = root.getView();
            
            root.mAddNesting = 0;

            if (view != null) {
                InputMethodManager imm = InputMethodManager.getInstance(view.getContext());
                if (imm != null) {
                    imm.windowDismissed(mViews[index].getWindowToken());
                }
            }

            root.die(true);
            finishRemoveViewLocked(curView, index);
            if (curView == view) {
+1 −0
Original line number Diff line number Diff line
@@ -672,6 +672,7 @@ public final class InputMethodManager {
     * Disconnect any existing input connection, clearing the served view.
     */
    void finishInputLocked() {
        mCurRootView = null;
        mNextServedView = null;
        if (mServedView != null) {
            if (DEBUG) Log.v(TAG, "FINISH INPUT: " + mServedView);