Align the bubble bar with the taskbar in overview and app

Whenever the bubble bar is unstashed and taskbar is present, the
translationY of the bubble bar is now adjusted so that it is aligned
with the taskbar.

Demo: http://recall/-/bJtug1HhvXkkeA4MQvIaiP/e3dlacSsSebQfEFTEt10JM

Fixes: 286247080
Test: Manual:
      - Add bubbles to the bubble bar.
      - On home observe the bar is aligned with hotseat
      - Switch to overview and observe the bar is aligned with taskbar
      - Go back to home. Bar aligns with hotseat.
      - Launch an app. Swipe up to load taskbar. Bar is aligned with taskbar.
      - Go back to home. Bar aligns with hotseat.
Change-Id: I93c2232d4862be4c97e36ddb6c9d680b01e555ad
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java
index 59b38ea..5177d93 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java
@@ -127,6 +127,12 @@
             mBubblesShowingOnHome = onHome;
             if (mBubblesShowingOnHome) {
                 showBubbleBar(/* expanded= */ false);
+                // When transitioning from app to home the stash animator may already have been
+                // created, so we need to animate the bubble bar here to align with hotseat.
+                if (!mIsStashed) {
+                    mIconTranslationYForStash.animateToValue(getBubbleBarTranslationYForHotseat())
+                            .start();
+                }
                 // If the bubble bar is already unstashed, the taskbar touchable region won't be
                 // updated correctly, so force an update here.
                 mControllers.runAfterInit(() ->
@@ -149,6 +155,11 @@
             mBubblesShowingOnOverview = onOverview;
             if (!mBubblesShowingOnOverview && !mBarViewController.isExpanded()) {
                 stashBubbleBar();
+            } else {
+                // When transitioning to overview the stash animator may already have been
+                // created, so we need to animate the bubble bar here to align with taskbar.
+                mIconTranslationYForStash.animateToValue(getBubbleBarTranslationYForTaskbar())
+                        .start();
             }
         }
     }
@@ -240,13 +251,10 @@
             secondHalfDurationScale = 0.75f;
 
             // If we're on home, adjust the translation so the bubble bar aligns with hotseat.
-            // TODO(b/286247080): Update the offset for overview.
-            final float hotseatBottomSpace = mActivity.getDeviceProfile().hotseatBarBottomSpacePx;
-            final float hotseatCellHeight = mActivity.getDeviceProfile().hotseatCellHeightPx;
-
-            final float translationY =
-                    -hotseatBottomSpace - hotseatCellHeight + mUnstashedHeight - abs(
-                            hotseatCellHeight - mUnstashedHeight) / 2;
+            // Otherwise we're either showing in an app or in overview. In either case adjust it so
+            // the bubble bar aligns with the taskbar.
+            final float translationY = mBubblesShowingOnHome ? getBubbleBarTranslationYForHotseat()
+                    : getBubbleBarTranslationYForTaskbar();
 
             fullLengthAnimatorSet.playTogether(
                     mIconScaleForStash.animateToValue(1),
@@ -290,4 +298,15 @@
             mTaskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged();
         });
     }
+
+    private float getBubbleBarTranslationYForTaskbar() {
+        return -mActivity.getDeviceProfile().taskbarBottomMargin;
+    }
+
+    private float getBubbleBarTranslationYForHotseat() {
+        final float hotseatBottomSpace = mActivity.getDeviceProfile().hotseatBarBottomSpacePx;
+        final float hotseatCellHeight = mActivity.getDeviceProfile().hotseatCellHeightPx;
+        return -hotseatBottomSpace - hotseatCellHeight + mUnstashedHeight - abs(
+                hotseatCellHeight - mUnstashedHeight) / 2;
+    }
 }