Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +16 −2 Original line number Diff line number Diff line Loading @@ -160,6 +160,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // 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 StatusBarWindowController mStatusBarWindowController; Loading Loading @@ -346,6 +350,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi }); mUserCreatedBubbles = new HashSet<>(); mUserBlockedBubbles = new HashSet<>(); mScreenshotHelper = new ScreenshotHelper(context); } Loading Loading @@ -581,6 +586,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi entry.setFlagBubble(true); updateBubble(entry, true /* suppressFlyout */, false /* showInShade */); mUserCreatedBubbles.add(entry.getKey()); mUserBlockedBubbles.remove(entry.getKey()); } /** Loading @@ -596,6 +602,12 @@ public class BubbleController implements ConfigurationController.ConfigurationLi entry.setFlagBubble(false); removeBubble(entry.getKey(), DISMISS_BLOCKED); mUserCreatedBubbles.remove(entry.getKey()); if (BubbleExperimentConfig.isPackageWhitelistedToAutoBubble( mContext, entry.getSbn().getPackageName())) { // This package is whitelist but user demoted the bubble, let's save it so we don't // auto-bubble for the whitelist again. mUserBlockedBubbles.add(entry.getKey()); } } /** Loading Loading @@ -725,8 +737,9 @@ public class BubbleController implements ConfigurationController.ConfigurationLi @Override public void onPendingEntryAdded(NotificationEntry entry) { boolean previouslyUserCreated = mUserCreatedBubbles.contains(entry.getKey()); boolean userBlocked = mUserBlockedBubbles.contains(entry.getKey()); boolean wasAdjusted = BubbleExperimentConfig.adjustForExperiments( mContext, entry, previouslyUserCreated); mContext, entry, previouslyUserCreated, userBlocked); if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry) && (canLaunchInActivityView(mContext, entry) || wasAdjusted)) { Loading @@ -741,8 +754,9 @@ public class BubbleController implements ConfigurationController.ConfigurationLi @Override public void onPreEntryUpdated(NotificationEntry entry) { boolean previouslyUserCreated = mUserCreatedBubbles.contains(entry.getKey()); boolean userBlocked = mUserBlockedBubbles.contains(entry.getKey()); boolean wasAdjusted = BubbleExperimentConfig.adjustForExperiments( mContext, entry, previouslyUserCreated); mContext, entry, previouslyUserCreated, userBlocked); boolean shouldBubble = mNotificationInterruptionStateProvider.shouldBubbleUp(entry) && (canLaunchInActivityView(mContext, entry) || wasAdjusted); Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java +4 −2 Original line number Diff line number Diff line Loading @@ -143,7 +143,7 @@ public class BubbleExperimentConfig { * @return whether an adjustment was made. */ static boolean adjustForExperiments(Context context, NotificationEntry entry, boolean previouslyUserCreated) { boolean previouslyUserCreated, boolean userBlocked) { Notification.BubbleMetadata metadata = null; boolean addedMetadata = false; boolean whiteListedToAutoBubble = Loading Loading @@ -205,7 +205,9 @@ public class BubbleExperimentConfig { } } boolean bubbleForWhitelist = whiteListedToAutoBubble && (addedMetadata || hasMetadata); boolean bubbleForWhitelist = !userBlocked && whiteListedToAutoBubble && (addedMetadata || hasMetadata); if ((previouslyUserCreated && addedMetadata) || bubbleForWhitelist) { // Update to a previous bubble (or new autobubble), set its flag now. if (DEBUG_EXPERIMENTS) { Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +16 −2 Original line number Diff line number Diff line Loading @@ -160,6 +160,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // 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 StatusBarWindowController mStatusBarWindowController; Loading Loading @@ -346,6 +350,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi }); mUserCreatedBubbles = new HashSet<>(); mUserBlockedBubbles = new HashSet<>(); mScreenshotHelper = new ScreenshotHelper(context); } Loading Loading @@ -581,6 +586,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi entry.setFlagBubble(true); updateBubble(entry, true /* suppressFlyout */, false /* showInShade */); mUserCreatedBubbles.add(entry.getKey()); mUserBlockedBubbles.remove(entry.getKey()); } /** Loading @@ -596,6 +602,12 @@ public class BubbleController implements ConfigurationController.ConfigurationLi entry.setFlagBubble(false); removeBubble(entry.getKey(), DISMISS_BLOCKED); mUserCreatedBubbles.remove(entry.getKey()); if (BubbleExperimentConfig.isPackageWhitelistedToAutoBubble( mContext, entry.getSbn().getPackageName())) { // This package is whitelist but user demoted the bubble, let's save it so we don't // auto-bubble for the whitelist again. mUserBlockedBubbles.add(entry.getKey()); } } /** Loading Loading @@ -725,8 +737,9 @@ public class BubbleController implements ConfigurationController.ConfigurationLi @Override public void onPendingEntryAdded(NotificationEntry entry) { boolean previouslyUserCreated = mUserCreatedBubbles.contains(entry.getKey()); boolean userBlocked = mUserBlockedBubbles.contains(entry.getKey()); boolean wasAdjusted = BubbleExperimentConfig.adjustForExperiments( mContext, entry, previouslyUserCreated); mContext, entry, previouslyUserCreated, userBlocked); if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry) && (canLaunchInActivityView(mContext, entry) || wasAdjusted)) { Loading @@ -741,8 +754,9 @@ public class BubbleController implements ConfigurationController.ConfigurationLi @Override public void onPreEntryUpdated(NotificationEntry entry) { boolean previouslyUserCreated = mUserCreatedBubbles.contains(entry.getKey()); boolean userBlocked = mUserBlockedBubbles.contains(entry.getKey()); boolean wasAdjusted = BubbleExperimentConfig.adjustForExperiments( mContext, entry, previouslyUserCreated); mContext, entry, previouslyUserCreated, userBlocked); boolean shouldBubble = mNotificationInterruptionStateProvider.shouldBubbleUp(entry) && (canLaunchInActivityView(mContext, entry) || wasAdjusted); Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java +4 −2 Original line number Diff line number Diff line Loading @@ -143,7 +143,7 @@ public class BubbleExperimentConfig { * @return whether an adjustment was made. */ static boolean adjustForExperiments(Context context, NotificationEntry entry, boolean previouslyUserCreated) { boolean previouslyUserCreated, boolean userBlocked) { Notification.BubbleMetadata metadata = null; boolean addedMetadata = false; boolean whiteListedToAutoBubble = Loading Loading @@ -205,7 +205,9 @@ public class BubbleExperimentConfig { } } boolean bubbleForWhitelist = whiteListedToAutoBubble && (addedMetadata || hasMetadata); boolean bubbleForWhitelist = !userBlocked && whiteListedToAutoBubble && (addedMetadata || hasMetadata); if ((previouslyUserCreated && addedMetadata) || bubbleForWhitelist) { // Update to a previous bubble (or new autobubble), set its flag now. if (DEBUG_EXPERIMENTS) { Loading