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

Commit 49b876c8 authored by Cosmin Băieș's avatar Cosmin Băieș Committed by Android (Google) Code Review
Browse files

Merge "Check for view focus in hideSoftInputFromView" into main

parents 70dcba63 fee50a4c
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2320,6 +2320,15 @@ public final class InputMethodManager {
     * @hide
     */
    public boolean hideSoftInputFromView(@NonNull View view, @HideFlags int flags) {
        final boolean isFocusedAndWindowFocused = view.hasWindowFocus() && view.isFocused();
        synchronized (mH) {
            if (!isFocusedAndWindowFocused && !hasServedByInputMethodLocked(view)) {
                // Fail early if the view is not focused and not served
                // to avoid logging many erroneous calls.
                return false;
            }
        }

        final var reason = SoftInputShowHideReason.HIDE_SOFT_INPUT_FROM_VIEW;
        final ImeTracker.Token statsToken = ImeTracker.forLogging().onRequestHide(
                null /* component */, Process.myUid(),