Fix subsequent notifs appearing in the shade.

The issue here was that the row was still attached to the bubble expanded
state and there's a check in NotificationViewHiearhchchyManager that skips
adding the notif if it has a view parent.

Fix is simply to remove the row from the parent after dismissal (also
needs the change before this that moves adding the view to the expanded
state only when the bubble is expanded).

Test: manual - have a notif based bubble, dismiss it, get an update for it
               => ensure there is a notification for that update
Fixes: 127381548
Change-Id: I835528fc5af9d1afbd657258fa9f84bd9cc4b679
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index 4addbb5..25ee87a 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -528,7 +528,9 @@
     /**
      * Removes and releases an ActivityView if one was previously created for this bubble.
      */
-    public void destroyActivityView() {
+    public void cleanUpExpandedState() {
+        removeView(mNotifRow);
+
         if (mActivityView == null) {
             return;
         }
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index ade5647..ab6de5b 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -348,7 +348,7 @@
 
         // Remove it from the views
         int removedIndex = mBubbleContainer.indexOfChild(b.iconView);
-        b.expandedView.destroyActivityView();
+        b.expandedView.cleanUpExpandedState();
         mBubbleContainer.removeView(b.iconView);
 
         int bubbleCount = mBubbleContainer.getChildCount();
@@ -377,7 +377,7 @@
     public void stackDismissed() {
         for (Bubble bubble : mBubbleData.getBubbles()) {
             bubble.entry.setBubbleDismissed(true);
-            bubble.expandedView.destroyActivityView();
+            bubble.expandedView.cleanUpExpandedState();
         }
         mBubbleData.clear();
         collapseStack();
@@ -458,7 +458,7 @@
     }
 
     /**
-     * Expands the stack fo bubbles.
+     * Expands the stack of bubbles.
      * <p>
      * Must be called from the main thread.
      */