Allow the system server to query suspendable packages on any user.

Test: atest
com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testPersonalAppsSuspensionIme
on headless system user device
Fixes: 256837990

Change-Id: I519e7dbc038d1a33e0123207c1b5c5685e150207
This commit is contained in:
Jonathan Scott
2022-11-02 19:13:44 +00:00
parent d5e557e4fd
commit f8fe973289

View File

@@ -5055,8 +5055,11 @@ public class PackageManagerService implements PackageSender, TestUtilityService
"getUnsuspendablePackagesForUser");
final int callingUid = Binder.getCallingUid();
if (UserHandle.getUserId(callingUid) != userId) {
throw new SecurityException("Calling uid " + callingUid
+ " cannot query getUnsuspendablePackagesForUser for user " + userId);
mContext.enforceCallingOrSelfPermission(
Manifest.permission.INTERACT_ACROSS_USERS_FULL,
"Calling uid " + callingUid
+ " cannot query getUnsuspendablePackagesForUser for user "
+ userId);
}
return mSuspendPackageHelper.getUnsuspendablePackagesForUser(snapshotComputer(),
packageNames, userId, callingUid);