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

Commit 05fe90c1 authored by Yohei Yukawa's avatar Yohei Yukawa Committed by Android (Google) Code Review
Browse files

Merge "Show IME switcher also when hardware keyboard is connected." into mnc-dev

parents a58fbec6 c6c7cd27
Loading
Loading
Loading
Loading
+49 −44
Original line number Original line Diff line number Diff line
@@ -1624,11 +1624,20 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        }
        }
    }
    }


    private boolean needsToShowImeSwitchOngoingNotification() {
    private boolean shouldShowImeSwitcherLocked() {
        if (!mShowOngoingImeSwitcherForPhones) return false;
        if (!mShowOngoingImeSwitcherForPhones) return false;
        if (mSwitchingDialog != null) return false;
        if (mSwitchingDialog != null) return false;
        if (isScreenLocked()) return false;
        if (isScreenLocked()) return false;
        synchronized (mMethodMap) {
        if ((mImeWindowVis & InputMethodService.IME_ACTIVE) == 0) return false;
        if (mWindowManagerService.isHardKeyboardAvailable()) {
            // When physical keyboard is attached, we show the ime switcher (or notification if
            // NavBar is not available) because SHOW_IME_WITH_HARD_KEYBOARD settings currently
            // exists in the IME switcher dialog.  Might be OK to remove this condition once
            // SHOW_IME_WITH_HARD_KEYBOARD settings finds a good place to live.
            return true;
        }
        if ((mImeWindowVis & InputMethodService.IME_VISIBLE) == 0) return false;

        List<InputMethodInfo> imis = mSettings.getEnabledInputMethodListLocked();
        List<InputMethodInfo> imis = mSettings.getEnabledInputMethodListLocked();
        final int N = imis.size();
        final int N = imis.size();
        if (N > 2) return true;
        if (N > 2) return true;
@@ -1671,7 +1680,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        }
        }
        return false;
        return false;
    }
    }
    }


    private boolean isKeyguardLocked() {
    private boolean isKeyguardLocked() {
        return mKeyguardManager != null && mKeyguardManager.isKeyguardLocked();
        return mKeyguardManager != null && mKeyguardManager.isKeyguardLocked();
@@ -1697,11 +1705,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                mImeWindowVis = vis;
                mImeWindowVis = vis;
                mInputShown = ((mImeWindowVis & InputMethodService.IME_VISIBLE) != 0);
                mInputShown = ((mImeWindowVis & InputMethodService.IME_VISIBLE) != 0);
                mBackDisposition = backDisposition;
                mBackDisposition = backDisposition;
                final boolean iconVisibility = ((vis & (InputMethodService.IME_ACTIVE)) != 0)
                // mImeWindowVis should be updated before calling shouldShowImeSwitcherLocked().
                        && (mWindowManagerService.isHardKeyboardAvailable()
                final boolean needsToShowImeSwitcher = shouldShowImeSwitcherLocked();
                                || (vis & (InputMethodService.IME_VISIBLE)) != 0);
                final boolean needsToShowImeSwitcher = iconVisibility
                        && needsToShowImeSwitchOngoingNotification();
                if (mStatusBar != null) {
                if (mStatusBar != null) {
                    mStatusBar.setImeWindowStatus(token, vis, backDisposition,
                    mStatusBar.setImeWindowStatus(token, vis, backDisposition,
                            needsToShowImeSwitcher);
                            needsToShowImeSwitcher);