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

Commit 71ab2a69 authored by Antonio Kantek's avatar Antonio Kantek Committed by Android (Google) Code Review
Browse files

Merge "Inline IMMS#getCurIdLocked" into main

parents 00e9c41d 730f47d4
Loading
Loading
Loading
Loading
+15 −25
Original line number Diff line number Diff line
@@ -532,21 +532,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
    @Nullable
    EditorInfo mCurEditorInfo;

    /**
     * Id obtained with {@link InputMethodInfo#getId()} for the input method that we are currently
     * connected to or in the process of connecting to.
     *
     * <p>This can be {@code null} when no input method is connected.</p>
     *
     * @see #getSelectedMethodIdLocked()
     */
    @GuardedBy("ImfLock.class")
    @Nullable
    private String getCurIdLocked() {
        final var userData = mUserDataRepository.getOrCreate(mCurrentUserId);
        return userData.mBindingController.getCurId();
    }

    /**
     * The current subtype of the current input method.
     */
@@ -2011,8 +1996,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        final var userData = mUserDataRepository.getOrCreate(mCurrentUserId);
        final StartInputInfo info = new StartInputInfo(mCurrentUserId,
                getCurTokenLocked(),
                mCurTokenDisplayId, getCurIdLocked(), startInputReason, restarting,
                UserHandle.getUserId(mCurClient.mUid),
                mCurTokenDisplayId, userData.mBindingController.getCurId(), startInputReason,
                restarting, UserHandle.getUserId(mCurClient.mUid),
                mCurClient.mSelfReportedDisplayId, mImeBindingState.mFocusedWindow, mCurEditorInfo,
                mImeBindingState.mFocusedWindowSoftInputMode,
                userData.mBindingController.getSequenceNumber());
@@ -2048,7 +2033,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                    null /* resultReceiver */, SoftInputShowHideReason.ATTACH_NEW_INPUT);
        }

        final var curId = getCurIdLocked();
        final var curId = userData.mBindingController.getCurId();
        final InputMethodInfo curInputMethodInfo = InputMethodSettingsRepository.get(mCurrentUserId)
                .getMethodMap().get(curId);
        final boolean suppressesSpellChecker =
@@ -2337,7 +2322,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                requestClientSessionForAccessibilityLocked(cs);
                return new InputBindResult(
                        InputBindResult.ResultCode.SUCCESS_WAITING_IME_SESSION,
                        null, null, null, getCurIdLocked(),
                        null, null, null,
                        userData.mBindingController.getCurId(),
                        userData.mBindingController.getSequenceNumber(), false);
            } else {
                final long lastBindTime = userData.mBindingController.getLastBindTime();
@@ -2352,7 +2338,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                    // to see if we can get back in touch with the service.
                    return new InputBindResult(
                            InputBindResult.ResultCode.SUCCESS_WAITING_IME_BINDING,
                            null, null, null, getCurIdLocked(),
                            null, null, null,
                            userData.mBindingController.getCurId(),
                            userData.mBindingController.getSequenceNumber(), false);
                } else {
                    EventLog.writeEvent(EventLogTags.IMF_FORCE_RECONNECT_IME,
@@ -2707,7 +2694,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        // When the IME switcher dialog is shown, the IME switcher button should be hidden.
        if (mMenuController.getSwitchingDialogLocked() != null) return false;
        // When we are switching IMEs, the IME switcher button should be hidden.
        if (!Objects.equals(getCurIdLocked(), getSelectedMethodIdLocked())) {
        final var userData = mUserDataRepository.getOrCreate(mCurrentUserId);
        if (!Objects.equals(userData.mBindingController.getCurId(), getSelectedMethodIdLocked())) {
            return false;
        }
        if (mWindowManagerInternal.isKeyguardShowingAndNotOccluded()
@@ -2869,8 +2857,10 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            } else {
                vis &= ~InputMethodService.IME_VISIBLE_IMPERCEPTIBLE;
            }
            final var userData = mUserDataRepository.getOrCreate(mCurrentUserId);
            final var curId = userData.mBindingController.getCurId();
            if (mMenuController.getSwitchingDialogLocked() != null
                    || !Objects.equals(getCurIdLocked(), getSelectedMethodIdLocked())) {
                    || !Objects.equals(curId, getSelectedMethodIdLocked())) {
                // When the IME switcher dialog is shown, or we are switching IMEs,
                // the back button should be in the default state (as if the IME is not shown).
                backDisposition = InputMethodService.BACK_DISPOSITION_ADJUST_NOTHING;
@@ -4438,7 +4428,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            if (mCurEditorInfo != null) {
                mCurEditorInfo.dumpDebug(proto, CUR_ATTRIBUTE);
            }
            proto.write(CUR_ID, getCurIdLocked());
            proto.write(CUR_ID, userData.mBindingController.getCurId());
            mVisibilityStateComputer.dumpDebug(proto, fieldId);
            proto.write(IN_FULLSCREEN_MODE, mInFullscreenMode);
            proto.write(CUR_TOKEN, Objects.toString(getCurTokenLocked()));
@@ -5648,7 +5638,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                    final InputBindResult res = new InputBindResult(
                            InputBindResult.ResultCode.SUCCESS_WITH_ACCESSIBILITY_SESSION,
                            imeSession, accessibilityInputMethodSessions, /* channel= */ null,
                            getCurIdLocked(),
                            userData.mBindingController.getCurId(),
                            userData.mBindingController.getSequenceNumber(),
                            /* isInputMethodSuppressingSpellChecker= */ false);
                    mCurClient.mClient.onBindAccessibilityService(res, accessibilityConnectionId);
@@ -5901,7 +5891,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            p.println("  mFocusedWindowPerceptible=" + mFocusedWindowPerceptible);
            mImeBindingState.dump(/* prefix= */ "  ", p);

            p.println("  mCurId=" + getCurIdLocked()
            p.println("  mCurId=" + userData.mBindingController.getCurId()
                    + " mHaveConnection=" + userData.mBindingController.hasMainConnection()
                    + " mBoundToMethod=" + mBoundToMethod + " mVisibleBound="
                    + userData.mBindingController.isVisibleBound());