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
This commit is contained in:
@@ -3845,6 +3845,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
final boolean isCallerInstantApp = getInstantAppPackageName(callingUid) != null;
|
final boolean isCallerInstantApp = getInstantAppPackageName(callingUid) != null;
|
||||||
final int userId = UserHandle.getUserId(uid);
|
final int userId = UserHandle.getUserId(uid);
|
||||||
final int appId = UserHandle.getAppId(uid);
|
final int appId = UserHandle.getAppId(uid);
|
||||||
|
enforceCrossUserPermission(callingUid, userId,
|
||||||
|
/* requireFullPermission */ false, /* checkShell */ false, "getPackagesForUid");
|
||||||
return getPackagesForUidInternalBody(callingUid, userId, appId, isCallerInstantApp);
|
return getPackagesForUidInternalBody(callingUid, userId, appId, isCallerInstantApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user