From dd6fe61daa276ec6b6de94367b8d5150f5b387e0 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Wed, 15 Apr 2020 11:47:55 -0700 Subject: [PATCH] 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 --- .../systemui/bubbles/BubbleController.java | 58 +------------------ .../systemui/bubbles/BubbleExpandedView.java | 2 +- .../bubbles/BubbleExperimentConfig.java | 5 +- .../systemui/bubbles/BubbleViewInfoTask.java | 13 +---- 4 files changed, 6 insertions(+), 72 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index da5c2968c6acb..c8e9a687ad23f 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.io.PrintWriter; 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 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // 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 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 mUserBlockedBubbles; - // Bubbles get added to the status bar view private final NotificationShadeWindowController mNotificationShadeWindowController; private final ZenModeController mZenModeController; @@ -412,9 +403,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi } }); - mUserCreatedBubbles = new HashSet<>(); - mUserBlockedBubbles = new HashSet<>(); - mBubbleIconFactory = new BubbleIconFactory(context); } @@ -474,8 +462,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi (entry != null && entry.isRowDismissed() && !isAppCancel) || isClearAll || isUserDimiss || isSummaryCancel; - if (userRemovedNotif || isUserCreatedBubble(key) - || isSummaryOfUserCreatedBubble(entry)) { + if (userRemovedNotif) { return handleDismissalInterception(entry); } @@ -859,27 +846,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi } } - /** - * 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 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. *

@@ -893,37 +859,19 @@ public class BubbleController implements ConfigurationController.ConfigurationLi } 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 93fb6972fad59..3524696dbc797 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 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList + " 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 41dbb489c2f63..2060391d38a3e 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 @@ import java.util.List; 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 501e5024d9405..c96f9a470ca45 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 @@ public class BubbleViewInfoTask extends AsyncTask