am 1468841a: Merge "NoMan: Don\'t unbind system listeners" into lmp-preview-dev
* commit '1468841afc1431ddd0d3c843e41fa7a14c16e430':
NoMan: Don't unbind system listeners
diff --git a/services/core/java/com/android/server/notification/ManagedServices.java b/services/core/java/com/android/server/notification/ManagedServices.java
index b94ea62..1b1fc8b 100644
--- a/services/core/java/com/android/server/notification/ManagedServices.java
+++ b/services/core/java/com/android/server/notification/ManagedServices.java
@@ -259,13 +259,17 @@
userIds[i]));
}
- ManagedServiceInfo[] toRemove = new ManagedServiceInfo[mServices.size()];
+ ArrayList<ManagedServiceInfo> toRemove = new ArrayList<ManagedServiceInfo>();
final SparseArray<ArrayList<ComponentName>> toAdd
= new SparseArray<ArrayList<ComponentName>>();
synchronized (mMutex) {
- // unbind and remove all existing services
- toRemove = mServices.toArray(toRemove);
+ // Unbind automatically bound services, retain system services.
+ for (ManagedServiceInfo service : mServices) {
+ if (!service.isSystem) {
+ toRemove.add(service);
+ }
+ }
final ArraySet<ComponentName> newEnabled = new ArraySet<ComponentName>();
final ArraySet<String> newPackages = new ArraySet<String>();