diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 2cae41ca2a..5860d5897e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -167,6 +167,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT FLAG_NOTIFICATION_SHADE_EXPANDED | FLAG_VOICE_INTERACTION_WINDOW_SHOWING; private static final String NAV_BUTTONS_SEPARATE_WINDOW_TITLE = "Taskbar Nav Buttons"; + private static final String SUW_THEME_SYSTEM_PROPERTY = "setupwizard.theme"; + private static final String GLIF_EXPRESSIVE_THEME = "glif_expressive"; + private static final String GLIF_EXPRESSIVE_LIGHT_THEME = "glif_expressive_light"; private static final double SQUARE_ASPECT_RATIO_BOTTOM_BOUND = 0.95; private static final double SQUARE_ASPECT_RATIO_UPPER_BOUND = 1.05; @@ -278,9 +281,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT if (mContext.isPhoneMode()) { mTaskbarTransitions = new TaskbarTransitions(mContext, mNavButtonsView); } - String SUWTheme = SystemProperties.get("setupwizard.theme", ""); - mIsExpressiveThemeEnabled = SUWTheme.equals("glif_expressive") - || SUWTheme.equals("glif_expressive_light"); + String SUWTheme = SystemProperties.get(SUW_THEME_SYSTEM_PROPERTY, ""); + mIsExpressiveThemeEnabled = SUWTheme.equals(GLIF_EXPRESSIVE_THEME) + || SUWTheme.equals(GLIF_EXPRESSIVE_LIGHT_THEME); } /** @@ -527,6 +530,20 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT navButtonController.onButtonLongClick(BUTTON_SPACE, view)); } + /** + * Method to determine whether the Navigation Bar is viewable in Setup Wizard + * + * @return {@code true} if the device is in Setup Wizard, the expressive theme is enabled, + * and Simple View is NOT enabled + */ + boolean isNavbarHiddenInSUW() { + if (mContext == null) { + return false; + } + return !mContext.isUserSetupComplete() && mIsExpressiveThemeEnabled + && !mContext.isSimpleViewEnabled(); + } + /** * Method to determine whether to show the home button in lockscreen * diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index f0f46771d9..cbe025d5c6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -294,6 +294,10 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba private boolean mIsTaskbarSystemActionRegistered = false; private TaskbarSharedState mTaskbarSharedState; + // Used to mark whether we are in test mode to mark whether the nav bar shows in SUW + @VisibleForTesting + boolean mShouldHideNavbarForTest; + public TaskbarStashController(TaskbarActivityContext activity) { mActivity = activity; mSystemUiProxy = SystemUiProxy.INSTANCE.get(activity); @@ -520,11 +524,14 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba if (supportsVisualStashing() && hasAnyFlag(FLAGS_REPORT_STASHED_INSETS_TO_APP)) { DeviceProfile dp = mActivity.getDeviceProfile(); - if (hasAnyFlag(FLAG_STASHED_IN_APP_SETUP) && (dp.isTaskbarPresent - || mActivity.isPhoneGestureNavMode())) { - // We always show the back button in SUW but in portrait the SUW layout may not - // be wide enough to support overlapping the nav bar with its content. - // We're sending different res values in portrait vs landscape + // If the navigation bar is hidden in SUW, we can draw the SUW content lower so we avoid + // reporting a higher inset + if (hasAnyFlag(FLAG_STASHED_IN_APP_SETUP) + && (dp.isTaskbarPresent || mActivity.isPhoneGestureNavMode()) + && !isNavbarHiddeninSUW()) { + // When we show the back button in SUW, the SUW layout may not be wide enough to + // support overlapping the nav bar with its content in portrait. So we send + // different res values in portrait vs landscape return mActivity.getResources().getDimensionPixelSize(R.dimen.taskbar_suw_insets); } boolean isAnimating = mAnimator != null && mAnimator.isStarted(); @@ -542,6 +549,16 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba return mUnstashedHeight; } + /** + * Returns whether the navigation bar is visible during the Setup Wizard. + * + * {@link #mShouldHideNavbarForTest} is only used by tests + */ + private boolean isNavbarHiddeninSUW() { + return mShouldHideNavbarForTest + || mControllers.navbarButtonsViewController.isNavbarHiddenInSUW(); + } + /** * Returns the height that taskbar will inset when inside apps. * diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarStashControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarStashControllerTest.kt index 96beafff49..40faa7be75 100644 --- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarStashControllerTest.kt +++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarStashControllerTest.kt @@ -333,6 +333,15 @@ class TaskbarStashControllerTest { .isEqualTo(context.resources.getDimensionPixelSize(R.dimen.taskbar_suw_insets)) } + @Test + @UserSetupMode + fun testGetContentHeightToReportToApps_inExpressiveTheme_setupWizardInsets() { + stashController.mShouldHideNavbarForTest = true + assertThat(stashController.contentHeightToReportToApps) + .isEqualTo(stashController.stashedHeight) + stashController.mShouldHideNavbarForTest = false + } + @Test @TaskbarMode(PINNED) fun testGetContentHeightToReportToApps_pinnedModeButFolded_stashedHeight() {