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

Commit 0049e994 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Inline IMMS#isSelectedMethodBoundLocked()

With this commit we avoid redundant invocations of

  IMMS#mUserDataRepository.getOrCreate(mCurrentUserId)

from

  InputMethodManagerService#startInputUncheckedLocked()

by recursively inlining

  InputMethodManagerService#isSelectedMethodBoundLocked().

This is a mechanical optimization. There must be no observable
behavior change.

Bug: 325515685
Test: presubmit
Change-Id: I25e2d1735824fa2ce91ed2cfe71b21653c950bf5
parent 14bea363
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -2250,7 +2250,9 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        // 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 (isSelectedMethodBoundLocked()) {
        final String curId = bindingController.getCurId();
        if (curId != null && curId.equals(bindingController.getSelectedMethodId())
                && mDisplayIdToShowIme == mCurTokenDisplayId) {
            if (cs.mCurSession != null) {
                // Fast case: if we are already connected to the input method,
                // then just return it.
@@ -2368,13 +2370,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        return true;
    }

    @GuardedBy("ImfLock.class")
    private boolean isSelectedMethodBoundLocked() {
        String curId = getCurIdLocked();
        return curId != null && curId.equals(getSelectedMethodIdLocked())
                && mDisplayIdToShowIme == mCurTokenDisplayId;
    }

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