summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Saumya Prakash <saumyaprakash@google.com> 2025-04-04 17:34:34 +0000
committer Android Build Coastguard Worker <android-build-coastguard-worker@google.com> 2025-04-09 18:27:29 -0700
commit3829c887d3babecb957f577979f2bd9570dfc69b (patch)
treea5969d0e8fbd2573106d32c5bff0f0a80cff5b49
parentd9cdb051250e4a762c13ceb99a447a37ebf724bd (diff)
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
-rw-r--r--quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java35
1 files 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 =