Apply package visibility in getPackageForUid for shared UID apps

Add package visibility filtering to the implementation in the branching
for shared UID.

Bug: 167656333
Test: CtsAppEnumerationTestCases
Change-Id: Ic1a40bfad53ac4d9110cef385b771fd7e9ccde3a
This commit is contained in:
Jackal Guo
2021-01-28 14:13:10 +08:00
parent 77bb0b7291
commit aaee6c74a5

View File

@@ -3862,7 +3862,8 @@ public class PackageManagerService extends IPackageManager.Stub
int i = 0;
for (int index = 0; index < N; index++) {
final PackageSetting ps = sus.packages.valueAt(index);
if (ps.getInstalled(userId)) {
if (ps.getInstalled(userId)
&& !shouldFilterApplicationLocked(ps, callingUid, userId)) {
res[i++] = ps.name;
}
}