summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorDan Sandler <dsandler@android.com>2014-08-12 12:29:19 -0400
committerDan Sandler <dsandler@android.com>2014-08-26 04:24:10 +0000
commitea75fddbb452638f286c2fcdbddff145ee1a85cb (patch)
treefa659c8d52478a761df309904bbe06ccedf188d9 /core/java/android
parentf710befdab32abbf2d4569e2db3032af266126b4 (diff)
downloadframeworks_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')
-rw-r--r--core/java/android/app/INotificationManager.aidl4
-rw-r--r--core/java/android/service/notification/NotificationListenerService.java14
2 files changed, 15 insertions, 3 deletions
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index 2b97c6b..07e9a94 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -58,7 +58,7 @@ interface INotificationManager
void cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id);
void cancelNotificationsFromListener(in INotificationListener token, in String[] keys);
- ParceledListSlice getActiveNotificationsFromListener(in INotificationListener token);
+ ParceledListSlice getActiveNotificationsFromListener(in INotificationListener token, in String[] keys);
void requestHintsFromListener(in INotificationListener token, int hints);
int getHintsFromListener(in INotificationListener token);
@@ -71,4 +71,4 @@ interface INotificationManager
oneway void setZenModeCondition(in Condition condition);
oneway void setAutomaticZenModeConditions(in Uri[] conditionIds);
Condition[] getAutomaticZenModeConditions();
-} \ No newline at end of file
+}
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();