diff options
author | Tony Wickham <twickham@google.com> | 2017-02-24 18:06:14 -0800 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2017-03-27 08:27:12 -0700 |
commit | 362106233919ff64cf462efe395f53c33a8ec4bf (patch) | |
tree | a9ece51ca2ca663f9b7d8d66acb6589ac010ed60 /src/com/android/launcher3/notification | |
parent | 2f5bb169154d25bc8c164f057117fb056ad2de96 (diff) | |
download | android_packages_apps_Trebuchet-362106233919ff64cf462efe395f53c33a8ec4bf.tar.gz android_packages_apps_Trebuchet-362106233919ff64cf462efe395f53c33a8ec4bf.tar.bz2 android_packages_apps_Trebuchet-362106233919ff64cf462efe395f53c33a8ec4bf.zip |
Use notification counts (instead of assuming all 1)
We still ignore group summary headers, which means, for example,
we won't get Gmail unread count. But single notifications that
have numbers associated, such as messages from a single contact
will be included in the badge count. So if you have 2 hangounts
threads, one with 10 messages and one with 8, the badge would
say 18.
Bug: 34939841
Change-Id: I20b9a857d91715e10c0da400a1cee209d7b837b8
Diffstat (limited to 'src/com/android/launcher3/notification')
-rw-r--r-- | src/com/android/launcher3/notification/NotificationKeyData.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/com/android/launcher3/notification/NotificationKeyData.java b/src/com/android/launcher3/notification/NotificationKeyData.java index b3ff8dadd..bf7ae1a5c 100644 --- a/src/com/android/launcher3/notification/NotificationKeyData.java +++ b/src/com/android/launcher3/notification/NotificationKeyData.java @@ -16,6 +16,7 @@ package com.android.launcher3.notification; +import android.app.Notification; import android.service.notification.StatusBarNotification; import android.support.annotation.NonNull; @@ -31,14 +32,17 @@ import java.util.List; public class NotificationKeyData { public final String notificationKey; public final String shortcutId; + public int count; - private NotificationKeyData(String notificationKey, String shortcutId) { + private NotificationKeyData(String notificationKey, String shortcutId, int count) { this.notificationKey = notificationKey; this.shortcutId = shortcutId; + this.count = Math.max(1, count); } public static NotificationKeyData fromNotification(StatusBarNotification sbn) { - return new NotificationKeyData(sbn.getKey(), sbn.getNotification().getShortcutId()); + Notification notif = sbn.getNotification(); + return new NotificationKeyData(sbn.getKey(), notif.getShortcutId(), notif.number); } public static List<String> extractKeysOnly(@NonNull List<NotificationKeyData> notificationKeys) { |