diff options
author | Dan Sandler <dsandler@android.com> | 2014-08-12 12:29:19 -0400 |
---|---|---|
committer | Dan Sandler <dsandler@android.com> | 2014-08-26 04:24:10 +0000 |
commit | ea75fddbb452638f286c2fcdbddff145ee1a85cb (patch) | |
tree | fa659c8d52478a761df309904bbe06ccedf188d9 /core/java/android/service | |
parent | f710befdab32abbf2d4569e2db3032af266126b4 (diff) | |
download | frameworks_base-ea75fddbb452638f286c2fcdbddff145ee1a85cb.zip frameworks_base-ea75fddbb452638f286c2fcdbddff145ee1a85cb.tar.gz frameworks_base-ea75fddbb452638f286c2fcdbddff145ee1a85cb.tar.bz2 |
Allow listeners to fetch current notifications by key.
Bug: 16574195
Change-Id: I269dbcc7fc8912d84229f6a3d950b0015625ae7a
Diffstat (limited to 'core/java/android/service')
-rw-r--r-- | core/java/android/service/notification/NotificationListenerService.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index 119f7f6..4651d7e 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -307,10 +307,22 @@ public abstract class NotificationListenerService extends Service { * @return An array of active notifications, sorted in natural order. */ public StatusBarNotification[] getActiveNotifications() { + return getActiveNotifications(null); + } + + /** + * Request one or more notifications by key. Useful if you have been keeping track of + * notifications but didn't want to retain the bits, and now need to go back and extract + * more data out of those notifications. + * + * @return An array of notifications corresponding to the requested keys, in the + * same order as the key list. + */ + public StatusBarNotification[] getActiveNotifications(String[] keys) { if (!isBound()) return null; try { ParceledListSlice<StatusBarNotification> parceledList = - getNotificationInterface().getActiveNotificationsFromListener(mWrapper); + getNotificationInterface().getActiveNotificationsFromListener(mWrapper, keys); List<StatusBarNotification> list = parceledList.getList(); int N = list.size(); |