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

Commit 9bc49a5a authored by Nikolas Havrikov's avatar Nikolas Havrikov
Browse files

Extract isSelectedMethodBound method

Bug: 205676419
Test: make
Change-Id: I0b08f54ee46422980ce8738c12c02cfe6ba29ad8
parent 95b509ea
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -2459,8 +2459,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        // Check if the input method is changing.
        // We expect the caller has already verified that the client is allowed to access this
        // display ID.
        if (getCurId() != null && getCurId().equals(getSelectedMethodId())
                && displayIdToShowIme == mCurTokenDisplayId) {
        if (isSelectedMethodBound(displayIdToShowIme)) {
            if (cs.curSession != null) {
                // Fast case: if we are already connected to the input method,
                // then just return it.
@@ -2495,6 +2494,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        return InputBindResult.IME_NOT_CONNECTED;
    }

    private boolean isSelectedMethodBound(int displayIdToShowIme) {
        String curId = getCurId();
        return curId != null && curId.equals(getSelectedMethodId())
                && displayIdToShowIme == mCurTokenDisplayId;
    }

    @GuardedBy("mMethodMap")
    private void prepareClientSwitchLocked(ClientState cs) {
        // If the client is changing, we need to switch over to the new