From a90c8def2c6762bc6e5396b78c43e65e4b05079d Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 7 Jul 2015 17:25:25 -0700 Subject: Add new "preinstalled" permission flag. This allows you to specify that a permission can be granted to any pre-installed system app (not just privileged ones). And as long as I am doing this, clean up the old "system" permission flag, renaming it to "privileged" which is what it really is today, deprecating the old names. And switch the platform's permission declarations to use the new name. Change-Id: Iabf484746af232144786851ec7fe90e3de9dddb2 --- core/java/android/content/pm/PermissionInfo.java | 29 ++++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/content/pm/PermissionInfo.java b/core/java/android/content/pm/PermissionInfo.java index 1857ecf..2828d83 100644 --- a/core/java/android/content/pm/PermissionInfo.java +++ b/core/java/android/content/pm/PermissionInfo.java @@ -48,17 +48,25 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable { public static final int PROTECTION_SIGNATURE = 2; /** - * System-level value for {@link #protectionLevel}, corresponding - * to the signatureOrSystem value of - * {@link android.R.attr#protectionLevel}. + * @deprecated Use {@link #PROTECTION_SIGNATURE}|{@link #PROTECTION_FLAG_PRIVILEGED} + * instead. */ + @Deprecated public static final int PROTECTION_SIGNATURE_OR_SYSTEM = 3; /** * Additional flag for {@link #protectionLevel}, corresponding - * to the system value of + * to the privileged value of * {@link android.R.attr#protectionLevel}. */ + public static final int PROTECTION_FLAG_PRIVILEGED = 0x10; + + /** + * @deprecated Old name for {@link #PROTECTION_FLAG_PRIVILEGED}, which + * is now very confusing because it only applies to privileged apps, not all + * apps on the system image. + */ + @Deprecated public static final int PROTECTION_FLAG_SYSTEM = 0x10; /** @@ -97,6 +105,13 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable { public static final int PROTECTION_FLAG_VERIFIER = 0x200; /** + * Additional flag for {@link #protectionLevel}, corresponding + * to the preinstalled value of + * {@link android.R.attr#protectionLevel}. + */ + public static final int PROTECTION_FLAG_PREINSTALLED = 0x400; + + /** * Mask for {@link #protectionLevel}: the basic protection type. */ public static final int PROTECTION_MASK_BASE = 0xf; @@ -161,7 +176,7 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable { /** @hide */ public static int fixProtectionLevel(int level) { if (level == PROTECTION_SIGNATURE_OR_SYSTEM) { - level = PROTECTION_SIGNATURE | PROTECTION_FLAG_SYSTEM; + level = PROTECTION_SIGNATURE | PROTECTION_FLAG_PRIVILEGED; } return level; } @@ -183,8 +198,8 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable { protLevel = "signatureOrSystem"; break; } - if ((level&PermissionInfo.PROTECTION_FLAG_SYSTEM) != 0) { - protLevel += "|system"; + if ((level&PermissionInfo.PROTECTION_FLAG_PRIVILEGED) != 0) { + protLevel += "|privileged"; } if ((level&PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0) { protLevel += "|development"; -- cgit v1.1