Merge "Don't query for the bubble shortcut if it's already on the NotifRecord" into rvc-dev

This commit is contained in:
Mady Mellor
2020-03-25 01:28:36 +00:00
committed by Android (Google) Code Review

View File

@@ -157,8 +157,8 @@ public class BubbleExtractor implements NotificationSignalExtractor {
} }
/** /**
* @return whether the user has enabled the provided notification to bubble, does not * @return whether the user has enabled the provided notification to bubble, and if the
* account for policy. * developer has provided valid information for the notification to bubble.
*/ */
@VisibleForTesting @VisibleForTesting
boolean canBubble(NotificationRecord r, String pkg, int userId) { boolean canBubble(NotificationRecord r, String pkg, int userId) {
@@ -184,8 +184,17 @@ public class BubbleExtractor implements NotificationSignalExtractor {
} }
String shortcutId = metadata.getShortcutId(); String shortcutId = metadata.getShortcutId();
boolean shortcutValid = shortcutId != null String notificationShortcutId = r.getShortcutInfo() != null
&& mShortcutHelper.getValidShortcutInfo(shortcutId, pkg, r.getUser()) != null; ? r.getShortcutInfo().getId()
: null;
boolean shortcutValid = false;
if (notificationShortcutId != null && shortcutId != null) {
// NoMan already checks validity of shortcut, just check if they match.
shortcutValid = shortcutId.equals(notificationShortcutId);
} else if (shortcutId != null) {
shortcutValid =
mShortcutHelper.getValidShortcutInfo(shortcutId, pkg, r.getUser()) != null;
}
if (metadata.getIntent() == null && !shortcutValid) { if (metadata.getIntent() == null && !shortcutValid) {
// Should have a shortcut if intent is null // Should have a shortcut if intent is null
logBubbleError(r.getKey(), logBubbleError(r.getKey(),