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

Commit 4a88e2c6 authored by Suprabh Shukla's avatar Suprabh Shukla Committed by Automerger Merge Worker
Browse files

Merge "Relax restrictions on appop protection level" into sc-dev am: e5cb2b87

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13473684

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icc3d6d497630166902d1908718402bd60cc3f015
parents 0bf529b2 e5cb2b87
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -108,17 +108,14 @@ public class ParsedPermissionUtils {

        permission.protectionLevel = PermissionInfo.fixProtectionLevel(permission.protectionLevel);

        if (permission.getProtectionFlags() != 0) {
            if ((permission.protectionLevel & PermissionInfo.PROTECTION_FLAG_INSTANT) == 0
                    && (permission.protectionLevel & PermissionInfo.PROTECTION_FLAG_RUNTIME_ONLY)
                    == 0
                    && (permission.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE)
                    != PermissionInfo.PROTECTION_SIGNATURE
                    && (permission.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE)
                    != PermissionInfo.PROTECTION_INTERNAL) {
                return input.error("<permission>  protectionLevel specifies a non-instant flag "
                        + "but is not based on signature or internal type");
            }
        final int otherProtectionFlags = permission.getProtectionFlags()
                & ~(PermissionInfo.PROTECTION_FLAG_APPOP | PermissionInfo.PROTECTION_FLAG_INSTANT
                | PermissionInfo.PROTECTION_FLAG_RUNTIME_ONLY);
        if (otherProtectionFlags != 0
                && permission.getProtection() != PermissionInfo.PROTECTION_SIGNATURE
                && permission.getProtection() != PermissionInfo.PROTECTION_INTERNAL) {
            return input.error("<permission> protectionLevel specifies a non-instant, non-appop,"
                    + " non-runtimeOnly flag but is not based on signature or internal type");
        }

        return ComponentParseUtils.parseAllMetaData(pkg, res, parser, tag, permission, input);