Add new APIs for permission group flags and priorities.
Change-Id: I2d476c6aa9dbd05407ec49be45986f42d2acf9e7
This commit is contained in:
@ -88,6 +88,7 @@ package android {
|
||||
field public static final java.lang.String READ_SOCIAL_STREAM = "android.permission.READ_SOCIAL_STREAM";
|
||||
field public static final java.lang.String READ_SYNC_SETTINGS = "android.permission.READ_SYNC_SETTINGS";
|
||||
field public static final java.lang.String READ_SYNC_STATS = "android.permission.READ_SYNC_STATS";
|
||||
field public static final java.lang.String READ_USER_DICTIONARY = "android.permission.READ_USER_DICTIONARY";
|
||||
field public static final java.lang.String REBOOT = "android.permission.REBOOT";
|
||||
field public static final java.lang.String RECEIVE_BOOT_COMPLETED = "android.permission.RECEIVE_BOOT_COMPLETED";
|
||||
field public static final java.lang.String RECEIVE_MMS = "android.permission.RECEIVE_MMS";
|
||||
@ -134,6 +135,7 @@ package android {
|
||||
field public static final java.lang.String WRITE_SMS = "android.permission.WRITE_SMS";
|
||||
field public static final java.lang.String WRITE_SOCIAL_STREAM = "android.permission.WRITE_SOCIAL_STREAM";
|
||||
field public static final java.lang.String WRITE_SYNC_SETTINGS = "android.permission.WRITE_SYNC_SETTINGS";
|
||||
field public static final java.lang.String WRITE_USER_DICTIONARY = "android.permission.WRITE_USER_DICTIONARY";
|
||||
}
|
||||
|
||||
public static final class Manifest.permission_group {
|
||||
@ -738,6 +740,7 @@ package android {
|
||||
field public static final int pathPrefix = 16842795; // 0x101002b
|
||||
field public static final int permission = 16842758; // 0x1010006
|
||||
field public static final int permissionGroup = 16842762; // 0x101000a
|
||||
field public static final int permissionGroupFlags = 16843700; // 0x10103b4
|
||||
field public static final int persistent = 16842765; // 0x101000d
|
||||
field public static final int persistentDrawingCache = 16842990; // 0x10100ee
|
||||
field public static final deprecated int phoneNumber = 16843111; // 0x1010167
|
||||
@ -6577,8 +6580,11 @@ package android.content.pm {
|
||||
method public int describeContents();
|
||||
method public java.lang.CharSequence loadDescription(android.content.pm.PackageManager);
|
||||
field public static final android.os.Parcelable.Creator CREATOR;
|
||||
field public static final int FLAG_PERSONAL_INFO = 1; // 0x1
|
||||
field public int descriptionRes;
|
||||
field public int flags;
|
||||
field public java.lang.CharSequence nonLocalizedDescription;
|
||||
field public int priority;
|
||||
}
|
||||
|
||||
public class PermissionInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
|
||||
|
@ -970,7 +970,7 @@ public class PackageParser {
|
||||
return null;
|
||||
}
|
||||
} else if (tagName.equals("permission-group")) {
|
||||
if (parsePermissionGroup(pkg, res, parser, attrs, outError) == null) {
|
||||
if (parsePermissionGroup(pkg, flags, res, parser, attrs, outError) == null) {
|
||||
return null;
|
||||
}
|
||||
} else if (tagName.equals("permission")) {
|
||||
@ -1432,7 +1432,7 @@ public class PackageParser {
|
||||
return buildCompoundName(pkg, procSeq, "taskAffinity", outError);
|
||||
}
|
||||
|
||||
private PermissionGroup parsePermissionGroup(Package owner, Resources res,
|
||||
private PermissionGroup parsePermissionGroup(Package owner, int flags, Resources res,
|
||||
XmlPullParser parser, AttributeSet attrs, String[] outError)
|
||||
throws XmlPullParserException, IOException {
|
||||
PermissionGroup perm = new PermissionGroup(owner);
|
||||
@ -1454,6 +1454,13 @@ public class PackageParser {
|
||||
perm.info.descriptionRes = sa.getResourceId(
|
||||
com.android.internal.R.styleable.AndroidManifestPermissionGroup_description,
|
||||
0);
|
||||
perm.info.flags = sa.getInt(
|
||||
com.android.internal.R.styleable.AndroidManifestPermissionGroup_permissionGroupFlags, 0);
|
||||
perm.info.priority = sa.getInt(
|
||||
com.android.internal.R.styleable.AndroidManifestPermissionGroup_priority, 0);
|
||||
if (perm.info.priority > 0 && (flags&PARSE_IS_SYSTEM) != 0) {
|
||||
perm.info.priority = 0;
|
||||
}
|
||||
|
||||
sa.recycle();
|
||||
|
||||
|
@ -41,6 +41,23 @@ public class PermissionGroupInfo extends PackageItemInfo implements Parcelable {
|
||||
*/
|
||||
public CharSequence nonLocalizedDescription;
|
||||
|
||||
/**
|
||||
* Flag for {@link #flags}, corresponding to <code>personalInfo</code>
|
||||
* value of {@link android.R.attr#permissionGroupFlags}.
|
||||
*/
|
||||
public static final int FLAG_PERSONAL_INFO = 1<<0;
|
||||
|
||||
/**
|
||||
* Additional flags about this group as given by
|
||||
* {@link android.R.attr#permissionGroupFlags}.
|
||||
*/
|
||||
public int flags;
|
||||
|
||||
/**
|
||||
* Prioritization of this group, for visually sorting with other groups.
|
||||
*/
|
||||
public int priority;
|
||||
|
||||
public PermissionGroupInfo() {
|
||||
}
|
||||
|
||||
@ -48,6 +65,8 @@ public class PermissionGroupInfo extends PackageItemInfo implements Parcelable {
|
||||
super(orig);
|
||||
descriptionRes = orig.descriptionRes;
|
||||
nonLocalizedDescription = orig.nonLocalizedDescription;
|
||||
flags = orig.flags;
|
||||
priority = orig.priority;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,7 +96,7 @@ public class PermissionGroupInfo extends PackageItemInfo implements Parcelable {
|
||||
public String toString() {
|
||||
return "PermissionGroupInfo{"
|
||||
+ Integer.toHexString(System.identityHashCode(this))
|
||||
+ " " + name + "}";
|
||||
+ " " + name + " flgs=0x" + Integer.toHexString(flags) + "}";
|
||||
}
|
||||
|
||||
public int describeContents() {
|
||||
@ -88,6 +107,8 @@ public class PermissionGroupInfo extends PackageItemInfo implements Parcelable {
|
||||
super.writeToParcel(dest, parcelableFlags);
|
||||
dest.writeInt(descriptionRes);
|
||||
TextUtils.writeToParcel(nonLocalizedDescription, dest, parcelableFlags);
|
||||
dest.writeInt(flags);
|
||||
dest.writeInt(priority);
|
||||
}
|
||||
|
||||
public static final Creator<PermissionGroupInfo> CREATOR =
|
||||
@ -104,5 +125,7 @@ public class PermissionGroupInfo extends PackageItemInfo implements Parcelable {
|
||||
super(source);
|
||||
descriptionRes = source.readInt();
|
||||
nonLocalizedDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
|
||||
flags = source.readInt();
|
||||
priority = source.readInt();
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +258,8 @@
|
||||
expressed as two distinct permissions). -->
|
||||
<permission-group android:name="android.permission-group.PERSONAL_INFO"
|
||||
android:label="@string/permgrouplab_personalInfo"
|
||||
android:description="@string/permgroupdesc_personalInfo" />
|
||||
android:description="@string/permgroupdesc_personalInfo"
|
||||
android:permissionGroupFlags="personalInfo" />
|
||||
|
||||
<!-- Allows an application to read the user's contacts data. -->
|
||||
<permission android:name="android.permission.READ_CONTACTS"
|
||||
@ -338,16 +339,14 @@
|
||||
|
||||
<!-- Allows an application to read the user dictionary. This should
|
||||
really only be required by an IME, or a dictionary editor like
|
||||
the Settings app.
|
||||
@hide Pending API council approval -->
|
||||
the Settings app. -->
|
||||
<permission android:name="android.permission.READ_USER_DICTIONARY"
|
||||
android:permissionGroup="android.permission-group.PERSONAL_INFO"
|
||||
android:protectionLevel="dangerous"
|
||||
android:label="@string/permlab_readDictionary"
|
||||
android:description="@string/permdesc_readDictionary" />
|
||||
|
||||
<!-- Allows an application to write to the user dictionary.
|
||||
@hide Pending API council approval -->
|
||||
<!-- Allows an application to write to the user dictionary. -->
|
||||
<permission android:name="android.permission.WRITE_USER_DICTIONARY"
|
||||
android:permissionGroup="android.permission-group.PERSONAL_INFO"
|
||||
android:protectionLevel="normal"
|
||||
@ -793,7 +792,7 @@
|
||||
as locale. -->
|
||||
<permission android:name="android.permission.CHANGE_CONFIGURATION"
|
||||
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
|
||||
android:protectionLevel="dangerous"
|
||||
android:protectionLevel="signature|system|development"
|
||||
android:label="@string/permlab_changeConfiguration"
|
||||
android:description="@string/permdesc_changeConfiguration" />
|
||||
|
||||
@ -844,7 +843,7 @@
|
||||
<!-- Modify the global animation scaling factor. -->
|
||||
<permission android:name="android.permission.SET_ANIMATION_SCALE"
|
||||
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
|
||||
android:protectionLevel="dangerous"
|
||||
android:protectionLevel="signature|system|development"
|
||||
android:label="@string/permlab_setAnimationScale"
|
||||
android:description="@string/permdesc_setAnimationScale" />
|
||||
|
||||
|
@ -198,7 +198,15 @@
|
||||
(optionally) be granted to development applications. -->
|
||||
<flag name="development" value="0x20" />
|
||||
</attr>
|
||||
|
||||
|
||||
<!-- Flags indicating more context for a permission group. -->
|
||||
<attr name="permissionGroupFlags">
|
||||
<!-- Set to indicate that this permission group contains permissions
|
||||
protecting access to some information that is considered
|
||||
personal to the user (such as contacts, e-mails, etc). -->
|
||||
<flag name="personalInfo" value="0x0001" />
|
||||
</attr>
|
||||
|
||||
<!-- Specified the name of a group that this permission is associated
|
||||
with. The group must have been defined with the
|
||||
{@link android.R.styleable#AndroidManifestPermissionGroup permission-group} tag. -->
|
||||
@ -895,6 +903,8 @@
|
||||
<attr name="icon" />
|
||||
<attr name="logo" />
|
||||
<attr name="description" />
|
||||
<attr name="permissionGroupFlags" />
|
||||
<attr name="priority" />
|
||||
</declare-styleable>
|
||||
|
||||
<!-- The <code>permission-tree</code> tag declares the base of a tree of
|
||||
|
@ -3610,4 +3610,6 @@
|
||||
<public type="attr" name="importantForAccessibility"/>
|
||||
<public type="attr" name="canHandleGestures"/>
|
||||
|
||||
<public type="attr" name="permissionGroupFlags"/>
|
||||
|
||||
</resources>
|
||||
|
Reference in New Issue
Block a user