Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +8 −0 Original line number Diff line number Diff line Loading @@ -699,6 +699,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry) && (canLaunchInActivityView(mContext, entry) || wasAdjusted)) { if (wasAdjusted && !previouslyUserCreated) { // Gotta treat the auto-bubbled / whitelisted packaged bubbles as usercreated mUserCreatedBubbles.add(entry.getKey()); } updateBubble(entry); } } Loading @@ -715,6 +719,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // It was previously a bubble but no longer a bubble -- lets remove it removeBubble(entry.getKey(), 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); } } Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java +25 −3 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ public class BubbleExperimentConfig { private static final String ALLOW_SHORTCUTS_TO_BUBBLE = "allow_shortcuts_to_bubble"; private static final boolean ALLOW_SHORTCUT_TO_BUBBLE_DEFAULT = false; private static final String WHITELISTED_AUTO_BUBBLE_APPS = "whitelisted_auto_bubble_apps"; /** * When true, if a notification has the information necessary to bubble (i.e. valid * contentIntent and an icon or image), then a {@link android.app.Notification.BubbleMetadata} Loading Loading @@ -102,6 +104,24 @@ public class BubbleExperimentConfig { ALLOW_SHORTCUT_TO_BUBBLE_DEFAULT ? 1 : 0) != 0; } /** * Returns whether the provided package is whitelisted to bubble. */ static boolean isPackageWhitelistedToAutoBubble(Context context, String packageName) { String unsplitList = Settings.Secure.getString(context.getContentResolver(), WHITELISTED_AUTO_BUBBLE_APPS); if (unsplitList != null) { // We expect the list to be separated by commas and no white space (but we trim in case) String[] packageList = unsplitList.split(","); for (int i = 0; i < packageList.length; i++) { if (packageList[i].trim().equals(packageName)) { return true; } } } return false; } /** * If {@link #allowAnyNotifToBubble(Context)} is true, this method creates and adds * {@link android.app.Notification.BubbleMetadata} to the notification entry as long as Loading @@ -113,6 +133,8 @@ public class BubbleExperimentConfig { boolean previouslyUserCreated) { Notification.BubbleMetadata metadata = null; boolean addedMetadata = false; boolean whiteListedToAutoBubble = isPackageWhitelistedToAutoBubble(context, entry.getSbn().getPackageName()); Notification notification = entry.getSbn().getNotification(); boolean isMessage = Notification.MessagingStyle.class.equals( Loading Loading @@ -170,9 +192,9 @@ public class BubbleExperimentConfig { } } if (previouslyUserCreated && addedMetadata) { // Update to a previous bubble, set its flag now so the update goes // to the bubble. boolean bubbleForWhitelist = whiteListedToAutoBubble && (addedMetadata || hasMetadata); if ((previouslyUserCreated && addedMetadata) || bubbleForWhitelist) { // Update to a previous bubble (or new autobubble), set its flag now. if (DEBUG_EXPERIMENTS) { Log.d(TAG, "Setting FLAG_BUBBLE for: " + entry.getKey()); } Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +8 −0 Original line number Diff line number Diff line Loading @@ -699,6 +699,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry) && (canLaunchInActivityView(mContext, entry) || wasAdjusted)) { if (wasAdjusted && !previouslyUserCreated) { // Gotta treat the auto-bubbled / whitelisted packaged bubbles as usercreated mUserCreatedBubbles.add(entry.getKey()); } updateBubble(entry); } } Loading @@ -715,6 +719,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // It was previously a bubble but no longer a bubble -- lets remove it removeBubble(entry.getKey(), 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); } } Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java +25 −3 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ public class BubbleExperimentConfig { private static final String ALLOW_SHORTCUTS_TO_BUBBLE = "allow_shortcuts_to_bubble"; private static final boolean ALLOW_SHORTCUT_TO_BUBBLE_DEFAULT = false; private static final String WHITELISTED_AUTO_BUBBLE_APPS = "whitelisted_auto_bubble_apps"; /** * When true, if a notification has the information necessary to bubble (i.e. valid * contentIntent and an icon or image), then a {@link android.app.Notification.BubbleMetadata} Loading Loading @@ -102,6 +104,24 @@ public class BubbleExperimentConfig { ALLOW_SHORTCUT_TO_BUBBLE_DEFAULT ? 1 : 0) != 0; } /** * Returns whether the provided package is whitelisted to bubble. */ static boolean isPackageWhitelistedToAutoBubble(Context context, String packageName) { String unsplitList = Settings.Secure.getString(context.getContentResolver(), WHITELISTED_AUTO_BUBBLE_APPS); if (unsplitList != null) { // We expect the list to be separated by commas and no white space (but we trim in case) String[] packageList = unsplitList.split(","); for (int i = 0; i < packageList.length; i++) { if (packageList[i].trim().equals(packageName)) { return true; } } } return false; } /** * If {@link #allowAnyNotifToBubble(Context)} is true, this method creates and adds * {@link android.app.Notification.BubbleMetadata} to the notification entry as long as Loading @@ -113,6 +133,8 @@ public class BubbleExperimentConfig { boolean previouslyUserCreated) { Notification.BubbleMetadata metadata = null; boolean addedMetadata = false; boolean whiteListedToAutoBubble = isPackageWhitelistedToAutoBubble(context, entry.getSbn().getPackageName()); Notification notification = entry.getSbn().getNotification(); boolean isMessage = Notification.MessagingStyle.class.equals( Loading Loading @@ -170,9 +192,9 @@ public class BubbleExperimentConfig { } } if (previouslyUserCreated && addedMetadata) { // Update to a previous bubble, set its flag now so the update goes // to the bubble. boolean bubbleForWhitelist = whiteListedToAutoBubble && (addedMetadata || hasMetadata); if ((previouslyUserCreated && addedMetadata) || bubbleForWhitelist) { // Update to a previous bubble (or new autobubble), set its flag now. if (DEBUG_EXPERIMENTS) { Log.d(TAG, "Setting FLAG_BUBBLE for: " + entry.getKey()); } Loading