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

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icc3d6d497630166902d1908718402bd60cc3f015
This commit is contained in:
Suprabh Shukla
2021-02-06 01:33:53 +00:00
committed by Automerger Merge Worker

View File

@@ -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);