Fix cross user package visibility leakage for PackageManager (2/n)

API:
- PackageManager#isPackageSuspended

Bug: 214394701
Test: atest CrossUserPackageVisibilityTests
Change-Id: Ibe8f7ed8b1dcaa47a6c35593a013957fa3293ab4
This commit is contained in:
Rhed Jao
2022-04-14 17:30:36 +08:00
parent f5f55f4171
commit bad3a9b80b

View File

@@ -4990,7 +4990,7 @@ public class ComputerEngine implements Computer {
enforceCrossUserPermission(callingUid, userId, true /* requireFullPermission */,
false /* checkShell */, "isPackageSuspendedForUser for user " + userId);
final PackageStateInternal ps = mSettings.getPackage(packageName);
if (ps == null || shouldFilterApplication(ps, callingUid, userId)) {
if (ps == null || shouldFilterApplicationIncludingUninstalled(ps, callingUid, userId)) {
throw new IllegalArgumentException("Unknown target package: " + packageName);
}
return ps.getUserStateOrDefault(userId).isSuspended();