Report lower insets for SUW if expressive theme enabled

This change addresses the desire to lower the footer for SUW content if
the expressive theme is enabled in SUW. This would remove the extra gap
at the bottom of the screen.

Fix: 409897759
Test: Enable expressive theme and relaunch SUW. Check that the bottom
buttons are closer to the bottom edge of the screen.
Flag: EXEMPT bugfix

Change-Id: I7a4961549ec888e57c89a564028843f1e8c0000b
This commit is contained in:
Saumya Prakash
2025-05-06 23:07:57 +00:00
parent 589dfc9672
commit 7adea11bfa
3 changed files with 51 additions and 8 deletions
@@ -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
*
@@ -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.
*
@@ -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() {