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

Commit 1dafc385 authored by Jackal Guo's avatar Jackal Guo
Browse files

Enfore cross user permission to getPackagesForUid

Apps could use getPackagesForUid with given UID to query if there
is a installed and get its package name across user. Expect for
package visibility filtering, we also need to ensure across-user
calls come with appropriate permission.

Bug: 167654926
Test: atest ApplicationVisibilityTest
Change-Id: I1172177298cd084430c612f50e4b921b92d4a1c3
parent 77bb0b72
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3845,6 +3845,8 @@ public class PackageManagerService extends IPackageManager.Stub
            final boolean isCallerInstantApp = getInstantAppPackageName(callingUid) != null;
            final int userId = UserHandle.getUserId(uid);
            final int appId = UserHandle.getAppId(uid);
            enforceCrossUserPermission(callingUid, userId,
                    /* requireFullPermission */ false, /* checkShell */ false, "getPackagesForUid");
            return getPackagesForUidInternalBody(callingUid, userId, appId, isCallerInstantApp);
        }