Merge "Fix for: NPE when intent.component set to ResolverActivity." into tm-qpr-dev am: df9d2dc291

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20691720

Change-Id: Ic84b53c11b64351f95cdca7df263e2de749d6354
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Patrick Baumann
2022-12-13 22:14:11 +00:00
committed by Automerger Merge Worker

View File

@@ -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;
@@ -1133,9 +1134,14 @@ public class PackageManagerServiceUtils {
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());