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

Commit 44edc937 authored by Rhed Jao's avatar Rhed Jao
Browse files

Fix cross user package visibility leakage for canPackageQuery API

Returns false if the target packages are not installed under the
calling user.

Bug: 229684723
Test: atest CrossUserPackageVisibilityTests
Change-Id: Ie76f85bef808c3fef366d334978d007691f43991
parent 6e8d0f67
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -5547,7 +5547,7 @@ public class ComputerEngine implements Computer {
        final PackageStateInternal packageState =
                getPackageStateInternal(component.getPackageName());
        return packageState != null && !shouldFilterApplication(packageState, callingUid,
                component, TYPE_UNKNOWN, userId);
                component, TYPE_UNKNOWN, userId, true /* filterUninstall */);
    }

    @Override
@@ -5591,9 +5591,9 @@ public class ComputerEngine implements Computer {
        boolean throwException = sourceSetting == null || targetSetting == null;
        if (!throwException) {
            final boolean filterSource =
                    shouldFilterApplication(sourceSetting, callingUid, userId);
                    shouldFilterApplicationIncludingUninstalled(sourceSetting, callingUid, userId);
            final boolean filterTarget =
                    shouldFilterApplication(targetSetting, callingUid, userId);
                    shouldFilterApplicationIncludingUninstalled(targetSetting, callingUid, userId);
            // The caller must have visibility of the both packages
            throwException = filterSource || filterTarget;
        }