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

Commit 967338c2 authored by Wilson Wu's avatar Wilson Wu
Browse files

Refine InputMethodManager#isAcceptingText API

-. Use synchronized(mH) lock to guard it for thread safe
-. Update java doc of this API

Bug: 158539274
Test: atest CtsInputMethodTestCases
Change-Id: I5233b19a2a64d7b2c06b8fd5b6397ef5ca65d367
parent 254beb43
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1414,13 +1414,15 @@ public final class InputMethodManager {
    }

    /**
     * Return true if the currently served view is accepting full text edits.
     * If false, it has no input connection, so can only handle raw key events.
     * Return {@code true} if the currently served view is accepting full text edits.
     * If {@code false}, it has no input connection, so it can only handle raw key events.
     */
    public boolean isAcceptingText() {
        checkFocus();
        return mServedInputConnectionWrapper != null &&
                mServedInputConnectionWrapper.getInputConnection() != null;
        synchronized (mH) {
            return mServedInputConnectionWrapper != null
                    && mServedInputConnectionWrapper.getInputConnection() != null;
        }
    }

    /**