Updates BubbleData sorting and grouping to spec

This change adds onBubbleOrderChanged to BubbleStackView
to try to keep the order synchronized. There are some known
issues with the animation and visual state, which will be
addressed in a follow up CL.

Bug: 123542488
Test: BubbleControllerTest BubbleDataTest
Change-Id: Ie5a679df2f3069236f4d67a3fce4189b39b9eb28
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index 7d189b2..2d0944a 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -29,6 +29,9 @@
 import static com.android.systemui.statusbar.StatusBarState.SHADE;
 import static com.android.systemui.statusbar.notification.NotificationEntryManager.UNDEFINED_DISMISS_REASON;
 
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
+import static java.lang.annotation.ElementType.PARAMETER;
 import static java.lang.annotation.RetentionPolicy.SOURCE;
 
 import android.annotation.Nullable;
@@ -73,6 +76,7 @@
 import com.android.systemui.statusbar.policy.ConfigurationController;
 
 import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
 import java.util.List;
 
 import javax.inject.Inject;
@@ -88,11 +92,12 @@
 public class BubbleController implements ConfigurationController.ConfigurationListener {
 
     private static final String TAG = "BubbleController";
-    private static final boolean DEBUG = true;
+    private static final boolean DEBUG = false;
 
     @Retention(SOURCE)
     @IntDef({DISMISS_USER_GESTURE, DISMISS_AGED, DISMISS_TASK_FINISHED, DISMISS_BLOCKED,
             DISMISS_NOTIF_CANCEL, DISMISS_ACCESSIBILITY_ACTION, DISMISS_NO_LONGER_BUBBLE})
+    @Target({FIELD, LOCAL_VARIABLE, PARAMETER})
     @interface DismissReason {}
 
     static final int DISMISS_USER_GESTURE = 1;
@@ -510,6 +515,9 @@
 
         @Override
         public void onOrderChanged(List<Bubble> bubbles) {
+            if (mStackView != null) {
+                mStackView.updateBubbleOrder(bubbles);
+            }
         }
 
         @Override
@@ -527,13 +535,6 @@
         }
 
         @Override
-        public void showFlyoutText(Bubble bubble, String text) {
-            if (mStackView != null) {
-                mStackView.animateInFlyoutForBubble(bubble);
-            }
-        }
-
-        @Override
         public void apply() {
             mNotificationEntryManager.updateNotifications();
             updateVisibility();