Revert "Add the checking of the package installed state"

Revert "Ensure getting UID/GID checks the installed state"

Revert submission 14700843-b186180067_main

Reason for revert: Break WM presubmit (b/189728752)
Reverted Changes:
I3d7c35dc2:Add the checking of the package installed state
I035eeca76:Ensure getting UID/GID checks the installed state
Iaac8e56f3:Use userId to query the package uid instead of 0.
I0c452d880:Add MATCH_ANY_USER flag when get valid package uid...

Change-Id: I37ae40cc25b76b4e7318531400b0c12711bf01b1
This commit is contained in:
Jackal Guo
2021-05-31 08:01:32 +00:00
parent 981d9955fd
commit 637ec21af7

View File

@@ -4215,11 +4215,11 @@ public class PackageManagerService extends IPackageManager.Stub
// reader
final AndroidPackage p = mPackages.get(packageName);
if (p != null && AndroidPackageUtils.isMatchForSystemOnly(p, flags)) {
final PackageSetting ps = getPackageSettingInternal(p.getPackageName(), callingUid);
if (ps != null && ps.getInstalled(userId)
&& !shouldFilterApplicationLocked(ps, callingUid, userId)) {
return UserHandle.getUid(userId, p.getUid());
PackageSetting ps = getPackageSettingInternal(p.getPackageName(), callingUid);
if (shouldFilterApplicationLocked(ps, callingUid, userId)) {
return -1;
}
return UserHandle.getUid(userId, p.getUid());
}
if ((flags & MATCH_KNOWN_PACKAGES) != 0) {
final PackageSetting ps = mSettings.getPackageLPr(packageName);
@@ -8579,11 +8579,13 @@ public class PackageManagerService extends IPackageManager.Stub
synchronized (mLock) {
final AndroidPackage p = mPackages.get(packageName);
if (p != null && AndroidPackageUtils.isMatchForSystemOnly(p, flags)) {
final PackageSetting ps = getPackageSetting(p.getPackageName());
if (ps != null && ps.getInstalled(userId)
&& !shouldFilterApplicationLocked(ps, callingUid, userId)) {
return mPermissionManager.getGidsForUid(UserHandle.getUid(userId, ps.appId));
PackageSetting ps = getPackageSetting(p.getPackageName());
if (shouldFilterApplicationLocked(ps, callingUid, userId)) {
return null;
}
// TODO: Shouldn't this be checking for package installed state for userId and
// return null?
return mPermissionManager.getGidsForUid(UserHandle.getUid(userId, ps.appId));
}
if ((flags & MATCH_KNOWN_PACKAGES) != 0) {
final PackageSetting ps = mSettings.getPackageLPr(packageName);
@@ -12206,7 +12208,6 @@ public class PackageManagerService extends IPackageManager.Stub
}
}
builder.append(" to access user ");
builder.append(userId);
builder.append(".");
return builder.toString();
}