diff --git a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java index b7ab381a08b5d..f466655914c8c 100644 --- a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java +++ b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java @@ -41,6 +41,7 @@ import android.compat.annotation.ChangeId; import android.compat.annotation.EnabledSince; import android.content.Context; import android.content.Intent; +import android.content.IntentFilter; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.ComponentInfo; @@ -1125,13 +1126,18 @@ public class PackageManagerServiceUtils { throw new IllegalArgumentException("Unsupported component type"); } - if (comp.getIntents().isEmpty()) { + if (comp == null || comp.getIntents().isEmpty()) { continue; } - final boolean match = comp.getIntents().stream().anyMatch( - f -> IntentResolver.intentMatchesFilter(f.getIntentFilter(), intent, - resolvedType)); + boolean match = false; + for (int j = 0, size = comp.getIntents().size(); j < size; ++j) { + IntentFilter intentFilter = comp.getIntents().get(j).getIntentFilter(); + if (IntentResolver.intentMatchesFilter(intentFilter, intent, resolvedType)) { + match = true; + break; + } + } if (!match) { Slog.w(TAG, "Intent does not match component's intent filter: " + intent); Slog.w(TAG, "Access blocked: " + comp.getComponentName());