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

Commit cc2c4524 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allow specifying "platform" as cert for default permissions" into main

parents db37187c a2d09fed
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -1637,11 +1637,13 @@ final class DefaultPermissionGrantPolicy {
    private boolean isSystemOrCertificateMatchingPackage(PackageInfo pi, String cert) {
    private boolean isSystemOrCertificateMatchingPackage(PackageInfo pi, String cert) {
        if (cert == null) {
        if (cert == null) {
            return pi.applicationInfo.isSystemApp();
            return pi.applicationInfo.isSystemApp();
        }
        } else if (Objects.equals(cert, "platform")) {

            return mServiceInternal.isPlatformSigned(pi.packageName);
        } else {
            return mContext.getPackageManager().hasSigningCertificate(pi.packageName, HexEncoding.
            return mContext.getPackageManager().hasSigningCertificate(pi.packageName, HexEncoding.
                    decode(cert.replace(":", "")), PackageManager.CERT_INPUT_SHA256);
                    decode(cert.replace(":", "")), PackageManager.CERT_INPUT_SHA256);
        }
        }
    }


    private static boolean doesPackageSupportRuntimePermissions(PackageInfo pkg) {
    private static boolean doesPackageSupportRuntimePermissions(PackageInfo pkg) {
        return pkg.applicationInfo != null
        return pkg.applicationInfo != null