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

Commit 631ad0ad authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Inline IMMS#getCurTokenDisplayIdLocked()

This CL mechanically inlines

  InputMethodManagerService#getCurTokenDisplayIdLocked().

The observable behavior should remain to be the same for single user
mode, and for concurrent multi-user mode it remains to be broken until
we make

  InputMethodManagerService#mImeDrawsImeNavBarRes

multi-user aware anyway.

Bug: 345519864
Bug: 350386877
Test: presubmit
Flag: android.view.inputmethod.concurrent_input_methods
Change-Id: Id0136efc7e6edab057c3adaa1e8603448c89816a
parent 850a834c
Loading
Loading
Loading
Loading
+5 −11
Original line number Diff line number Diff line
@@ -515,14 +515,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
    @SharedByAllUsersField
    private final WeakHashMap<IBinder, Boolean> mFocusedWindowPerceptible = new WeakHashMap<>();

    /**
     * The displayId of current active input method.
     */
    @GuardedBy("ImfLock.class")
    int getCurTokenDisplayIdLocked() {
        return getInputMethodBindingController(mCurrentUserId).getCurTokenDisplayId();
    }

    /**
     * The display ID of the input method indicates the fallback display which returned by
     * {@link #computeImeDisplayIdForTarget}.
@@ -2626,6 +2618,9 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
    @GuardedBy("ImfLock.class")
    @InputMethodNavButtonFlags
    private int getInputMethodNavButtonFlagsLocked() {
        // TODO(b/345519864): Make mImeDrawsImeNavBarRes multi-user aware.
        final int userId = mCurrentUserId;
        final var bindingController = getInputMethodBindingController(userId);
        if (mImeDrawsImeNavBarResLazyInitFuture != null) {
            // TODO(b/225366708): Avoid Future.get(), which is internally used here.
            ConcurrentUtils.waitForFutureNoInterrupt(mImeDrawsImeNavBarResLazyInitFuture,
@@ -2633,15 +2628,14 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        }
        // Whether the current display has a navigation bar. When this is false (e.g. emulator),
        // the IME should not draw the IME navigation bar.
        final int tokenDisplayId = getCurTokenDisplayIdLocked();
        final int tokenDisplayId = bindingController.getCurTokenDisplayId();
        final boolean hasNavigationBar = mWindowManagerInternal
                .hasNavigationBar(tokenDisplayId != INVALID_DISPLAY
                        ? tokenDisplayId : DEFAULT_DISPLAY);
        final boolean canImeDrawsImeNavBar =
                mImeDrawsImeNavBarRes != null && mImeDrawsImeNavBarRes.get() && hasNavigationBar;
        final boolean shouldShowImeSwitcherWhenImeIsShown = shouldShowImeSwitcherLocked(
                InputMethodService.IME_ACTIVE | InputMethodService.IME_VISIBLE,
                mCurrentUserId);
                InputMethodService.IME_ACTIVE | InputMethodService.IME_VISIBLE, userId);
        return (canImeDrawsImeNavBar ? InputMethodNavButtonFlags.IME_DRAWS_IME_NAV_BAR : 0)
                | (shouldShowImeSwitcherWhenImeIsShown
                ? InputMethodNavButtonFlags.SHOW_IME_SWITCHER_WHEN_IME_IS_SHOWN : 0);