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

Commit 292aaee5 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Inline clearInputShownLocked() and isInputShownLocked()

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

Bug: 349904272
Test: presubmit
Flag: EXEMPT refactor
Change-Id: I6b4262efd4f9131be3b98b00ba92892772c87559
parent a5ebd6b7
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -463,7 +463,7 @@ final class InputMethodBindingController {
                    // should now try to restart the service for us.
                    // should now try to restart the service for us.
                    mLastBindTime = SystemClock.uptimeMillis();
                    mLastBindTime = SystemClock.uptimeMillis();
                    clearCurMethodAndSessions();
                    clearCurMethodAndSessions();
                    mService.clearInputShownLocked();
                    mService.mVisibilityStateComputer.setInputShown(false);
                    mService.unbindCurrentClientLocked(UnbindReason.DISCONNECT_IME, mUserId);
                    mService.unbindCurrentClientLocked(UnbindReason.DISCONNECT_IME, mUserId);
                }
                }
            }
            }
+6 −16
Original line number Original line Diff line number Diff line
@@ -372,7 +372,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
    @GuardedBy("ImfLock.class")
    @GuardedBy("ImfLock.class")
    @MultiUserUnawareField
    @MultiUserUnawareField
    @NonNull
    @NonNull
    private final ImeVisibilityStateComputer mVisibilityStateComputer;
    final ImeVisibilityStateComputer mVisibilityStateComputer;


    @GuardedBy("ImfLock.class")
    @GuardedBy("ImfLock.class")
    @SharedByAllUsersField
    @SharedByAllUsersField
@@ -1806,16 +1806,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        }
        }
    }
    }


    @GuardedBy("ImfLock.class")
    void clearInputShownLocked() {
        mVisibilityStateComputer.setInputShown(false);
    }

    @GuardedBy("ImfLock.class")
    private boolean isInputShownLocked() {
        return mVisibilityStateComputer.isInputShown();
    }

    @GuardedBy("ImfLock.class")
    @GuardedBy("ImfLock.class")
    private boolean isShowRequestedForCurrentWindow(@UserIdInt int userId) {
    private boolean isShowRequestedForCurrentWindow(@UserIdInt int userId) {
        final var userData = getUserData(userId);
        final var userData = getUserData(userId);
@@ -3051,7 +3041,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        try {
        try {
            if (DEBUG) Slog.v(TAG, "Client requesting input be shown");
            if (DEBUG) Slog.v(TAG, "Client requesting input be shown");
            if (Flags.refactorInsetsController()) {
            if (Flags.refactorInsetsController()) {
                boolean wasVisible = isInputShownLocked();
                boolean wasVisible = mVisibilityStateComputer.isInputShown();
                if (userData.mImeBindingState != null
                if (userData.mImeBindingState != null
                        && userData.mImeBindingState.mFocusedWindowClient != null
                        && userData.mImeBindingState.mFocusedWindowClient != null
                        && userData.mImeBindingState.mFocusedWindowClient.mClient != null) {
                        && userData.mImeBindingState.mFocusedWindowClient.mClient != null) {
@@ -3488,7 +3478,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        final int callingUserId = UserHandle.getUserId(uid);
        final int callingUserId = UserHandle.getUserId(uid);
        final int userId = resolveImeUserIdLocked(callingUserId);
        final int userId = resolveImeUserIdLocked(callingUserId);
        if (!canInteractWithImeLocked(uid, client, "hideSoftInput", statsToken, userId)) {
        if (!canInteractWithImeLocked(uid, client, "hideSoftInput", statsToken, userId)) {
            if (isInputShownLocked()) {
            if (mVisibilityStateComputer.isInputShown()) {
                ImeTracker.forLogging().onFailed(
                ImeTracker.forLogging().onFailed(
                        statsToken, ImeTracker.PHASE_SERVER_CLIENT_FOCUSED);
                        statsToken, ImeTracker.PHASE_SERVER_CLIENT_FOCUSED);
            } else {
            } else {
@@ -3506,7 +3496,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                if (userData.mImeBindingState != null
                if (userData.mImeBindingState != null
                        && userData.mImeBindingState.mFocusedWindowClient != null
                        && userData.mImeBindingState.mFocusedWindowClient != null
                        && userData.mImeBindingState.mFocusedWindowClient.mClient != null) {
                        && userData.mImeBindingState.mFocusedWindowClient.mClient != null) {
                    boolean wasVisible = isInputShownLocked();
                    boolean wasVisible = mVisibilityStateComputer.isInputShown();
                    // TODO add windowToken to interface
                    // TODO add windowToken to interface
                    userData.mImeBindingState.mFocusedWindowClient.mClient
                    userData.mImeBindingState.mFocusedWindowClient.mClient
                            .setImeVisibility(false, statsToken);
                            .setImeVisibility(false, statsToken);
@@ -3568,7 +3558,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        // TODO(b/246309664): Clean up IMMS#mImeWindowVis
        // TODO(b/246309664): Clean up IMMS#mImeWindowVis
        IInputMethodInvoker curMethod = bindingController.getCurMethod();
        IInputMethodInvoker curMethod = bindingController.getCurMethod();
        final boolean shouldHideSoftInput = curMethod != null
        final boolean shouldHideSoftInput = curMethod != null
                && (isInputShownLocked()
                && (mVisibilityStateComputer.isInputShown()
                || (bindingController.getImeWindowVis() & InputMethodService.IME_ACTIVE) != 0);
                || (bindingController.getImeWindowVis() & InputMethodService.IME_ACTIVE) != 0);


        mVisibilityStateComputer.requestImeVisibility(windowToken, false);
        mVisibilityStateComputer.requestImeVisibility(windowToken, false);
@@ -4974,7 +4964,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                        // implemented so that auxiliary subtypes will be excluded when the soft
                        // implemented so that auxiliary subtypes will be excluded when the soft
                        // keyboard is invisible.
                        // keyboard is invisible.
                        synchronized (ImfLock.class) {
                        synchronized (ImfLock.class) {
                            showAuxSubtypes = isInputShownLocked();
                            showAuxSubtypes = mVisibilityStateComputer.isInputShown();
                        }
                        }
                        break;
                        break;
                    case InputMethodManager.SHOW_IM_PICKER_MODE_INCLUDE_AUXILIARY_SUBTYPES:
                    case InputMethodManager.SHOW_IM_PICKER_MODE_INCLUDE_AUXILIARY_SUBTYPES: