From 3e7415df56206e3fae71cff3f521549f84baff6a Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Tue, 25 Jan 2022 00:12:36 +0000 Subject: [PATCH] Keep reporting > 0 insets on home screen Technically mControllers.stashedHandleViewController.isStashedHandleVisible() is false on the home screen (since we unstash), so now we also check isInApp(). This ensures that we always return the same insets when on the home screen - and the insets we report are the same as when you launch an app, to ensure seamless transitions. The value itself shouldn't matter to launcher as long as it is static, since launcher overrides the insets due to taskbar anyway, but we need to keep the value static to avoid configuration change. Test: Open a website in Chrome, stash taskbar, then launch Chrome from home screen and ensure content doesn't jump during the transition Fixes: 221238308 Change-Id: I81e320b3a8d32ffe78441be5dd8f15a586d3b842 --- .../taskbar/TaskbarStashController.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 6bc4c0a019..473be9ea7e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -250,7 +250,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba * Returns whether the taskbar is currently visible and in an app. */ public boolean isInAppAndNotStashed() { - return !mIsStashed && (mState & FLAG_IN_APP) != 0; + return !mIsStashed && isInApp(); + } + + private boolean isInApp() { + return hasAnyFlag(FLAG_IN_APP); } /** @@ -266,8 +270,15 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba return mUnstashedHeight; } boolean isAnimating = mAnimator != null && mAnimator.isStarted(); - return mControllers.stashedHandleViewController.isStashedHandleVisible() || isAnimating - ? mStashedHeight : 0; + if (!mControllers.stashedHandleViewController.isStashedHandleVisible() + && isInApp() + && !isAnimating) { + // We are in a settled state where we're not showing the handle even though taskbar + // is stashed. This can happen for example when home button is disabled (see + // StashedHandleViewController#setIsHomeButtonDisabled()). + return 0; + } + return mStashedHeight; } return mUnstashedHeight; }