Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -27319,6 +27319,7 @@ package android.service.notification { method public final void cancelNotification(java.lang.String); method public final void cancelNotifications(java.lang.String[]); method public android.service.notification.StatusBarNotification[] getActiveNotifications(); method public android.service.notification.StatusBarNotification[] getActiveNotifications(java.lang.String[]); method public final int getCurrentListenerHints(); method public android.service.notification.NotificationListenerService.RankingMap getCurrentRanking(); method public android.os.IBinder onBind(android.content.Intent); core/java/android/app/INotificationManager.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -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); Loading core/java/android/service/notification/NotificationListenerService.java +13 −1 Original line number Diff line number Diff line Loading @@ -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(); Loading services/core/java/com/android/server/notification/NotificationManagerService.java +13 −5 Original line number Diff line number Diff line Loading @@ -1277,23 +1277,31 @@ public class NotificationManagerService extends SystemService { * should be used. * * @param token The binder for the listener, to check that the caller is allowed * @param keys An array of notification keys to fetch, or null to fetch everything * @returns The return value will contain the notifications specified in keys, in that * order, or if keys is null, all the notifications, in natural order. */ @Override public ParceledListSlice<StatusBarNotification> getActiveNotificationsFromListener( INotificationListener token) { INotificationListener token, String[] keys) { synchronized (mNotificationList) { final ManagedServiceInfo info = mListeners.checkServiceTokenLocked(token); final ArrayList<StatusBarNotification> list = new ArrayList<StatusBarNotification>(); final int N = mNotificationList.size(); final boolean getKeys = keys != null; final int N = getKeys ? keys.length : mNotificationList.size(); list.ensureCapacity(N); for (int i=0; i<N; i++) { StatusBarNotification sbn = mNotificationList.get(i).sbn; final NotificationRecord r = getKeys ? mNotificationsByKey.get(keys[i]) : mNotificationList.get(i); if (r != null) { StatusBarNotification sbn = r.sbn; if (isVisibleToListener(sbn, info)) { list.add(sbn); } } } return new ParceledListSlice<StatusBarNotification>(list); } } Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -27319,6 +27319,7 @@ package android.service.notification { method public final void cancelNotification(java.lang.String); method public final void cancelNotifications(java.lang.String[]); method public android.service.notification.StatusBarNotification[] getActiveNotifications(); method public android.service.notification.StatusBarNotification[] getActiveNotifications(java.lang.String[]); method public final int getCurrentListenerHints(); method public android.service.notification.NotificationListenerService.RankingMap getCurrentRanking(); method public android.os.IBinder onBind(android.content.Intent);
core/java/android/app/INotificationManager.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -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); Loading
core/java/android/service/notification/NotificationListenerService.java +13 −1 Original line number Diff line number Diff line Loading @@ -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(); Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +13 −5 Original line number Diff line number Diff line Loading @@ -1277,23 +1277,31 @@ public class NotificationManagerService extends SystemService { * should be used. * * @param token The binder for the listener, to check that the caller is allowed * @param keys An array of notification keys to fetch, or null to fetch everything * @returns The return value will contain the notifications specified in keys, in that * order, or if keys is null, all the notifications, in natural order. */ @Override public ParceledListSlice<StatusBarNotification> getActiveNotificationsFromListener( INotificationListener token) { INotificationListener token, String[] keys) { synchronized (mNotificationList) { final ManagedServiceInfo info = mListeners.checkServiceTokenLocked(token); final ArrayList<StatusBarNotification> list = new ArrayList<StatusBarNotification>(); final int N = mNotificationList.size(); final boolean getKeys = keys != null; final int N = getKeys ? keys.length : mNotificationList.size(); list.ensureCapacity(N); for (int i=0; i<N; i++) { StatusBarNotification sbn = mNotificationList.get(i).sbn; final NotificationRecord r = getKeys ? mNotificationsByKey.get(keys[i]) : mNotificationList.get(i); if (r != null) { StatusBarNotification sbn = r.sbn; if (isVisibleToListener(sbn, info)) { list.add(sbn); } } } return new ParceledListSlice<StatusBarNotification>(list); } } Loading