Disable bubble experiment; use shortcut info from ranking

Keeping the experiment config around for future prototyping
but removing all refs to the bubbling experiment; also
use the shortcut info from entry ranking instead.

Bug: 154120214
Bug: 145763712
Test: atest SystemUITests
Change-Id: I23959d48dcae79386f10dd1dd26793b4009e6c98
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index da5c296..c8e9a68 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -108,7 +108,6 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.List;
 
 /**
@@ -162,14 +161,6 @@
     // Used when ranking updates occur and we check if things should bubble / unbubble
     private NotificationListenerService.Ranking mTmpRanking;
 
-    // Saves notification keys of user created "fake" bubbles so that we can allow notifications
-    // like these to bubble by default. Doesn't persist across reboots, not a long-term solution.
-    private final HashSet<String> mUserCreatedBubbles;
-    // If we're auto-bubbling bubbles via a whitelist, we need to track which notifs from that app
-    // have been "demoted" back to a notification so that we don't auto-bubbles those again.
-    // Doesn't persist across reboots, not a long-term solution.
-    private final HashSet<String> mUserBlockedBubbles;
-
     // Bubbles get added to the status bar view
     private final NotificationShadeWindowController mNotificationShadeWindowController;
     private final ZenModeController mZenModeController;
@@ -412,9 +403,6 @@
                     }
                 });
 
-        mUserCreatedBubbles = new HashSet<>();
-        mUserBlockedBubbles = new HashSet<>();
-
         mBubbleIconFactory = new BubbleIconFactory(context);
     }
 
@@ -474,8 +462,7 @@
                                 (entry != null && entry.isRowDismissed() && !isAppCancel)
                                 || isClearAll || isUserDimiss || isSummaryCancel;
 
-                        if (userRemovedNotif || isUserCreatedBubble(key)
-                                || isSummaryOfUserCreatedBubble(entry)) {
+                        if (userRemovedNotif) {
                             return handleDismissalInterception(entry);
                         }
 
@@ -860,27 +847,6 @@
     }
 
     /**
-     * Whether this bubble was explicitly created by the user via a SysUI affordance.
-     */
-    boolean isUserCreatedBubble(String key) {
-        return mUserCreatedBubbles.contains(key);
-    }
-
-    boolean isSummaryOfUserCreatedBubble(NotificationEntry entry) {
-        if (isSummaryOfBubbles(entry)) {
-            List<Bubble> bubbleChildren =
-                    mBubbleData.getBubblesInGroup(entry.getSbn().getGroupKey());
-            for (int i = 0; i < bubbleChildren.size(); i++) {
-                // Check if any are user-created (i.e. experimental bubbles)
-                if (isUserCreatedBubble(bubbleChildren.get(i).getKey())) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
      * Removes the bubble with the given NotificationEntry.
      * <p>
      * Must be called from the main thread.
@@ -893,37 +859,19 @@
     }
 
     private void onEntryAdded(NotificationEntry entry) {
-        boolean previouslyUserCreated = mUserCreatedBubbles.contains(entry.getKey());
-        boolean userBlocked = mUserBlockedBubbles.contains(entry.getKey());
-        boolean wasAdjusted = BubbleExperimentConfig.adjustForExperiments(
-                mContext, entry, previouslyUserCreated, userBlocked);
-
         if (mNotificationInterruptStateProvider.shouldBubbleUp(entry)
-                && (canLaunchInActivityView(mContext, entry) || wasAdjusted)) {
-            if (wasAdjusted && !previouslyUserCreated) {
-                // Gotta treat the auto-bubbled / whitelisted packaged bubbles as usercreated
-                mUserCreatedBubbles.add(entry.getKey());
-            }
+                && canLaunchInActivityView(mContext, entry)) {
             updateBubble(entry);
         }
     }
 
     private void onEntryUpdated(NotificationEntry entry) {
-        boolean previouslyUserCreated = mUserCreatedBubbles.contains(entry.getKey());
-        boolean userBlocked = mUserBlockedBubbles.contains(entry.getKey());
-        boolean wasAdjusted = BubbleExperimentConfig.adjustForExperiments(
-                mContext, entry, previouslyUserCreated, userBlocked);
-
         boolean shouldBubble = mNotificationInterruptStateProvider.shouldBubbleUp(entry)
-                && (canLaunchInActivityView(mContext, entry) || wasAdjusted);
+                && canLaunchInActivityView(mContext, entry);
         if (!shouldBubble && mBubbleData.hasBubbleWithKey(entry.getKey())) {
             // It was previously a bubble but no longer a bubble -- lets remove it
             removeBubble(entry, DISMISS_NO_LONGER_BUBBLE);
         } else if (shouldBubble) {
-            if (wasAdjusted && !previouslyUserCreated) {
-                // Gotta treat the auto-bubbled / whitelisted packaged bubbles as usercreated
-                mUserCreatedBubbles.add(entry.getKey());
-            }
             updateBubble(entry);
         }
     }
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index 93fb697..3524696 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -193,7 +193,7 @@
                         + " mActivityViewStatus=" + mActivityViewStatus
                         + " bubble=" + getBubbleKey());
             }
-            if (mBubble != null && !mBubbleController.isUserCreatedBubble(mBubble.getKey())) {
+            if (mBubble != null) {
                 // Must post because this is called from a binder thread.
                 post(() -> mBubbleController.removeBubble(mBubble.getEntry(),
                         BubbleController.DISMISS_TASK_FINISHED));
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java
index 41dbb48..2060391 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java
@@ -57,16 +57,13 @@
 public class BubbleExperimentConfig {
     private static final String TAG = TAG_WITH_CLASS_NAME ? "BubbleController" : TAG_BUBBLES;
 
-    private static final String SHORTCUT_DUMMY_INTENT = "bubble_experiment_shortcut_intent";
-    private static PendingIntent sDummyShortcutIntent;
-
     private static final int BUBBLE_HEIGHT = 10000;
 
     private static final String ALLOW_ANY_NOTIF_TO_BUBBLE = "allow_any_notif_to_bubble";
     private static final boolean ALLOW_ANY_NOTIF_TO_BUBBLE_DEFAULT = false;
 
     private static final String ALLOW_MESSAGE_NOTIFS_TO_BUBBLE = "allow_message_notifs_to_bubble";
-    private static final boolean ALLOW_MESSAGE_NOTIFS_TO_BUBBLE_DEFAULT = true;
+    private static final boolean ALLOW_MESSAGE_NOTIFS_TO_BUBBLE_DEFAULT = false;
 
     private static final String ALLOW_SHORTCUTS_TO_BUBBLE = "allow_shortcuts_to_bubble";
     private static final boolean ALLOW_SHORTCUT_TO_BUBBLE_DEFAULT = false;
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java
index 501e502..c96f9a4 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java
@@ -139,22 +139,11 @@
             StatusBarNotification sbn = b.getEntry().getSbn();
             String packageName = sbn.getPackageName();
 
-            // Real shortcut info for this bubble
             String bubbleShortcutId =  b.getEntry().getBubbleMetadata().getShortcutId();
             if (bubbleShortcutId != null) {
-                info.shortcutInfo = BubbleExperimentConfig.getShortcutInfo(c, packageName,
-                        sbn.getUser(), bubbleShortcutId);
-            } else {
-                // Check for experimental shortcut
-                String shortcutId = sbn.getNotification().getShortcutId();
-                if (BubbleExperimentConfig.useShortcutInfoToBubble(c) && shortcutId != null) {
-                    info.shortcutInfo = BubbleExperimentConfig.getShortcutInfo(c,
-                            packageName,
-                            sbn.getUser(), shortcutId);
-                }
+                info.shortcutInfo = b.getEntry().getRanking().getShortcutInfo();
             }
 
-
             // App name & app icon
             PackageManager pm = c.getPackageManager();
             ApplicationInfo appInfo;