diff options
author | Tony Wickham <twickham@google.com> | 2017-03-01 18:15:46 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-03-01 18:15:46 +0000 |
commit | e5298a57152674a9823914e12ba7b16f63bfa14f (patch) | |
tree | 1c6f9dc62fe0130ffb9953797b2b35c09facbe8a | |
parent | efa0ff8ea6b6c6b7e0eefff152b3aa50c51806bf (diff) | |
parent | 5bbba815fd59c47ddfdee2dad8266d50dc5b182a (diff) | |
download | android_packages_apps_Trebuchet-e5298a57152674a9823914e12ba7b16f63bfa14f.tar.gz android_packages_apps_Trebuchet-e5298a57152674a9823914e12ba7b16f63bfa14f.tar.bz2 android_packages_apps_Trebuchet-e5298a57152674a9823914e12ba7b16f63bfa14f.zip |
Merge "Respect badge settings to filter out badges" into ub-launcher3-dorval
am: 5bbba815fd
Change-Id: I76a153ab357c5597758aac11348f1e304495fd70
-rw-r--r-- | src/com/android/launcher3/notification/NotificationListener.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/com/android/launcher3/notification/NotificationListener.java b/src/com/android/launcher3/notification/NotificationListener.java index a627d238e..9b881548a 100644 --- a/src/com/android/launcher3/notification/NotificationListener.java +++ b/src/com/android/launcher3/notification/NotificationListener.java @@ -55,6 +55,8 @@ public class NotificationListener extends NotificationListenerService { private final Handler mWorkerHandler; private final Handler mUiHandler; + private Ranking mTempRanking = new Ranking(); + private Handler.Callback mWorkerCallback = new Handler.Callback() { @Override public boolean handleMessage(Message message) { @@ -166,7 +168,7 @@ public class NotificationListener extends NotificationListenerService { NotificationPostedMsg(StatusBarNotification sbn) { packageUserKey = PackageUserKey.fromNotification(sbn); notificationKey = sbn.getKey(); - shouldBeFilteredOut = shouldBeFilteredOut(sbn.getNotification()); + shouldBeFilteredOut = shouldBeFilteredOut(sbn); } } @@ -190,14 +192,14 @@ public class NotificationListener extends NotificationListenerService { * Filter out notifications that don't have an intent * or are headers for grouped notifications. * - * TODO: use the system concept of a badged notification instead + * @see #shouldBeFilteredOut(StatusBarNotification) */ private List<StatusBarNotification> filterNotifications( StatusBarNotification[] notifications) { if (notifications == null) return null; Set<Integer> removedNotifications = new HashSet<>(); for (int i = 0; i < notifications.length; i++) { - if (shouldBeFilteredOut(notifications[i].getNotification())) { + if (shouldBeFilteredOut(notifications[i])) { removedNotifications.add(i); } } @@ -211,7 +213,12 @@ public class NotificationListener extends NotificationListenerService { return filteredNotifications; } - private boolean shouldBeFilteredOut(Notification notification) { + private boolean shouldBeFilteredOut(StatusBarNotification sbn) { + getCurrentRanking().getRanking(sbn.getKey(), mTempRanking); + if (!mTempRanking.canShowBadge()) { + return true; + } + Notification notification = sbn.getNotification(); boolean isGroupHeader = (notification.flags & Notification.FLAG_GROUP_SUMMARY) != 0; return (notification.contentIntent == null || isGroupHeader); } |