Move showInShade off of NotificationEntry and into Bubble

There are minimal usages of showInShade outside of the bubbles package and
things that want to know stuff about bubbles should probs go through
bubbleController.

This CL:
* moves showInShade off of NotificationEntry and onto Bubble, updates
  usages & tests
* adds method on BubbleController to check if a notif should be suppressed
  from the shade
* removes the NotificationFilter code to filter out bubbles -- this turned
  out to be unneeded -- NotificationViewHiearchyManager can query
  BubbleController and do the right thing based on that (this also
  works around the issue from b/135280077)

Test: atest SystemUITests
Bug: 135280077
Bug: 135214687
Change-Id: Id9261eae892f39059cbb3116fe05488fcf8ff0dc
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index 5bf8b59..6471c71 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -80,7 +80,6 @@
 import com.android.systemui.statusbar.notification.NotificationEntryManager;
 import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
-import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag;
 import com.android.systemui.statusbar.phone.StatusBarWindowController;
 import com.android.systemui.statusbar.policy.ConfigurationController;
 import com.android.systemui.statusbar.policy.ZenModeController;
@@ -345,6 +344,17 @@
         mBubbleData.setExpanded(false /* expanded */);
     }
 
+    /**
+     * Whether (1) there is a bubble associated with the provided key and
+     *         (2) if the notification for that bubble is hidden from the shade.
+     *
+     * False if there isn't a bubble or if the notification for that bubble appears in the shade.
+     */
+    public boolean isBubbleNotificationSuppressedFromShade(String key) {
+        return mBubbleData.hasBubbleWithKey(key)
+                && !mBubbleData.getBubbleWithKey(key).showInShadeWhenBubble();
+    }
+
     void selectBubble(Bubble bubble) {
         mBubbleData.setSelectedBubble(bubble);
     }
@@ -438,7 +448,7 @@
                 boolean bubbleExtended = entry.isBubble() && !bubble.isRemoved()
                         && userRemovedNotif;
                 if (bubbleExtended) {
-                    entry.setShowInShadeWhenBubble(false);
+                    bubble.setShowInShadeWhenBubble(false);
                     if (mStackView != null) {
                         mStackView.updateDotVisibility(entry.key);
                     }
@@ -462,17 +472,6 @@
             }
             if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry)
                     && canLaunchInActivityView(mContext, entry)) {
-                updateShowInShadeForSuppressNotification(entry);
-            }
-        }
-
-        @Override
-        public void onEntryInflated(NotificationEntry entry, @InflationFlag int inflatedFlags) {
-            if (!areBubblesEnabled(mContext)) {
-                return;
-            }
-            if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry)
-                    && canLaunchInActivityView(mContext, entry)) {
                 updateBubble(entry);
             }
         }
@@ -488,7 +487,6 @@
                 // It was previously a bubble but no longer a bubble -- lets remove it
                 removeBubble(entry.key, DISMISS_NO_LONGER_BUBBLE);
             } else if (shouldBubble) {
-                updateShowInShadeForSuppressNotification(entry);
                 Bubble b = mBubbleData.getBubbleWithKey(entry.key);
                 b.setRemoved(false); // updates come back as bubbles even if dismissed
                 updateBubble(entry);
@@ -683,17 +681,6 @@
         return mStackView;
     }
 
-    private void updateShowInShadeForSuppressNotification(NotificationEntry entry) {
-        boolean suppressNotification = entry.getBubbleMetadata() != null
-                && entry.getBubbleMetadata().isNotificationSuppressed();
-        Bubble b = mBubbleData.getBubbleWithKey(entry.key);
-        if (b != null && mBubbleData.getSelectedBubble() == b && mBubbleData.isExpanded()) {
-            // If we're expanded & selected don't show in shade
-            suppressNotification = true;
-        }
-        entry.setShowInShadeWhenBubble(!suppressNotification);
-    }
-
     static String formatBubblesString(List<Bubble> bubbles, Bubble selected) {
         StringBuilder sb = new StringBuilder();
         for (Bubble bubble : bubbles) {