summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Cosmin Băieș <cosminbaies@google.com> 2025-01-17 18:02:55 +0100
committer Cosmin Băieș <cosminbaies@google.com> 2025-01-27 17:45:24 +0100
commit4c3eb11709aa755f9235092c8101561238a49ee9 (patch)
treeda547969ca2407ef399fac873d807ea088e20159
parentad315253fd5452c63f31f5612b7bb061b9393767 (diff)
Rename navigation icon hints to NavbarFlags
The navigation icon hints flags were originally added in [1], with only the BACK_ALT flag remaining after [2]. Later, the IME visibility and IME Switcher button visiblity were added for convenience next to this flag, maintaining the same prefix. However, it is not clear what they hint to, and they are not related to navigation icons (or even buttons) in general, but rather to general navigation bar state. While this is currently only updated from IME state, more flags could be added in the future, so the IntDef should be general enough to allow this. [1]: Ie64369e3df3178178f35b56763ea96d380b6ddd4 [2]: Ifd1f8c9f400d90542f0ca858b9a4deacabbd518a Flag: EXEMPT refactor Bug: 366129400 Test: n/a Change-Id: I6ec807230f7beb9a9001ec7da08564c7cf1a59ec
-rw-r--r--core/java/android/app/StatusBarManager.java36
-rw-r--r--core/java/android/inputmethodservice/NavigationBarController.java22
-rw-r--r--core/java/android/inputmethodservice/navigationbar/NavigationBarView.java32
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/navigationbar/views/NavigationBarTest.java72
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java34
-rw-r--r--packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java32
-rw-r--r--packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java59
-rw-r--r--packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBarView.java31
8 files changed, 151 insertions, 167 deletions
diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java
index e030c6c12b4c..01868cc601fe 100644
--- a/core/java/android/app/StatusBarManager.java
+++ b/core/java/android/app/StatusBarManager.java
@@ -205,31 +205,31 @@ public class StatusBarManager {
*
* @hide
*/
- public static final int NAVIGATION_HINT_BACK_DISMISS_IME = 1 << 0;
+ public static final int NAVBAR_BACK_DISMISS_IME = 1 << 0;
/**
* The IME is visible.
*
* @hide
*/
- public static final int NAVIGATION_HINT_IME_VISIBLE = 1 << 1;
+ public static final int NAVBAR_IME_VISIBLE = 1 << 1;
/**
* The IME Switcher button is visible. This only takes effect while the IME is visible.
*
* @hide
*/
- public static final int NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE = 1 << 2;
+ public static final int NAVBAR_IME_SWITCHER_BUTTON_VISIBLE = 1 << 2;
/**
- * Navigation bar flags related to the IME state.
+ * Navigation bar state flags.
*
* @hide
*/
- @IntDef(flag = true, prefix = { "NAVIGATION_HINT_" }, value = {
- NAVIGATION_HINT_BACK_DISMISS_IME,
- NAVIGATION_HINT_IME_VISIBLE,
- NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE,
+ @IntDef(flag = true, prefix = { "NAVBAR_" }, value = {
+ NAVBAR_BACK_DISMISS_IME,
+ NAVBAR_IME_VISIBLE,
+ NAVBAR_IME_SWITCHER_BUTTON_VISIBLE,
})
@Retention(RetentionPolicy.SOURCE)
- public @interface NavigationHint {}
+ public @interface NavbarFlags {}
/** @hide */
public static final int WINDOW_STATUS_BAR = 1;
@@ -1355,18 +1355,18 @@ public class StatusBarManager {
/** @hide */
@NonNull
- public static String navigationHintsToString(@NavigationHint int hints) {
- final var hintStrings = new ArrayList<String>();
- if ((hints & NAVIGATION_HINT_BACK_DISMISS_IME) != 0) {
- hintStrings.add("NAVIGATION_HINT_BACK_DISMISS_IME");
+ public static String navbarFlagsToString(@NavbarFlags int flags) {
+ final var flagStrings = new ArrayList<String>();
+ if ((flags & NAVBAR_BACK_DISMISS_IME) != 0) {
+ flagStrings.add("NAVBAR_BACK_DISMISS_IME");
}
- if ((hints & NAVIGATION_HINT_IME_VISIBLE) != 0) {
- hintStrings.add("NAVIGATION_HINT_IME_VISIBLE");
+ if ((flags & NAVBAR_IME_VISIBLE) != 0) {
+ flagStrings.add("NAVBAR_IME_VISIBLE");
}
- if ((hints & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0) {
- hintStrings.add("NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE");
+ if ((flags & NAVBAR_IME_SWITCHER_BUTTON_VISIBLE) != 0) {
+ flagStrings.add("NAVBAR_IME_SWITCHER_BUTTON_VISIBLE");
}
- return String.join(" | ", hintStrings);
+ return String.join(" | ", flagStrings);
}
/** @hide */
diff --git a/core/java/android/inputmethodservice/NavigationBarController.java b/core/java/android/inputmethodservice/NavigationBarController.java
index 13352d716ffa..f420b5d7b886 100644
--- a/core/java/android/inputmethodservice/NavigationBarController.java
+++ b/core/java/android/inputmethodservice/NavigationBarController.java
@@ -16,9 +16,9 @@
package android.inputmethodservice;
-import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME;
-import static android.app.StatusBarManager.NAVIGATION_HINT_IME_VISIBLE;
-import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE;
+import static android.app.StatusBarManager.NAVBAR_BACK_DISMISS_IME;
+import static android.app.StatusBarManager.NAVBAR_IME_SWITCHER_BUTTON_VISIBLE;
+import static android.app.StatusBarManager.NAVBAR_IME_VISIBLE;
import static android.view.WindowInsets.Type.captionBar;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS;
@@ -242,11 +242,11 @@ final class NavigationBarController {
NavigationBarView.class::isInstance);
if (navigationBarView != null) {
// TODO(b/213337792): Support InputMethodService#setBackDisposition().
- // TODO(b/213337792): Set NAVIGATION_HINT_IME_VISIBLE only when necessary.
- final int hints = NAVIGATION_HINT_BACK_DISMISS_IME | NAVIGATION_HINT_IME_VISIBLE
+ // TODO(b/213337792): Set NAVBAR_IME_VISIBLE only when necessary.
+ final int flags = NAVBAR_BACK_DISMISS_IME | NAVBAR_IME_VISIBLE
| (mShouldShowImeSwitcherWhenImeIsShown
- ? NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE : 0);
- navigationBarView.setNavigationIconHints(hints);
+ ? NAVBAR_IME_SWITCHER_BUTTON_VISIBLE : 0);
+ navigationBarView.setNavbarFlags(flags);
navigationBarView.prepareNavButtons(this);
}
} else {
@@ -515,11 +515,11 @@ final class NavigationBarController {
NavigationBarView.class::isInstance);
if (navigationBarView != null) {
// TODO(b/213337792): Support InputMethodService#setBackDisposition().
- // TODO(b/213337792): Set NAVIGATION_HINT_IME_VISIBLE only when necessary.
- final int hints = NAVIGATION_HINT_BACK_DISMISS_IME | NAVIGATION_HINT_IME_VISIBLE
+ // TODO(b/213337792): Set NAVBAR_IME_VISIBLE only when necessary.
+ final int flags = NAVBAR_BACK_DISMISS_IME | NAVBAR_IME_VISIBLE
| (mShouldShowImeSwitcherWhenImeIsShown
- ? NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE : 0);
- navigationBarView.setNavigationIconHints(hints);
+ ? NAVBAR_IME_SWITCHER_BUTTON_VISIBLE : 0);
+ navigationBarView.setNavbarFlags(flags);
}
} else {
uninstallNavigationBarFrameIfNecessary();
diff --git a/core/java/android/inputmethodservice/navigationbar/NavigationBarView.java b/core/java/android/inputmethodservice/navigationbar/NavigationBarView.java
index 4be98c46300d..960a5b33434a 100644
--- a/core/java/android/inputmethodservice/navigationbar/NavigationBarView.java
+++ b/core/java/android/inputmethodservice/navigationbar/NavigationBarView.java
@@ -16,8 +16,8 @@
package android.inputmethodservice.navigationbar;
-import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME;
-import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE;
+import static android.app.StatusBarManager.NAVBAR_BACK_DISMISS_IME;
+import static android.app.StatusBarManager.NAVBAR_IME_SWITCHER_BUTTON_VISIBLE;
import static android.inputmethodservice.navigationbar.NavigationBarConstants.DARK_MODE_ICON_COLOR_SINGLE_TONE;
import static android.inputmethodservice.navigationbar.NavigationBarConstants.LIGHT_MODE_ICON_COLOR_SINGLE_TONE;
import static android.inputmethodservice.navigationbar.NavigationBarConstants.NAVBAR_BACK_BUTTON_IME_OFFSET;
@@ -30,7 +30,7 @@ import android.annotation.DrawableRes;
import android.annotation.FloatRange;
import android.annotation.NonNull;
import android.app.StatusBarManager;
-import android.app.StatusBarManager.NavigationHint;
+import android.app.StatusBarManager.NavbarFlags;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Canvas;
@@ -66,8 +66,8 @@ public final class NavigationBarView extends FrameLayout {
private int mCurrentRotation = -1;
int mDisabledFlags = 0;
- @NavigationHint
- private int mNavigationIconHints = 0;
+ @NavbarFlags
+ private int mNavbarFlags;
private final int mNavBarMode = NAV_BAR_MODE_GESTURAL;
private KeyButtonDrawable mBackIcon;
@@ -245,8 +245,7 @@ public final class NavigationBarView extends FrameLayout {
}
private void orientBackButton(KeyButtonDrawable drawable) {
- final boolean isBackDismissIme =
- (mNavigationIconHints & NAVIGATION_HINT_BACK_DISMISS_IME) != 0;
+ final boolean isBackDismissIme = (mNavbarFlags & NAVBAR_BACK_DISMISS_IME) != 0;
final boolean isRtl = mConfiguration.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
float degrees = isBackDismissIme ? (isRtl ? 90 : -90) : 0;
if (drawable.getRotation() == degrees) {
@@ -284,27 +283,26 @@ public final class NavigationBarView extends FrameLayout {
}
/**
- * Updates the navigation icons based on {@code hints}.
+ * Sets the navigation bar state flags.
*
- * @param hints bit flags defined in {@link StatusBarManager}.
+ * @param flags the navigation bar state flags.
*/
- public void setNavigationIconHints(@NavigationHint int hints) {
- if (hints == mNavigationIconHints) {
+ public void setNavbarFlags(@NavbarFlags int flags) {
+ if (flags == mNavbarFlags) {
return;
}
- final boolean backDismissIme =
- (hints & StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME) != 0;
+ final boolean backDismissIme = (flags & StatusBarManager.NAVBAR_BACK_DISMISS_IME) != 0;
final boolean oldBackDismissIme =
- (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME) != 0;
+ (mNavbarFlags & StatusBarManager.NAVBAR_BACK_DISMISS_IME) != 0;
if (backDismissIme != oldBackDismissIme) {
//onBackDismissImeChanged(backDismissIme);
}
if (DEBUG) {
- android.widget.Toast.makeText(getContext(), "Navigation icon hints = " + hints, 500)
+ android.widget.Toast.makeText(getContext(), "Navbar flags = " + flags, 500)
.show();
}
- mNavigationIconHints = hints;
+ mNavbarFlags = flags;
updateNavButtonIcons();
}
@@ -321,7 +319,7 @@ public final class NavigationBarView extends FrameLayout {
// Update IME switcher button visibility, a11y and rotate button always overrides
// the appearance.
final boolean isImeSwitcherButtonVisible =
- (mNavigationIconHints & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0;
+ (mNavbarFlags & NAVBAR_IME_SWITCHER_BUTTON_VISIBLE) != 0;
getImeSwitchButton()
.setVisibility(isImeSwitcherButtonVisible ? View.VISIBLE : View.INVISIBLE);
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/navigationbar/views/NavigationBarTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/navigationbar/views/NavigationBarTest.java
index 17a1c27b029b..b7845b73b416 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/navigationbar/views/NavigationBarTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/navigationbar/views/NavigationBarTest.java
@@ -16,9 +16,9 @@
package com.android.systemui.navigationbar.views;
-import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME;
-import static android.app.StatusBarManager.NAVIGATION_HINT_IME_VISIBLE;
-import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE;
+import static android.app.StatusBarManager.NAVBAR_BACK_DISMISS_IME;
+import static android.app.StatusBarManager.NAVBAR_IME_SWITCHER_BUTTON_VISIBLE;
+import static android.app.StatusBarManager.NAVBAR_IME_VISIBLE;
import static android.inputmethodservice.InputMethodService.BACK_DISPOSITION_ADJUST_NOTHING;
import static android.inputmethodservice.InputMethodService.BACK_DISPOSITION_DEFAULT;
import static android.inputmethodservice.InputMethodService.IME_VISIBLE;
@@ -32,8 +32,8 @@ import static com.android.systemui.navigationbar.views.NavigationBar.NavBarActio
import static com.android.systemui.navigationbar.views.buttons.KeyButtonView.NavBarButtonEvent.NAVBAR_IME_SWITCHER_BUTTON_LONGPRESS;
import static com.android.systemui.navigationbar.views.buttons.KeyButtonView.NavBarButtonEvent.NAVBAR_IME_SWITCHER_BUTTON_TAP;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISMISS_IME;
-import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_VISIBLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_VISIBLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
import static com.google.common.truth.Truth.assertThat;
@@ -569,31 +569,27 @@ public class NavigationBarTest extends SysuiTestCase {
externalNavBar.init();
defaultNavBar.setImeWindowStatus(DEFAULT_DISPLAY, IME_VISIBLE,
- BACK_DISPOSITION_DEFAULT, true);
+ BACK_DISPOSITION_DEFAULT, true /* showImeSwitcher */);
// Verify IME window state will be updated in default NavBar & external NavBar state reset.
- assertEquals(NAVIGATION_HINT_BACK_DISMISS_IME | NAVIGATION_HINT_IME_VISIBLE
- | NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE,
- defaultNavBar.getNavigationIconHints());
- assertFalse((externalNavBar.getNavigationIconHints()
- & NAVIGATION_HINT_BACK_DISMISS_IME) != 0);
- assertFalse((externalNavBar.getNavigationIconHints() & NAVIGATION_HINT_IME_VISIBLE) != 0);
- assertFalse((externalNavBar.getNavigationIconHints()
- & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0);
+ assertEquals(NAVBAR_BACK_DISMISS_IME | NAVBAR_IME_VISIBLE
+ | NAVBAR_IME_SWITCHER_BUTTON_VISIBLE,
+ defaultNavBar.getNavbarFlags());
+ assertFalse((externalNavBar.getNavbarFlags() & NAVBAR_BACK_DISMISS_IME) != 0);
+ assertFalse((externalNavBar.getNavbarFlags() & NAVBAR_IME_VISIBLE) != 0);
+ assertFalse((externalNavBar.getNavbarFlags() & NAVBAR_IME_SWITCHER_BUTTON_VISIBLE) != 0);
externalNavBar.setImeWindowStatus(EXTERNAL_DISPLAY_ID, IME_VISIBLE,
- BACK_DISPOSITION_DEFAULT, true);
+ BACK_DISPOSITION_DEFAULT, true /* showImeSwitcher */);
defaultNavBar.setImeWindowStatus(DEFAULT_DISPLAY, 0 /* vis */,
- BACK_DISPOSITION_DEFAULT, false);
+ BACK_DISPOSITION_DEFAULT, false /* showImeSwitcher */);
// Verify IME window state will be updated in external NavBar & default NavBar state reset.
- assertEquals(NAVIGATION_HINT_BACK_DISMISS_IME | NAVIGATION_HINT_IME_VISIBLE
- | NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE,
- externalNavBar.getNavigationIconHints());
- assertFalse((defaultNavBar.getNavigationIconHints()
- & NAVIGATION_HINT_BACK_DISMISS_IME) != 0);
- assertFalse((defaultNavBar.getNavigationIconHints() & NAVIGATION_HINT_IME_VISIBLE) != 0);
- assertFalse((defaultNavBar.getNavigationIconHints()
- & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0);
+ assertEquals(NAVBAR_BACK_DISMISS_IME | NAVBAR_IME_VISIBLE
+ | NAVBAR_IME_SWITCHER_BUTTON_VISIBLE,
+ externalNavBar.getNavbarFlags());
+ assertFalse((defaultNavBar.getNavbarFlags() & NAVBAR_BACK_DISMISS_IME) != 0);
+ assertFalse((defaultNavBar.getNavbarFlags() & NAVBAR_IME_VISIBLE) != 0);
+ assertFalse((defaultNavBar.getNavbarFlags() & NAVBAR_IME_SWITCHER_BUTTON_VISIBLE) != 0);
}
@Test
@@ -608,35 +604,29 @@ public class NavigationBarTest extends SysuiTestCase {
// Verify navbar altered back icon when an app is showing IME
mNavigationBar.setImeWindowStatus(DEFAULT_DISPLAY, IME_VISIBLE,
- BACK_DISPOSITION_DEFAULT, true);
- assertTrue((mNavigationBar.getNavigationIconHints()
- & NAVIGATION_HINT_BACK_DISMISS_IME) != 0);
- assertTrue((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_IME_VISIBLE) != 0);
- assertTrue((mNavigationBar.getNavigationIconHints()
- & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0);
+ BACK_DISPOSITION_DEFAULT, true /* showImeSwitcher */);
+ assertTrue((mNavigationBar.getNavbarFlags() & NAVBAR_BACK_DISMISS_IME) != 0);
+ assertTrue((mNavigationBar.getNavbarFlags() & NAVBAR_IME_VISIBLE) != 0);
+ assertTrue((mNavigationBar.getNavbarFlags() & NAVBAR_IME_SWITCHER_BUTTON_VISIBLE) != 0);
// Verify navbar didn't alter and showing back icon when the keyguard is showing without
// requesting IME insets visible.
doReturn(true).when(mKeyguardStateController).isShowing();
mNavigationBar.setImeWindowStatus(DEFAULT_DISPLAY, IME_VISIBLE,
- BACK_DISPOSITION_DEFAULT, true);
- assertFalse((mNavigationBar.getNavigationIconHints()
- & NAVIGATION_HINT_BACK_DISMISS_IME) != 0);
- assertFalse((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_IME_VISIBLE) != 0);
- assertFalse((mNavigationBar.getNavigationIconHints()
- & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0);
+ BACK_DISPOSITION_DEFAULT, true /* showImeSwitcher */);
+ assertFalse((mNavigationBar.getNavbarFlags() & NAVBAR_BACK_DISMISS_IME) != 0);
+ assertFalse((mNavigationBar.getNavbarFlags() & NAVBAR_IME_VISIBLE) != 0);
+ assertFalse((mNavigationBar.getNavbarFlags() & NAVBAR_IME_SWITCHER_BUTTON_VISIBLE) != 0);
// Verify navbar altered and showing back icon when the keyguard is showing and
// requesting IME insets visible.
windowInsets = new WindowInsets.Builder().setVisible(ime(), true).build();
doReturn(windowInsets).when(mockShadeWindowView).getRootWindowInsets();
mNavigationBar.setImeWindowStatus(DEFAULT_DISPLAY, IME_VISIBLE,
- BACK_DISPOSITION_DEFAULT, true);
- assertTrue((mNavigationBar.getNavigationIconHints()
- & NAVIGATION_HINT_BACK_DISMISS_IME) != 0);
- assertTrue((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_IME_VISIBLE) != 0);
- assertTrue((mNavigationBar.getNavigationIconHints()
- & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0);
+ BACK_DISPOSITION_DEFAULT, true /* showImeSwitcher */);
+ assertTrue((mNavigationBar.getNavbarFlags() & NAVBAR_BACK_DISMISS_IME) != 0);
+ assertTrue((mNavigationBar.getNavbarFlags() & NAVBAR_IME_VISIBLE) != 0);
+ assertTrue((mNavigationBar.getNavbarFlags() & NAVBAR_IME_SWITCHER_BUTTON_VISIBLE) != 0);
}
@Test
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java
index efe758ea0011..9ebb15f43307 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java
@@ -16,12 +16,12 @@
package com.android.systemui.shared.recents.utilities;
-import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME;
-import static android.app.StatusBarManager.NAVIGATION_HINT_IME_VISIBLE;
-import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE;
+import static android.app.StatusBarManager.NAVBAR_BACK_DISMISS_IME;
+import static android.app.StatusBarManager.NAVBAR_IME_SWITCHER_BUTTON_VISIBLE;
+import static android.app.StatusBarManager.NAVBAR_IME_VISIBLE;
import android.annotation.TargetApi;
-import android.app.StatusBarManager.NavigationHint;
+import android.app.StatusBarManager.NavbarFlags;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
@@ -104,46 +104,46 @@ public class Utilities {
}
/**
- * Gets the updated navigation icon hints, based on the current ones and the given IME state.
+ * Updates the navigation bar state flags with the given IME state.
*
- * @param oldHints current navigation icon hints.
+ * @param oldFlags current navigation bar state flags.
* @param backDisposition the IME back disposition mode. Only takes effect if
* {@code isImeVisible} is {@code true}.
* @param isImeVisible whether the IME is currently visible.
* @param showImeSwitcher whether the IME Switcher button should be shown. Only takes effect if
* {@code isImeVisible} is {@code true}.
*/
- @NavigationHint
- public static int calculateNavigationIconHints(@NavigationHint int oldHints,
+ @NavbarFlags
+ public static int updateNavbarFlagsFromIme(@NavbarFlags int oldFlags,
@BackDispositionMode int backDisposition, boolean isImeVisible,
boolean showImeSwitcher) {
- int hints = oldHints;
+ int flags = oldFlags;
switch (backDisposition) {
case InputMethodService.BACK_DISPOSITION_DEFAULT:
case InputMethodService.BACK_DISPOSITION_WILL_NOT_DISMISS:
case InputMethodService.BACK_DISPOSITION_WILL_DISMISS:
if (isImeVisible) {
- hints |= NAVIGATION_HINT_BACK_DISMISS_IME;
+ flags |= NAVBAR_BACK_DISMISS_IME;
} else {
- hints &= ~NAVIGATION_HINT_BACK_DISMISS_IME;
+ flags &= ~NAVBAR_BACK_DISMISS_IME;
}
break;
case InputMethodService.BACK_DISPOSITION_ADJUST_NOTHING:
- hints &= ~NAVIGATION_HINT_BACK_DISMISS_IME;
+ flags &= ~NAVBAR_BACK_DISMISS_IME;
break;
}
if (isImeVisible) {
- hints |= NAVIGATION_HINT_IME_VISIBLE;
+ flags |= NAVBAR_IME_VISIBLE;
} else {
- hints &= ~NAVIGATION_HINT_IME_VISIBLE;
+ flags &= ~NAVBAR_IME_VISIBLE;
}
if (showImeSwitcher && isImeVisible) {
- hints |= NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE;
+ flags |= NAVBAR_IME_SWITCHER_BUTTON_VISIBLE;
} else {
- hints &= ~NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE;
+ flags &= ~NAVBAR_IME_SWITCHER_BUTTON_VISIBLE;
}
- return hints;
+ return flags;
}
/** @return whether or not {@param context} represents that of a large screen device or not */
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java b/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java
index de35dd7b52b6..c35a5a96b98c 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java
@@ -17,9 +17,9 @@
package com.android.systemui.navigationbar;
import static android.app.ActivityManager.LOCK_TASK_MODE_PINNED;
-import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME;
-import static android.app.StatusBarManager.NAVIGATION_HINT_IME_VISIBLE;
-import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE;
+import static android.app.StatusBarManager.NAVBAR_BACK_DISMISS_IME;
+import static android.app.StatusBarManager.NAVBAR_IME_SWITCHER_BUTTON_VISIBLE;
+import static android.app.StatusBarManager.NAVBAR_IME_VISIBLE;
import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
@@ -30,16 +30,16 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISABLED;
-import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISMISS_IME;
-import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_VISIBLE;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_VISIBLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
import android.app.StatusBarManager;
-import android.app.StatusBarManager.NavigationHint;
+import android.app.StatusBarManager.NavbarFlags;
import android.app.StatusBarManager.WindowVisibleState;
import android.content.Context;
import android.graphics.Rect;
@@ -114,8 +114,8 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
private TaskStackChangeListeners mTaskStackChangeListeners;
private Optional<Pip> mPipOptional;
private int mDefaultDisplayId;
- @NavigationHint
- private int mNavigationIconHints;
+ @NavbarFlags
+ private int mNavbarFlags;
private final NavBarHelper.NavbarTaskbarStateUpdater mNavbarTaskbarStateUpdater =
new NavBarHelper.NavbarTaskbarStateUpdater() {
@Override
@@ -379,11 +379,11 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
mSysUiState.setFlag(SYSUI_STATE_A11Y_BUTTON_CLICKABLE, clickable)
.setFlag(SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE, longClickable)
.setFlag(SYSUI_STATE_IME_VISIBLE,
- (mNavigationIconHints & NAVIGATION_HINT_IME_VISIBLE) != 0)
+ (mNavbarFlags & NAVBAR_IME_VISIBLE) != 0)
.setFlag(SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE,
- (mNavigationIconHints & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0)
+ (mNavbarFlags & NAVBAR_IME_SWITCHER_BUTTON_VISIBLE) != 0)
.setFlag(SYSUI_STATE_BACK_DISMISS_IME,
- (mNavigationIconHints & NAVIGATION_HINT_BACK_DISMISS_IME) != 0)
+ (mNavbarFlags & NAVBAR_BACK_DISMISS_IME) != 0)
.setFlag(SYSUI_STATE_OVERVIEW_DISABLED,
(mDisabledFlags & View.STATUS_BAR_DISABLE_RECENT) != 0)
.setFlag(SYSUI_STATE_HOME_DISABLED,
@@ -506,13 +506,13 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
// Count imperceptible changes as visible so we transition taskbar out quickly.
final boolean isImeVisible = mNavBarHelper.isImeVisible(vis)
|| (vis & InputMethodService.IME_VISIBLE_IMPERCEPTIBLE) != 0;
- final int hints = Utilities.calculateNavigationIconHints(mNavigationIconHints,
- backDisposition, isImeVisible, showImeSwitcher);
- if (hints == mNavigationIconHints) {
+ final int flags = Utilities.updateNavbarFlagsFromIme(mNavbarFlags, backDisposition,
+ isImeVisible, showImeSwitcher);
+ if (flags == mNavbarFlags) {
return;
}
- mNavigationIconHints = hints;
+ mNavbarFlags = flags;
updateSysuiFlags();
}
@@ -707,7 +707,7 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
@Override
public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
pw.println("TaskbarDelegate (mDefaultDisplayId=" + mDefaultDisplayId + "):");
- pw.println(" mNavigationIconHints=" + mNavigationIconHints);
+ pw.println(" mNavbarFlags=" + mNavbarFlags);
pw.println(" mNavigationMode=" + mNavigationMode);
pw.println(" mDisabledFlags=" + mDisabledFlags);
pw.println(" mTaskBarWindowState=" + mTaskBarWindowState);
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java
index f1fe2802286c..692b1f341c94 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java
@@ -17,14 +17,14 @@
package com.android.systemui.navigationbar.views;
import static android.app.ActivityManager.LOCK_TASK_MODE_PINNED;
-import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME;
-import static android.app.StatusBarManager.NAVIGATION_HINT_IME_VISIBLE;
-import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE;
+import static android.app.StatusBarManager.NAVBAR_BACK_DISMISS_IME;
+import static android.app.StatusBarManager.NAVBAR_IME_SWITCHER_BUTTON_VISIBLE;
+import static android.app.StatusBarManager.NAVBAR_IME_VISIBLE;
import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN;
import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
import static android.app.StatusBarManager.WindowType;
import static android.app.StatusBarManager.WindowVisibleState;
-import static android.app.StatusBarManager.navigationHintsToString;
+import static android.app.StatusBarManager.navbarFlagsToString;
import static android.app.StatusBarManager.windowStateToString;
import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
import static android.view.InsetsSource.FLAG_SUPPRESS_SCRIM;
@@ -45,8 +45,8 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISMISS_IME;
-import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_VISIBLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_VISIBLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
import static com.android.systemui.shared.system.QuickStepContract.isGesturalMode;
@@ -59,7 +59,7 @@ import android.annotation.NonNull;
import android.app.ActivityTaskManager;
import android.app.IActivityTaskManager;
import android.app.StatusBarManager;
-import android.app.StatusBarManager.NavigationHint;
+import android.app.StatusBarManager.NavbarFlags;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Insets;
@@ -237,8 +237,8 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
private @WindowVisibleState int mNavigationBarWindowState = WINDOW_STATE_SHOWING;
- @NavigationHint
- private int mNavigationIconHints = 0;
+ @NavbarFlags
+ private int mNavbarFlags;
private @TransitionMode int mTransitionMode;
private boolean mLongPressHomeEnabled;
@@ -1115,7 +1115,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
pw.println(" mLongPressHomeEnabled=" + mLongPressHomeEnabled);
pw.println(" mNavigationBarWindowState="
+ windowStateToString(mNavigationBarWindowState));
- pw.println(" mNavigationIconHints=" + navigationHintsToString(mNavigationIconHints));
+ pw.println(" mNavbarFlags=" + navbarFlagsToString(mNavbarFlags));
pw.println(" mTransitionMode="
+ BarTransitions.modeToString(mTransitionMode));
pw.println(" mTransientShown=" + mTransientShown);
@@ -1141,13 +1141,13 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
return;
}
final boolean isImeVisible = mNavBarHelper.isImeVisible(vis);
- final int hints = Utilities.calculateNavigationIconHints(mNavigationIconHints,
- backDisposition, isImeVisible, showImeSwitcher);
- if (hints == mNavigationIconHints) {
+ final int flags = Utilities.updateNavbarFlagsFromIme(mNavbarFlags, backDisposition,
+ isImeVisible, showImeSwitcher);
+ if (flags == mNavbarFlags) {
return;
}
- setNavigationIconHints(hints);
+ setNavbarFlags(flags);
checkBarModes();
updateSystemUiStateFlags();
}
@@ -1687,11 +1687,11 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
.setFlag(SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE, longClickable)
.setFlag(SYSUI_STATE_NAV_BAR_HIDDEN, !isNavBarWindowVisible())
.setFlag(SYSUI_STATE_IME_VISIBLE,
- (mNavigationIconHints & NAVIGATION_HINT_IME_VISIBLE) != 0)
+ (mNavbarFlags & NAVBAR_IME_VISIBLE) != 0)
.setFlag(SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE,
- (mNavigationIconHints & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0)
+ (mNavbarFlags & NAVBAR_IME_SWITCHER_BUTTON_VISIBLE) != 0)
.setFlag(SYSUI_STATE_BACK_DISMISS_IME,
- (mNavigationIconHints & NAVIGATION_HINT_BACK_DISMISS_IME) != 0)
+ (mNavbarFlags & NAVBAR_BACK_DISMISS_IME) != 0)
.setFlag(SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY,
allowSystemGestureIgnoringBarVisibility())
.commitUpdate(mDisplayId);
@@ -1934,38 +1934,37 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
};
@VisibleForTesting
- @NavigationHint
- int getNavigationIconHints() {
- return mNavigationIconHints;
+ @NavbarFlags
+ int getNavbarFlags() {
+ return mNavbarFlags;
}
/**
- * Updates the navigation icons based on {@code hints}.
+ * Sets the navigation bar state flags.
*
- * @param hints bit flags defined in {@link StatusBarManager}.
+ * @param flags the navigation bar state flags.
*/
- private void setNavigationIconHints(@NavigationHint int hints) {
- if (hints == mNavigationIconHints) {
+ private void setNavbarFlags(@NavbarFlags int flags) {
+ if (flags == mNavbarFlags) {
return;
}
if (!isLargeScreen(mContext)) {
// All IME functions handled by launcher via Sysui flags for large screen
- final boolean backDismissIme =
- (hints & StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME) != 0;
+ final boolean backDismissIme = (flags & StatusBarManager.NAVBAR_BACK_DISMISS_IME) != 0;
final boolean oldBackDismissIme =
- (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME) != 0;
+ (mNavbarFlags & StatusBarManager.NAVBAR_BACK_DISMISS_IME) != 0;
if (backDismissIme != oldBackDismissIme) {
mView.onBackDismissImeChanged(backDismissIme);
}
- mImeVisible = (hints & NAVIGATION_HINT_IME_VISIBLE) != 0;
+ mImeVisible = (flags & NAVBAR_IME_VISIBLE) != 0;
- mView.setNavigationIconHints(hints);
+ mView.setNavbarFlags(flags);
}
if (DEBUG) {
- android.widget.Toast.makeText(mContext, "Navigation icon hints = " + hints, 500)
+ android.widget.Toast.makeText(mContext, "Navbar flags = " + flags, 500)
.show();
}
- mNavigationIconHints = hints;
+ mNavbarFlags = flags;
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBarView.java
index 38f2d42c8869..21366847bc84 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBarView.java
@@ -16,9 +16,9 @@
package com.android.systemui.navigationbar.views;
-import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME;
-import static android.app.StatusBarManager.NAVIGATION_HINT_IME_VISIBLE;
-import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE;
+import static android.app.StatusBarManager.NAVBAR_BACK_DISMISS_IME;
+import static android.app.StatusBarManager.NAVBAR_IME_SWITCHER_BUTTON_VISIBLE;
+import static android.app.StatusBarManager.NAVBAR_IME_VISIBLE;
import static android.inputmethodservice.InputMethodService.canImeRenderGesturalNavButtons;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
@@ -34,7 +34,7 @@ import android.animation.PropertyValuesHolder;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.annotation.DrawableRes;
-import android.app.StatusBarManager.NavigationHint;
+import android.app.StatusBarManager.NavbarFlags;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Canvas;
@@ -116,8 +116,8 @@ public class NavigationBarView extends FrameLayout {
boolean mLongClickableAccessibilityButton;
int mDisabledFlags = 0;
- @NavigationHint
- int mNavigationIconHints = 0;
+ @NavbarFlags
+ private int mNavbarFlags;
private int mNavBarMode;
private boolean mImeDrawsImeNavBar;
@@ -507,8 +507,7 @@ public class NavigationBarView extends FrameLayout {
}
private void orientBackButton(KeyButtonDrawable drawable) {
- final boolean isBackDismissIme =
- (mNavigationIconHints & NAVIGATION_HINT_BACK_DISMISS_IME) != 0;
+ final boolean isBackDismissIme = (mNavbarFlags & NAVBAR_BACK_DISMISS_IME) != 0;
final boolean isRtl = mConfiguration.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
float degrees = isBackDismissIme ? (isRtl ? 90 : -90) : 0;
if (drawable.getRotation() == degrees) {
@@ -563,11 +562,11 @@ public class NavigationBarView extends FrameLayout {
super.setLayoutDirection(layoutDirection);
}
- void setNavigationIconHints(@NavigationHint int hints) {
- if (hints == mNavigationIconHints) {
+ void setNavbarFlags(@NavbarFlags int flags) {
+ if (flags == mNavbarFlags) {
return;
}
- mNavigationIconHints = hints;
+ mNavbarFlags = flags;
updateNavButtonIcons();
}
@@ -605,8 +604,7 @@ public class NavigationBarView extends FrameLayout {
// We have to replace or restore the back and home button icons when exiting or entering
// carmode, respectively. Recents are not available in CarMode in nav bar so change
// to recent icon is not required.
- final boolean isBackDismissIme =
- (mNavigationIconHints & NAVIGATION_HINT_BACK_DISMISS_IME) != 0;
+ final boolean isBackDismissIme = (mNavbarFlags & NAVBAR_BACK_DISMISS_IME) != 0;
KeyButtonDrawable backIcon = mBackIcon;
orientBackButton(backIcon);
KeyButtonDrawable homeIcon = mHomeDefaultIcon;
@@ -621,7 +619,7 @@ public class NavigationBarView extends FrameLayout {
// Update IME switcher button visibility, a11y and rotate button always overrides
// the appearance.
final boolean isImeSwitcherButtonVisible =
- (mNavigationIconHints & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0
+ (mNavbarFlags & NAVBAR_IME_SWITCHER_BUTTON_VISIBLE) != 0
&& !isImeRenderingNavButtons();
mContextualButtonGroup.setButtonVisibility(R.id.ime_switcher, isImeSwitcherButtonVisible);
@@ -675,9 +673,8 @@ public class NavigationBarView extends FrameLayout {
* Returns whether the IME is currently visible and drawing the nav buttons.
*/
boolean isImeRenderingNavButtons() {
- return mImeDrawsImeNavBar
- && mImeCanRenderGesturalNavButtons
- && (mNavigationIconHints & NAVIGATION_HINT_IME_VISIBLE) != 0;
+ return mImeDrawsImeNavBar && mImeCanRenderGesturalNavButtons
+ && (mNavbarFlags & NAVBAR_IME_VISIBLE) != 0;
}
@VisibleForTesting