Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a925a8a4 authored by Alex Buynytskyy's avatar Alex Buynytskyy
Browse files

Fix sufficient verifiers.

Bug: 267186415
Test: presubmit
Change-Id: I1c8a09f45af281c582d7fca95498fbc392f4bcb1
parent 58c5f1da
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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;
                }

+5 −0
Original line number Diff line number Diff line
@@ -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.