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

Commit bf122b9f authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Have both NAVIGATION_HINT_IME{,_SWITCHER}_SHOWN

This is a mechanical renaming CL with no behavior change.

Somehow NAVIGATION_HINT_IME_SHOWN was set when the IME switcher needs
to be shown, not when the IME is shown.  This CL aims to avoid future
confusions by also introducing

  NAVIGATION_HINT_IME_SWITCHER_SHOWN

then setting NAVIGATION_HINT_IME_SHOWN when the IME is actually shown.

This CL also updates NavigationBarTest to verify those flags.

Bug: 192412909
Bug: 217755059
Test: atest SystemUITests:NavigationBarTest
Change-Id: I8bdd58d040689953072c7f384ece2bca677265e1
parent fbd689e9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -180,6 +180,8 @@ public class StatusBarManager {
    public static final int NAVIGATION_HINT_BACK_ALT      = 1 << 0;
    /** @hide */
    public static final int NAVIGATION_HINT_IME_SHOWN     = 1 << 1;
    /** @hide */
    public static final int NAVIGATION_HINT_IME_SWITCHER_SHOWN = 1 << 2;

    /** @hide */
    public static final int WINDOW_STATUS_BAR = 1;
+2 −2
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ final class NavigationBarController {
                    // TODO(b/213337792): Set NAVIGATION_HINT_IME_SHOWN only when necessary.
                    final int hints = StatusBarManager.NAVIGATION_HINT_BACK_ALT
                            | (mShouldShowImeSwitcherWhenImeIsShown
                                    ? StatusBarManager.NAVIGATION_HINT_IME_SHOWN
                                    ? StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_SHOWN
                                    : 0);
                    navigationBarView.setNavigationIconHints(hints);
                }
@@ -470,7 +470,7 @@ final class NavigationBarController {
            }
            final int hints = StatusBarManager.NAVIGATION_HINT_BACK_ALT
                    | (shouldShowImeSwitcherWhenImeIsShown
                    ? StatusBarManager.NAVIGATION_HINT_IME_SHOWN : 0);
                    ? StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_SHOWN : 0);
            navigationBarView.setNavigationIconHints(hints);
        }

+1 −1
Original line number Diff line number Diff line
@@ -270,7 +270,7 @@ public final class NavigationBarView extends FrameLayout {

        // Update IME button visibility, a11y and rotate button always overrides the appearance
        final boolean imeSwitcherVisible =
                (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0;
                (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_SHOWN) != 0;
        getImeSwitchButton().setVisibility(imeSwitcherVisible ? View.VISIBLE : View.INVISIBLE);

        getBackButton().setVisibility(View.VISIBLE);
+7 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.shared.recents.utilities;

import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_ALT;
import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SHOWN;
import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_SHOWN;

import android.annotation.TargetApi;
import android.content.Context;
@@ -110,11 +111,16 @@ public class Utilities {
                hints &= ~NAVIGATION_HINT_BACK_ALT;
                break;
        }
        if (showImeSwitcher) {
        if (imeShown) {
            hints |= NAVIGATION_HINT_IME_SHOWN;
        } else {
            hints &= ~NAVIGATION_HINT_IME_SHOWN;
        }
        if (showImeSwitcher) {
            hints |= NAVIGATION_HINT_IME_SWITCHER_SHOWN;
        } else {
            hints &= ~NAVIGATION_HINT_IME_SWITCHER_SHOWN;
        }

        return hints;
    }
+2 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package com.android.systemui.navigationbar;

import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_ALT;
import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SHOWN;
import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_SHOWN;
import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN;
import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
import static android.app.StatusBarManager.WindowType;
@@ -1410,7 +1410,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
                .setFlag(SYSUI_STATE_IME_SHOWING,
                        (mNavigationIconHints & NAVIGATION_HINT_BACK_ALT) != 0)
                .setFlag(SYSUI_STATE_IME_SWITCHER_SHOWING,
                        (mNavigationIconHints & NAVIGATION_HINT_IME_SHOWN) != 0)
                        (mNavigationIconHints & NAVIGATION_HINT_IME_SWITCHER_SHOWN) != 0)
                .setFlag(SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY,
                        allowSystemGestureIgnoringBarVisibility())
                .commitUpdate(mDisplayId);
Loading