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

Commit 27105fb7 authored by Louis Chang's avatar Louis Chang Committed by android-build-merger
Browse files

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

am: c1a0fbce

Change-Id: Idde12e81d4f41ab039823470302e099a3c225f68
parents d8e8a386 c1a0fbce
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -85,6 +85,7 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer {
    @Override
    @Override
    public void onWindowFocusLost() {
    public void onWindowFocusLost() {
        mHasWindowFocus = false;
        mHasWindowFocus = false;
        getImm().unregisterImeConsumer(this);
    }
    }


    /**
    /**
+17 −0
Original line number Original line 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.
     * Call showSoftInput with currently focused view.
     * @return {@code true} if IME can be shown.
     * @return {@code true} if IME can be shown.