Don't translate the back button if home button is showing for lockscreen

The back button would get translated to the edge of the screen in
lockscreen apps. This was fine but now that the home button is shown in
these apps, they would overlap. This change prevents the back button
from translating to the edge of the screen when the home button is shown
in certain screens when the device is locked.

Fix: 406104663
Test: Enable 3 button nav and open lock screen apps/ emergency page on
large screen device. Observe that the buttons don't overlap anymore.
Flag: EXEMPT bugfix

Change-Id: Ibb963c1a62de80a990f223797d37a0a5ee294a90
This commit is contained in:
Saumya Prakash
2025-04-04 17:34:34 +00:00
parent 2201485e22
commit b2e46eafc8
@@ -477,8 +477,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));
}
@@ -488,19 +489,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,
@@ -533,6 +523,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 =