Merge "Don't translate the back button if home button is showing for lockscreen" into main

This commit is contained in:
Saumya Prakash authored and Android (Google) Code Review committed 2025-04-07 11:59:39 -07:00
commit 830ceb6565
1 file changed
+20 -15
@@ -480,8 +480,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
if (!mContext.isPhoneMode()) {
mPropertyHolders.add(new StatePropertyHolder(
mBackButton, flags -> mContext.isUserSetupComplete()
&& ((flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0
|| (flags & FLAG_KEYGUARD_VISIBLE) != 0),
&& ((flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0
|| (flags & FLAG_KEYGUARD_VISIBLE) != 0)
&& (!shouldShowHomeButtonInLockscreen(flags)),
VIEW_TRANSLATE_X, navButtonSize * (isRtl ? -2 : 2), 0));
}
@@ -491,19 +492,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
mHomeButtonAlpha = new MultiValueAlpha(mHomeButton, NUM_ALPHA_CHANNELS);
mHomeButtonAlpha.setUpdateVisibility(true);
mPropertyHolders.add(
new StatePropertyHolder(mHomeButtonAlpha.get(
ALPHA_INDEX_KEYGUARD_OR_DISABLE),
flags -> {
/* when the keyguard is visible hide home button. Anytime we are
* occluded we want to show the home button for apps over keyguard.
* however we don't want to show when not occluded/visible.
* (visible false || occluded true) && disable false && not gnav
*/
return ((flags & FLAG_KEYGUARD_VISIBLE) == 0
|| (flags & FLAG_KEYGUARD_OCCLUDED) != 0)
&& (flags & FLAG_DISABLE_HOME) == 0
&& !mContext.isGestureNav();
}));
new StatePropertyHolder(mHomeButtonAlpha.get(ALPHA_INDEX_KEYGUARD_OR_DISABLE),
this::shouldShowHomeButtonInLockscreen));
// Recents button
mRecentsButton = addButton(R.drawable.ic_sysbar_recent, BUTTON_RECENTS,
@@ -536,6 +526,21 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
navButtonController.onButtonLongClick(BUTTON_SPACE, view));
}
/**
* Method to determine whether to show the home button in lockscreen
*
* When the keyguard is visible hide home button. Anytime we are
* occluded we want to show the home button for apps over keyguard.
* however we don't want to show when not occluded/visible.
* (visible false || occluded true) && disable false && not gnav
*/
private boolean shouldShowHomeButtonInLockscreen(int flags) {
return ((flags & FLAG_KEYGUARD_VISIBLE) == 0
|| (flags & FLAG_KEYGUARD_OCCLUDED) != 0)
&& (flags & FLAG_DISABLE_HOME) == 0
&& !mContext.isGestureNav();
}
private void parseSystemUiFlags(@SystemUiStateFlags long sysUiStateFlags) {
mSysuiStateFlags = sysUiStateFlags;
boolean isImeSwitcherButtonVisible =