Fix some things with overflow, persistence, & visibility

1) Bubbles that are persisted no longer have an entry in
   some cases this wasn't being handled correctly (i.e.
   persisted bubbles would never autoexpand)
2) Removed the custom work to promote something from the
   overflow -- in most cases we should be able to update
   flagBubble & rely on the subsequent notification update
   which minimizes the # of code paths
3) mPendingBubbles makes more sense as a HashMap
4) The visibility fix: If the bubble switched from a
   shortcut to a pending intent, we would skip making the
   view visible

Fixes: 158480978
Fixes: 157755108
Test: atest BubbleControllerTest
Test: manual - create a shortcut bubble
             - reboot the device
             - promote that bubble from the overflow
             => ensure that it auto-expands
             - collapse the stack
             - receive an update for that bubble but
               now it's a pendingIntent
             - open the stack
             => ensure that the view is visible
Change-Id: I37dc780e9a66b9e2f2ae46b5386dcd291dc0e0ab
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index c3dcc0b..db79802 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -490,7 +490,7 @@
         if (DEBUG_BUBBLE_EXPANDED_VIEW) {
             Log.d(TAG, "update: bubble=" + (bubble != null ? bubble.getKey() : "null"));
         }
-        boolean isNew = mBubble == null;
+        boolean isNew = mBubble == null || didBackingContentChange(bubble);
         if (isNew || bubble != null && bubble.getKey().equals(mBubble.getKey())) {
             mBubble = bubble;
             mSettingsIcon.setContentDescription(getResources().getString(
@@ -523,6 +523,12 @@
         }
     }
 
+    private boolean didBackingContentChange(Bubble newBubble) {
+        boolean prevWasIntentBased = mBubble != null && mPendingIntent != null;
+        boolean newIsIntentBased = newBubble.getBubbleIntent() != null;
+        return prevWasIntentBased != newIsIntentBased;
+    }
+
     /**
      * Lets activity view know it should be shown / populated with activity content.
      */