diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/INotificationManager.aidl | 2 | ||||
| -rw-r--r-- | core/java/android/service/notification/NotificationListenerService.java | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index 92ec3ad..6cfb56e 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -46,4 +46,6 @@ interface INotificationManager void clearNotificationFromListener(in INotificationListener token, String pkg, String tag, int id); void clearAllNotificationsFromListener(in INotificationListener token); + + StatusBarNotification[] getActiveNotificationsFromListener(in INotificationListener token); }
\ 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 8b72ca9..6a5864c 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -124,6 +124,21 @@ public abstract class NotificationListenerService extends Service { } } + /** + * Request the list of outstanding notifications (that is, those that are visible to the + * current user). Useful when starting up and you don't know what's already been posted. + * + * @return An array of active notifications. + */ + public StatusBarNotification[] getActiveNotifications() { + try { + return getNotificationInterface().getActiveNotificationsFromListener(mWrapper); + } catch (android.os.RemoteException ex) { + Log.v(TAG, "Unable to contact notification manager", ex); + } + return null; + } + @Override public IBinder onBind(Intent intent) { if (mWrapper == null) { |
