Fix bubble bar and handle visibility on first bubble

When the animation of the first bubble is suppressed, immediately
stash or show the bubble bar to make sure it has been initialized
correctly.

Also we no longer automatically update the bubble bar visibility
based on its alpha value, since we're managing alpha and visibility
ourselves.

Flag: com.android.wm.shell.enable_bubble_bar
Fixes: 343505267
Fixes: 343502240
Test: manually verified state for the following scenarios for the first bubble
       - in app when keyboard is open
       - in app -> open shade
       - in app -> lock device
       - on home -> open shade
       - on home -> lock device
       - in overview -> open shade
Test: manually sanity tested to make sure animations for more bubbles still work
Test: manual
       - Open test bubble app
       - Open keyboard and send a bubble
       - The bubble should animate using a HUN since the keyboard is open
       - Swipe back to hide the keyboard
       - Observe that the bubble bar no longer shows to stash into the handle
Change-Id: I754a5a9c8e961af0cdd5ccadf83d3081d4414c7e
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
index f614dc6..45a9fa1 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
@@ -98,7 +98,6 @@
         mBarView = barView;
         mSystemUiProxy = SystemUiProxy.INSTANCE.get(mActivity);
         mBubbleBarAlpha = new MultiValueAlpha(mBarView, 1 /* num alpha channels */);
-        mBubbleBarAlpha.setUpdateVisibility(true);
         mIconSize = activity.getResources().getDimensionPixelSize(
                 R.dimen.bubblebar_icon_size);
     }
@@ -408,7 +407,19 @@
             b.getView().setOnClickListener(mBubbleClickListener);
             mBubbleDragController.setupBubbleView(b.getView());
 
+            if (b instanceof BubbleBarOverflow) {
+                return;
+            }
+
             if (suppressAnimation || !(b instanceof BubbleBarBubble bubble)) {
+                // the bubble bar and handle are initialized as part of the first bubble animation.
+                // if the animation is suppressed, immediately stash or show the bubble bar to
+                // ensure they've been initialized.
+                if (mTaskbarStashController.isInApp()) {
+                    mBubbleStashController.stashBubbleBarImmediate();
+                } else {
+                    mBubbleStashController.showBubbleBarImmediate();
+                }
                 return;
             }
             animateBubbleNotification(bubble, isExpanding);
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java
index 5d01b9b..74ddf90 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java
@@ -418,6 +418,7 @@
     /** Stashes the bubble bar immediately without animation. */
     public void stashBubbleBarImmediate() {
         mHandleViewController.setTranslationYForSwipe(0);
+        mBubbleStashedHandleAlpha.setValue(1);
         mIconAlphaForStash.setValue(0);
         mIconTranslationYForStash.updateValue(getStashTranslation());
         mIconScaleForStash.updateValue(STASHED_BAR_SCALE);