From 25b6d9783f53abb6a7ad61b0efe4680a8ba5fe1e Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 22 Sep 2021 13:58:10 -0700 Subject: [PATCH] Allow visual stashing when going to overview in tests - Seprate out supportsStashing() into supportsVisualStashing() and supportsManualStashing(). - Manual stashing is when user explicitly long presses to stash, which we disable for tests. Test: testStressSwipeToOverview Fixes: 200273854 Change-Id: Ib07efa31a1b073de45fdcfac26215129b1b1985b --- .../taskbar/TaskbarStashController.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index a9ff03bdac..02170ab6d2 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -107,7 +107,7 @@ public class TaskbarStashController { // Evaluate whether the handle should be stashed private final StatePropertyHolder mStatePropertyHolder = new StatePropertyHolder( flags -> { - if (!supportsStashing()) { + if (!supportsVisualStashing()) { return false; } boolean inApp = (flags & FLAG_IN_APP) != 0; @@ -141,7 +141,7 @@ public class TaskbarStashController { mTaskbarStashedHandleAlpha = stashedHandleController.getStashedHandleAlpha(); mTaskbarStashedHandleHintScale = stashedHandleController.getStashedHandleHintScale(); - mIsStashedInApp = supportsStashing() + mIsStashedInApp = supportsManualStashing() && mPrefs.getBoolean(SHARED_PREFS_STASHED_KEY, DEFAULT_STASHED_PREF); updateStateForFlag(FLAG_STASHED_IN_APP, mIsStashedInApp); @@ -149,11 +149,19 @@ public class TaskbarStashController { .notifyTaskbarStatus(/* visible */ true, /* stashed */ mIsStashedInApp); } + /** + * Returns whether the taskbar can visually stash into a handle based on the current device + * state. + */ + private boolean supportsVisualStashing() { + return !mActivity.isThreeButtonNav(); + } + /** * Returns whether the user can manually stash the taskbar based on the current device state. */ - private boolean supportsStashing() { - return !mActivity.isThreeButtonNav() + private boolean supportsManualStashing() { + return supportsVisualStashing() && (!Utilities.IS_RUNNING_IN_TEST_HARNESS || supportsStashingForTests()); } @@ -206,7 +214,7 @@ public class TaskbarStashController { * @return Whether we started an animation to either be newly stashed or unstashed. */ public boolean updateAndAnimateIsStashedInApp(boolean isStashedInApp) { - if (!supportsStashing()) { + if (!supportsManualStashing()) { return false; } if (mIsStashedInApp != isStashedInApp) { @@ -307,7 +315,7 @@ public class TaskbarStashController { * unstashed state. */ public void startStashHint(boolean animateForward) { - if (isStashed() || !supportsStashing()) { + if (isStashed() || !supportsManualStashing()) { // Already stashed, no need to hint in that direction. return; }