summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorChristoph Studer <chstuder@google.com>2014-05-20 18:36:43 +0200
committerChristoph Studer <chstuder@google.com>2014-05-21 22:03:45 +0200
commitcee44ba418bef83571349acb2d24ef29833502e0 (patch)
tree87805ba12348d620860ba5803d5f20146cb2c684 /services
parent5b53148a4e8d47b88362703445010c54f9fd6ecc (diff)
downloadframeworks_base-cee44ba418bef83571349acb2d24ef29833502e0.zip
frameworks_base-cee44ba418bef83571349acb2d24ef29833502e0.tar.gz
frameworks_base-cee44ba418bef83571349acb2d24ef29833502e0.tar.bz2
Simplify NotificationListenerService API
Use ParceledListSlice to send the list of active notifications from NoMan to NotificationListeners. This allows us to simplify the API to what it was before introducing the "String[] key" workaround for dealing with large numbers of StatusBarNotifications. While we're at it, rename Ranking.getIndexOfKey to something that makes more sense. Bug: 15126927 Change-Id: I02c2087978c6c4ec1198be496c6250a66143ecb3
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java33
1 files changed, 9 insertions, 24 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 2945418..0b3e02a 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -40,6 +40,7 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ParceledListSlice;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.Bitmap;
@@ -1359,44 +1360,28 @@ public class NotificationManagerService extends SystemService {
* should be used.
*
* @param token The binder for the listener, to check that the caller is allowed
- * @param keys the notification keys to fetch, or null for all active notifications.
* @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 StatusBarNotification[] getActiveNotificationsFromListener(
- INotificationListener token, String[] keys) {
+ public ParceledListSlice<StatusBarNotification> getActiveNotificationsFromListener(
+ INotificationListener token) {
synchronized (mNotificationList) {
final ManagedServiceInfo info = mListeners.checkServiceTokenLocked(token);
final ArrayList<StatusBarNotification> list
= new ArrayList<StatusBarNotification>();
- if (keys == null) {
- final int N = mNotificationList.size();
- for (int i=0; i<N; i++) {
- StatusBarNotification sbn = mNotificationList.get(i).sbn;
- if (info.enabledAndUserMatches(sbn.getUserId())) {
- list.add(sbn);
- }
- }
- } else {
- final int N = keys.length;
- for (int i=0; i<N; i++) {
- NotificationRecord r = mNotificationsByKey.get(keys[i]);
- if (r != null && info.enabledAndUserMatches(r.sbn.getUserId())) {
- list.add(r.sbn);
- }
+ final int N = mNotificationList.size();
+ for (int i=0; i<N; i++) {
+ StatusBarNotification sbn = mNotificationList.get(i).sbn;
+ if (info.enabledAndUserMatches(sbn.getUserId())) {
+ list.add(sbn);
}
}
- return list.toArray(new StatusBarNotification[list.size()]);
+ return new ParceledListSlice<StatusBarNotification>(list);
}
}
@Override
- public String[] getActiveNotificationKeysFromListener(INotificationListener token) {
- return NotificationManagerService.this.getActiveNotificationKeys(token);
- }
-
- @Override
public ZenModeConfig getZenModeConfig() {
checkCallerIsSystem();
return mZenModeHelper.getConfig();