From 76aa2deba7ae062787ba371a5005ea6118efcecd Mon Sep 17 00:00:00 2001 From: Patrick Baumann Date: Tue, 7 Jul 2020 11:43:38 -0700 Subject: 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 --- services/core/java/com/android/server/pm/AppsFilter.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/pm/AppsFilter.java b/services/core/java/com/android/server/pm/AppsFilter.java index 3a203d52edbe..c3c2e5e65103 100644 --- a/services/core/java/com/android/server/pm/AppsFilter.java +++ b/services/core/java/com/android/server/pm/AppsFilter.java @@ -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 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)) { -- cgit v1.2.3-59-g8ed1b