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

Commit 43ce1d62 authored by Cosmin Băieș's avatar Cosmin Băieș
Browse files

Set IME Switcher nav hint based on IME visibility

The navigationIconHints are computed in
Utilities#calculateNavigationIconHints, using the given value of
showImeSwitcher. This is modified before the call to be true only
if showIme is also true.

This change moves the modification to inside the method, to ensure
consistency. Note, it wouldn't make sense to request showing the IME
Switcher button when the IME itself is not visible.

Flag: EXEMPT refactor
Bug: 366129400
Test: atest NavigationBarTest#testSetImeWindowStatusSysuiState_ImeNotVisibleImeSwitcherButtonVisible
Change-Id: Ia6a04ecd3700acf2078ae2cb4cd2412bcd7caa51
parent d0878262
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -107,9 +107,11 @@ public class Utilities {
     * Gets the updated navigation icon hints, based on the current ones and the given IME state.
     *
     * @param oldHints        current navigation icon hints.
     * @param backDisposition the IME back disposition mode.
     * @param backDisposition the IME back disposition mode. Only takes effect if
     *                        {@code imeShown} is {@code true}.
     * @param imeShown        whether the IME is currently visible.
     * @param showImeSwitcher whether the IME Switcher button should be shown.
     * @param showImeSwitcher whether the IME Switcher button should be shown. Only takes effect if
     *                        {@code imeShown} is {@code true}.
     */
    @NavigationHint
    public static int calculateNavigationIconHints(@NavigationHint int oldHints,
@@ -134,7 +136,7 @@ public class Utilities {
        } else {
            hints &= ~NAVIGATION_HINT_IME_SHOWN;
        }
        if (showImeSwitcher) {
        if (showImeSwitcher && imeShown) {
            hints |= NAVIGATION_HINT_IME_SWITCHER_BUTTON_SHOWN;
        } else {
            hints &= ~NAVIGATION_HINT_IME_SWITCHER_BUTTON_SHOWN;
+0 −1
Original line number Diff line number Diff line
@@ -465,7 +465,6 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
            // Count imperceptible changes as visible so we transition taskbar out quickly.
            imeShown = (vis & InputMethodService.IME_VISIBLE_IMPERCEPTIBLE) != 0;
        }
        showImeSwitcher = imeShown && showImeSwitcher;
        int hints = Utilities.calculateNavigationIconHints(mNavigationIconHints, backDisposition,
                imeShown, showImeSwitcher);
        if (hints == mNavigationIconHints) {
+0 −1
Original line number Diff line number Diff line
@@ -1139,7 +1139,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
            return;
        }
        boolean imeShown = mNavBarHelper.isImeShown(vis);
        showImeSwitcher = imeShown && showImeSwitcher;
        int hints = Utilities.calculateNavigationIconHints(mNavigationIconHints, backDisposition,
                imeShown, showImeSwitcher);
        if (hints == mNavigationIconHints) {