From 3829c887d3babecb957f577979f2bd9570dfc69b Mon Sep 17 00:00:00 2001 From: Saumya Prakash Date: Fri, 4 Apr 2025 17:34:34 +0000 Subject: 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 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:b2e46eafc8fe76b0ffd57d0c3f72db5bd236587d) Merged-In: Ibb963c1a62de80a990f223797d37a0a5ee294a90 Change-Id: Ibb963c1a62de80a990f223797d37a0a5ee294a90 --- .../taskbar/NavbarButtonsViewController.java | 35 ++++++++++++---------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 94746fd8a0..63673e0c3e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -478,8 +478,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)); } @@ -489,19 +490,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, @@ -534,6 +524,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 = -- cgit v1.2.3-59-g8ed1b