Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76aa2deb authored by Patrick Baumann's avatar Patrick Baumann
Browse files

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
parent 2d695313
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -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)) {