Fix a couple of mistakes with dots & summaries

* When dismissing a single bubble the notification got removed when
  it shouldn't be (because single bubble also considered summary)
* The dot being shown should be based on showBubbleDot, not showInShade
* Remove debug statement I never intended to check in! The entry shouldn't
  be null so it should be fine to assume non-null... if it is null we should
  break because something weird would be going on

Test: manual - dismiss a bubble, notice notification stays in shade
Bug: 138659213
Change-Id: I30c3666ff14c7d7ec5b6b461e5f50bc7460328e6
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index 7d9bb07..ff13513 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -455,7 +455,8 @@
         NotificationEntry entry = mNotificationEntryManager.getNotificationData().get(key);
         String groupKey = entry != null ? entry.notification.getGroupKey() : null;
         boolean isSuppressedSummary = mBubbleData.isSummarySuppressed(groupKey);
-        return isSuppressedSummary || isBubbleAndSuppressed;
+        boolean isSummary = key.equals(mBubbleData.getSummaryKey(groupKey));
+        return (isSummary && isSuppressedSummary) || isBubbleAndSuppressed;
     }
 
     void selectBubble(Bubble bubble) {
@@ -731,10 +732,6 @@
                         mBubbleData.removeSuppressedSummary(groupKey);
                         NotificationEntry entry =
                                 mNotificationEntryManager.getNotificationData().get(notifKey);
-                        if (entry == null) {
-                            Log.w("mady", "WTF summary isn't in data... " + notifKey);
-                            return;
-                        }
                         mNotificationEntryManager.performRemoveNotification(
                                 entry.notification, UNDEFINED_DISMISS_REASON);
                     }
@@ -745,7 +742,9 @@
                     if (summary != null) {
                         ArrayList<NotificationEntry> summaryChildren =
                                 mNotificationGroupManager.getLogicalChildren(summary.notification);
-                        if (summaryChildren == null || summaryChildren.isEmpty()) {
+                        boolean isSummaryThisNotif = summary.key.equals(bubble.getEntry().key);
+                        if (!isSummaryThisNotif
+                                && (summaryChildren == null || summaryChildren.isEmpty())) {
                             mNotificationEntryManager.performRemoveNotification(
                                     summary.notification, UNDEFINED_DISMISS_REASON);
                         }
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java
index 4176738..f8f58be 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java
@@ -255,7 +255,7 @@
         iconPath.transform(matrix);
         mBadgedImageView.drawDot(iconPath);
 
-        animateDot(mBubble.showInShadeWhenBubble() /* showDot */, null /* after */);
+        animateDot(mBubble.showBubbleDot() /* showDot */, null /* after */);
     }
 
     int getBadgeColor() {