Revert to passing mIsStashed to StashedHandleViewController again

- Fixes case where handle is initially invisible but will be stashed
  and visible, e.g. when launching an app from home screen
- To fix the original issue of sampling happening unnecessarily for
  three button nav, also check supportsVisualStashing()

Fixes: 321257120
Flag: None
Test: Launch an app from home in gesture nav mode
Test: testThreeButtonsTaskbarBoundsAfterConfigChangeDuringIme
(cherry picked from commit c4df8c2ec68d443716dcb004f77b7bda8a5aaf6a)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c5f03fd1bcfc24ec63bdd62b0606452f28d15664)
Merged-In: I1f26436de3081fd00f75a5921010e361e9a9f34e
Change-Id: I1f26436de3081fd00f75a5921010e361e9a9f34e
diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
index 4f2803e..7c30111 100644
--- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
@@ -149,7 +149,7 @@
         });
         initRegionSampler();
         if (isPhoneGestureNavMode(deviceProfile)) {
-            onIsStashedChanged();
+            onIsStashedChanged(true);
         }
     }
 
@@ -236,8 +236,8 @@
     }
 
     /** Called when taskbar is stashed or unstashed. */
-    public void onIsStashedChanged() {
-        mIsStashed = isStashedHandleVisible();
+    public void onIsStashedChanged(boolean isStashed) {
+        mIsStashed = isStashed;
         updateRegionSamplingWindowVisibility();
         if (mIsStashed) {
             mStashedHandleView.updateSampledRegion(mStashedHandleBounds);
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
index 6659bc9..f458e8a 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -600,7 +600,7 @@
             mAnimator.addListener(AnimatorListeners.forEndCallback(() -> {
                 mAnimator = null;
                 mIsStashed = isStashed;
-                onIsStashedChanged();
+                onIsStashedChanged(mIsStashed);
             }));
             return;
         }
@@ -615,7 +615,7 @@
             @Override
             public void onAnimationStart(Animator animation) {
                 mIsStashed = isStashed;
-                onIsStashedChanged();
+                onIsStashedChanged(mIsStashed);
 
                 cancelTimeoutIfExists();
             }
@@ -840,9 +840,10 @@
                 .setDuration(TASKBAR_HINT_STASH_DURATION).start();
     }
 
-    private void onIsStashedChanged() {
+    private void onIsStashedChanged(boolean isStashed) {
         mControllers.runAfterInit(() -> {
-            mControllers.stashedHandleViewController.onIsStashedChanged();
+            mControllers.stashedHandleViewController.onIsStashedChanged(
+                    isStashed && supportsVisualStashing());
             mControllers.taskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged();
         });
     }