Fixes NPE on null pkg

This change moves unprotected access of a setting's pkg field to take
place after an existing null check.

Test: atest AppEnumerationTests
Fixes: 157298411
Change-Id: I49c0cb0d08dd09cabd271cf195a8eff71a98083c
This commit is contained in:
Patrick Baumann
2020-05-26 06:28:33 -07:00
parent a543dfde92
commit 0bc18b37ac

View File

@@ -446,11 +446,6 @@ public class AppsFilter {
}
}
if (!newPkgSetting.pkg.getProtectedBroadcasts().isEmpty()) {
mProtectedBroadcasts.addAll(newPkgSetting.pkg.getProtectedBroadcasts());
recomputeComponentVisibility(existingSettings, newPkgSetting.pkg.getPackageName());
}
Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "filter.addPackage");
try {
final AndroidPackage newPkg = newPkgSetting.pkg;
@@ -459,6 +454,11 @@ public class AppsFilter {
return;
}
if (!newPkg.getProtectedBroadcasts().isEmpty()) {
mProtectedBroadcasts.addAll(newPkg.getProtectedBroadcasts());
recomputeComponentVisibility(existingSettings, newPkg.getPackageName());
}
final boolean newIsForceQueryable =
mForceQueryable.contains(newPkgSetting.appId)
/* shared user that is already force queryable */