Only collapse the stack onTaskMovedToFront if we're not animating

I think it should be safe to skip this if the stack is animating.

If the stack is animating due to collapse then it's fine because
we're collapsing anyways.

The situation to be concerned about is:
1) Tap stack to expand
2) Almost simultaneously tap app / something that would bring
   activity up

Step 2 can never happen because as soon as the stack is expanding,
bubbles is grabbing any touches -- so that second tap would be
piped to bubbles.

Test: manual - 1) have bubbles
               2) open any app
               3) swipe up to home and quickly tap bubble stack
               => bubbles are expanded as expected
Bug: 138941969
Change-Id: Ie5f12327f1ecf8801a9b800b81f505310e7f63fe
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index ff13513..a13b485 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -903,7 +903,9 @@
         @Override
         public void onTaskMovedToFront(RunningTaskInfo taskInfo) {
             if (mStackView != null && taskInfo.displayId == Display.DEFAULT_DISPLAY) {
-                mBubbleData.setExpanded(false);
+                if (!mStackView.isExpansionAnimating()) {
+                    mBubbleData.setExpanded(false);
+                }
             }
         }
 
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index b3a24e9..c06e2d5f 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -663,6 +663,13 @@
     }
 
     /**
+     * Whether the stack of bubbles is animating to or from expansion.
+     */
+    public boolean isExpansionAnimating() {
+        return mIsExpansionAnimating;
+    }
+
+    /**
      * The {@link BubbleView} that is expanded, null if one does not exist.
      */
     BubbleView getExpandedBubbleView() {