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

Commit bd8ce384 authored by Daniel Cashman's avatar Daniel Cashman
Browse files

Clarify PackageManager.hasSigningCertificate docs.

Address API review by describing relationship between the
PackageManager.hasSigningCertificate() methods and the PackageInfo
GET_SIGNING_CERTIFICATES method, as well as differentiating the
UID documentation from the package-name based one.

Bug: 74831566
Test: None, doc change.
Change-Id: I11c556325f9b2efbc2e5e1cf896b9c58db092ae8
parent 0f96324f
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -6131,7 +6131,9 @@ public abstract class PackageManager {
     * signed.  This should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES}
     * since it takes into account the possibility of signing certificate rotation, except in the
     * case of packages that are signed by multiple certificates, for which signing certificate
     * rotation is not supported.
     * rotation is not supported.  This method is analogous to using {@code getPackageInfo} with
     * {@code GET_SIGNING_CERTIFICATES} and then searching through the resulting {@code
     * signingCertificateHistory} field to see if the desired certificate is present.
     *
     * @param packageName package whose signing certificates to check
     * @param certificate signing certificate for which to search
@@ -6145,13 +6147,19 @@ public abstract class PackageManager {
    }

    /**
     * Searches the set of signing certificates by which the given uid has proven to have been
     * signed.  This should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES}
     * Searches the set of signing certificates by which the package(s) for the given uid has proven
     * to have been signed.  For multiple packages sharing the same uid, this will return the
     * signing certificates found in the signing history of the "newest" package, where "newest"
     * indicates the package with the newest signing certificate in the shared uid group.  This
     * method should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES}
     * since it takes into account the possibility of signing certificate rotation, except in the
     * case of packages that are signed by multiple certificates, for which signing certificate
     * rotation is not supported.
     * rotation is not supported. This method is analogous to using {@code getPackagesForUid}
     * followed by {@code getPackageInfo} with {@code GET_SIGNING_CERTIFICATES}, selecting the
     * {@code PackageInfo} of the newest-signed bpackage , and finally searching through the
     * resulting {@code signingCertificateHistory} field to see if the desired certificate is there.
     *
     * @param uid package whose signing certificates to check
     * @param uid uid whose signing certificates to check
     * @param certificate signing certificate for which to search
     * @param type representation of the {@code certificate}
     * @return true if this package was or is signed by exactly the certificate {@code certificate}