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: I435e0160128591b50ddd5998e7c558b78aaca9b1
This commit is contained in:
@@ -9167,6 +9167,11 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
*/
|
||||
@Override
|
||||
public String[] getPackagesForUid(int uid) {
|
||||
final int callingUid = Binder.getCallingUid();
|
||||
final int userId = UserHandle.getUserId(uid);
|
||||
enforceCrossUserOrProfilePermission(callingUid, userId,
|
||||
/* requireFullPermission */ false,
|
||||
/* checkShell */ false, "getPackagesForUid");
|
||||
return snapshotComputer().getPackagesForUid(uid);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user