OSDN Git Service

Remove streams from system_server
authorJulia Reynolds <juliacr@google.com>
Mon, 16 Apr 2018 17:17:01 +0000 (13:17 -0400)
committerJulia Reynolds <juliacr@google.com>
Mon, 16 Apr 2018 17:17:01 +0000 (13:17 -0400)
Test: runtest systemui-notification
Change-Id: I9ceaabfe6ac5fd64a4f93ca6f4521b7caf0c222d
Fixes: 77972263

services/core/java/com/android/server/notification/ManagedServices.java

index c98f6a2..4c8b91b 100644 (file)
@@ -467,8 +467,12 @@ abstract public class ManagedServices {
                 mApproved.getOrDefault(userId, new ArrayMap<>());
         for (int i = 0; i < allowedByType.size(); i++) {
             final ArraySet<String> allowed = allowedByType.valueAt(i);
-            allowedComponents.addAll(allowed.stream().map(ComponentName::unflattenFromString)
-                    .filter(out -> out != null).collect(Collectors.toList()));
+            for (int j = 0; j < allowed.size(); j++) {
+                ComponentName cn = ComponentName.unflattenFromString(allowed.valueAt(j));
+                if (cn != null) {
+                    allowedComponents.add(cn);
+                }
+            }
         }
         return allowedComponents;
     }
@@ -479,10 +483,12 @@ abstract public class ManagedServices {
                 mApproved.getOrDefault(userId, new ArrayMap<>());
         for (int i = 0; i < allowedByType.size(); i++) {
             final ArraySet<String> allowed = allowedByType.valueAt(i);
-            allowedPackages.addAll(
-                    allowed.stream().map(this::getPackageName).
-                            filter(value -> !TextUtils.isEmpty(value))
-                            .collect(Collectors.toList()));
+            for (int j = 0; j < allowed.size(); j++) {
+                String pkgName = getPackageName(allowed.valueAt(j));
+                if (!TextUtils.isEmpty(pkgName)) {
+                    allowedPackages.add(pkgName);
+                }
+            }
         }
         return allowedPackages;
     }