summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/popup/PopupDataProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/popup/PopupDataProvider.java')
-rw-r--r--src/com/android/launcher3/popup/PopupDataProvider.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/com/android/launcher3/popup/PopupDataProvider.java b/src/com/android/launcher3/popup/PopupDataProvider.java
index c754fda99..e314b646b 100644
--- a/src/com/android/launcher3/popup/PopupDataProvider.java
+++ b/src/com/android/launcher3/popup/PopupDataProvider.java
@@ -58,19 +58,26 @@ public class PopupDataProvider implements NotificationListener.NotificationsChan
}
@Override
- public void onNotificationPosted(PackageUserKey postedPackageUserKey, String notificationKey) {
+ public void onNotificationPosted(PackageUserKey postedPackageUserKey, String notificationKey,
+ boolean shouldBeFilteredOut) {
BadgeInfo badgeInfo = mPackageUserToBadgeInfos.get(postedPackageUserKey);
- boolean notificationWasAdded; // As opposed to updated.
+ boolean notificationWasAddedOrRemoved; // As opposed to updated.
if (badgeInfo == null) {
- BadgeInfo newBadgeInfo = new BadgeInfo(postedPackageUserKey);
- newBadgeInfo.addNotificationKeyIfNotExists(notificationKey);
- mPackageUserToBadgeInfos.put(postedPackageUserKey, newBadgeInfo);
- notificationWasAdded = true;
+ if (!shouldBeFilteredOut) {
+ BadgeInfo newBadgeInfo = new BadgeInfo(postedPackageUserKey);
+ newBadgeInfo.addNotificationKeyIfNotExists(notificationKey);
+ mPackageUserToBadgeInfos.put(postedPackageUserKey, newBadgeInfo);
+ notificationWasAddedOrRemoved = true;
+ } else {
+ notificationWasAddedOrRemoved = false;
+ }
} else {
- notificationWasAdded = badgeInfo.addNotificationKeyIfNotExists(notificationKey);
+ notificationWasAddedOrRemoved = shouldBeFilteredOut
+ ? badgeInfo.removeNotificationKey(notificationKey)
+ : badgeInfo.addNotificationKeyIfNotExists(notificationKey);
}
updateLauncherIconBadges(Utilities.singletonHashSet(postedPackageUserKey),
- notificationWasAdded);
+ notificationWasAddedOrRemoved);
}
@Override