summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mady Mellor <madym@google.com> 2020-03-25 01:28:36 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-03-25 01:28:36 +0000
commit30b6e5c7781a38fbd2637c02df9e3a1048183f7c (patch)
tree6bc0ce2b10e7ebf1b62bac1e49fb377e244d34e5
parent41577f3cff8b3ed251988cb30c0b0f6157c7a210 (diff)
parent53af63e0f16efcddfa91612a414bb08a055998d3 (diff)
Merge "Don't query for the bubble shortcut if it's already on the NotifRecord" into rvc-dev
-rw-r--r--services/core/java/com/android/server/notification/BubbleExtractor.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/notification/BubbleExtractor.java b/services/core/java/com/android/server/notification/BubbleExtractor.java
index 054f5defd549..f2eb176aa676 100644
--- a/services/core/java/com/android/server/notification/BubbleExtractor.java
+++ b/services/core/java/com/android/server/notification/BubbleExtractor.java
@@ -157,8 +157,8 @@ public class BubbleExtractor implements NotificationSignalExtractor {
}
/**
- * @return whether the user has enabled the provided notification to bubble, does not
- * account for policy.
+ * @return whether the user has enabled the provided notification to bubble, and if the
+ * developer has provided valid information for the notification to bubble.
*/
@VisibleForTesting
boolean canBubble(NotificationRecord r, String pkg, int userId) {
@@ -184,8 +184,17 @@ public class BubbleExtractor implements NotificationSignalExtractor {
}
String shortcutId = metadata.getShortcutId();
- boolean shortcutValid = shortcutId != null
- && mShortcutHelper.getValidShortcutInfo(shortcutId, pkg, r.getUser()) != null;
+ String notificationShortcutId = r.getShortcutInfo() != 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) {
// Should have a shortcut if intent is null
logBubbleError(r.getKey(),