Merge "Fix sufficient verifiers."

This commit is contained in:
Alex Buynytskyy
2023-01-30 21:56:59 +00:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 2 deletions

View File

@@ -6205,8 +6205,12 @@ public class PackageManagerService implements PackageSender, TestUtilityService
mHandler.post(() -> {
final int id = verificationId >= 0 ? verificationId : -verificationId;
final PackageVerificationState state = mPendingVerification.get(id);
if (state == null || !state.checkRequiredVerifierUid(callingUid)) {
// Only allow calls from required verifiers.
if (state == null) {
return;
}
if (!state.checkRequiredVerifierUid(callingUid)
&& !state.checkSufficientVerifierUid(callingUid)) {
// Only allow calls from verifiers.
return;
}

View File

@@ -83,6 +83,11 @@ class PackageVerificationState {
mSufficientVerifierUids.put(uid, true);
}
/** Returns true if the uid a sufficient verifier. */
boolean checkSufficientVerifierUid(int uid) {
return mSufficientVerifierUids.get(uid, false);
}
/**
* Should be called when a verification is received from an agent so the state of the package
* verification can be tracked.