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

Commit c1a0fbce authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Unregister ImeInsetsSourceConsumer when focus lost" into qt-dev

parents 57dce7b0 3d4a7d1b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer {
    @Override
    public void onWindowFocusLost() {
        mHasWindowFocus = false;
        getImm().unregisterImeConsumer(this);
    }

    /**
+17 −0
Original line number Diff line number Diff line
@@ -1950,6 +1950,23 @@ public final class InputMethodManager {
        }
    }

    /**
     * Unregister for IME state callbacks and applying visibility in
     * {@link android.view.ImeInsetsSourceConsumer}.
     * @hide
     */
    public void unregisterImeConsumer(@NonNull ImeInsetsSourceConsumer imeInsetsConsumer) {
        if (imeInsetsConsumer == null) {
            throw new IllegalStateException("ImeInsetsSourceConsumer cannot be null.");
        }

        synchronized (mH) {
            if (mImeInsetsConsumer == imeInsetsConsumer) {
                mImeInsetsConsumer = null;
            }
        }
    }

    /**
     * Call showSoftInput with currently focused view.
     * @return {@code true} if IME can be shown.