Fixes component-based visibility recompute

This change fixes a bug that was resulting in any forceQueryable
package's queries->intent tags to be ignored. The logic in the
recomputeComponentVisibility was skipping if the source was force
queryable instead of the target. This change fixes that and adds the
correct check for the source (has QUERY_ALL_PACKAGES)

Test: atest AppEnumerationTests AppsFilterTest
Fixes: 159626154
Change-Id: Iaba1c52e6d645db43715642e7db9eaacdfeefb7d
This commit is contained in:
Patrick Baumann
2020-07-07 11:43:38 -07:00
parent 2d695313c9
commit 76aa2deba7

View File

@@ -708,12 +708,15 @@ public class AppsFilter {
return ret;
}
/**
* This method recomputes all component / intent-based visibility and is intended to match the
* relevant logic of {@link #addPackageInternal(PackageSetting, ArrayMap)}
*/
private void recomputeComponentVisibility(ArrayMap<String, PackageSetting> existingSettings) {
mQueriesViaComponent.clear();
for (int i = existingSettings.size() - 1; i >= 0; i--) {
PackageSetting setting = existingSettings.valueAt(i);
if (setting.pkg == null
|| mForceQueryable.contains(setting.appId)) {
if (setting.pkg == null || requestsQueryAllPackages(setting.pkg)) {
continue;
}
for (int j = existingSettings.size() - 1; j >= 0; j--) {
@@ -721,7 +724,7 @@ public class AppsFilter {
continue;
}
final PackageSetting otherSetting = existingSettings.valueAt(j);
if (otherSetting.pkg == null) {
if (otherSetting.pkg == null || mForceQueryable.contains(otherSetting.appId)) {
continue;
}
if (canQueryViaComponents(setting.pkg, otherSetting.pkg, mProtectedBroadcasts)) {