Android APIs
public class

PermissionInfo

extends PackageItemInfo
implements Parcelable
java.lang.Object
   ↳ android.content.pm.PackageItemInfo
     ↳ android.content.pm.PermissionInfo

Class Overview

Information you can retrieve about a particular security permission known to the system. This corresponds to information collected from the AndroidManifest.xml's <permission> tags.

Summary

Constants
int FLAG_COSTS_MONEY Flag for flags, corresponding to costsMoney value of permissionFlags.
int FLAG_INSTALLED Flag for flags, indicating that this permission has been installed into the system's globally defined permissions.
int PROTECTION_DANGEROUS Dangerous value for protectionLevel, corresponding to the dangerous value of protectionLevel.
int PROTECTION_FLAG_APPOP Additional flag for protectionLevel, corresponding to the appop value of protectionLevel.
int PROTECTION_FLAG_DEVELOPMENT Additional flag for protectionLevel, corresponding to the development value of protectionLevel.
int PROTECTION_FLAG_INSTALLER Additional flag for protectionLevel, corresponding to the installer value of protectionLevel.
int PROTECTION_FLAG_PRE23 Additional flag for protectionLevel, corresponding to the pre23 value of protectionLevel.
int PROTECTION_FLAG_PREINSTALLED Additional flag for protectionLevel, corresponding to the preinstalled value of protectionLevel.
int PROTECTION_FLAG_PRIVILEGED Additional flag for protectionLevel, corresponding to the privileged value of protectionLevel.
int PROTECTION_FLAG_SYSTEM This constant was deprecated in API level 23. Old name for PROTECTION_FLAG_PRIVILEGED, which is now very confusing because it only applies to privileged apps, not all apps on the system image.
int PROTECTION_FLAG_VERIFIER Additional flag for protectionLevel, corresponding to the verifier value of protectionLevel.
int PROTECTION_MASK_BASE Mask for protectionLevel: the basic protection type.
int PROTECTION_MASK_FLAGS Mask for protectionLevel: additional flag bits.
int PROTECTION_NORMAL A normal application value for protectionLevel, corresponding to the normal value of protectionLevel.
int PROTECTION_SIGNATURE System-level value for protectionLevel, corresponding to the signature value of protectionLevel.
int PROTECTION_SIGNATURE_OR_SYSTEM This constant was deprecated in API level 23. Use PROTECTION_SIGNATURE|PROTECTION_FLAG_PRIVILEGED instead.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<PermissionInfo> CREATOR
public int descriptionRes A string resource identifier (in the package's resources) of this permission's description.
public int flags Additional flags about this permission as given by permissionFlags.
public String group The group this permission is a part of, as per permissionGroup.
public CharSequence nonLocalizedDescription The description string provided in the AndroidManifest file, if any.
public int protectionLevel The level of access this permission is protecting, as per protectionLevel.
[Expand]
Inherited Fields
From class android.content.pm.PackageItemInfo
Public Constructors
PermissionInfo()
PermissionInfo(PermissionInfo orig)
Public Methods
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
CharSequence loadDescription(PackageManager pm)
Retrieve the textual description of this permission.
String toString()
Returns a string containing a concise, human-readable description of this object.
void writeToParcel(Parcel dest, int parcelableFlags)
[Expand]
Inherited Methods
From class android.content.pm.PackageItemInfo
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final int FLAG_COSTS_MONEY

Added in API level 17

Flag for flags, corresponding to costsMoney value of permissionFlags.

Constant Value: 1 (0x00000001)

public static final int FLAG_INSTALLED

Added in API level 23

Flag for flags, indicating that this permission has been installed into the system's globally defined permissions.

Constant Value: 1073741824 (0x40000000)

public static final int PROTECTION_DANGEROUS

Added in API level 1

Dangerous value for protectionLevel, corresponding to the dangerous value of protectionLevel.

Constant Value: 1 (0x00000001)

public static final int PROTECTION_FLAG_APPOP

Added in API level 21

Additional flag for protectionLevel, corresponding to the appop value of protectionLevel.

Constant Value: 64 (0x00000040)

public static final int PROTECTION_FLAG_DEVELOPMENT

Added in API level 16

Additional flag for protectionLevel, corresponding to the development value of protectionLevel.

Constant Value: 32 (0x00000020)

public static final int PROTECTION_FLAG_INSTALLER

Added in API level 23

Additional flag for protectionLevel, corresponding to the installer value of protectionLevel.

Constant Value: 256 (0x00000100)

public static final int PROTECTION_FLAG_PRE23

Added in API level 23

Additional flag for protectionLevel, corresponding to the pre23 value of protectionLevel.

Constant Value: 128 (0x00000080)

public static final int PROTECTION_FLAG_PREINSTALLED

Added in API level 23

Additional flag for protectionLevel, corresponding to the preinstalled value of protectionLevel.

Constant Value: 1024 (0x00000400)

public static final int PROTECTION_FLAG_PRIVILEGED

Added in API level 23

Additional flag for protectionLevel, corresponding to the privileged value of protectionLevel.

Constant Value: 16 (0x00000010)

public static final int PROTECTION_FLAG_SYSTEM

Added in API level 16

This constant was deprecated in API level 23.
Old name for PROTECTION_FLAG_PRIVILEGED, which is now very confusing because it only applies to privileged apps, not all apps on the system image.

Constant Value: 16 (0x00000010)

public static final int PROTECTION_FLAG_VERIFIER

Added in API level 23

Additional flag for protectionLevel, corresponding to the verifier value of protectionLevel.

Constant Value: 512 (0x00000200)

public static final int PROTECTION_MASK_BASE

Added in API level 16

Mask for protectionLevel: the basic protection type.

Constant Value: 15 (0x0000000f)

public static final int PROTECTION_MASK_FLAGS

Added in API level 16

Mask for protectionLevel: additional flag bits.

Constant Value: 4080 (0x00000ff0)

public static final int PROTECTION_NORMAL

Added in API level 1

A normal application value for protectionLevel, corresponding to the normal value of protectionLevel.

Constant Value: 0 (0x00000000)

public static final int PROTECTION_SIGNATURE

Added in API level 1

System-level value for protectionLevel, corresponding to the signature value of protectionLevel.

Constant Value: 2 (0x00000002)

public static final int PROTECTION_SIGNATURE_OR_SYSTEM

Added in API level 1

This constant was deprecated in API level 23.
Use PROTECTION_SIGNATURE|PROTECTION_FLAG_PRIVILEGED instead.

Constant Value: 3 (0x00000003)

Fields

public static final Creator<PermissionInfo> CREATOR

Added in API level 1

public int descriptionRes

Added in API level 1

A string resource identifier (in the package's resources) of this permission's description. From the "description" attribute or, if not set, 0.

public int flags

Added in API level 17

Additional flags about this permission as given by permissionFlags.

public String group

Added in API level 1

The group this permission is a part of, as per permissionGroup.

public CharSequence nonLocalizedDescription

Added in API level 1

The description string provided in the AndroidManifest file, if any. You probably don't want to use this, since it will be null if the description is in a resource. You probably want loadDescription(PackageManager) instead.

public int protectionLevel

Added in API level 1

The level of access this permission is protecting, as per protectionLevel. Values may be PROTECTION_NORMAL, PROTECTION_DANGEROUS, or PROTECTION_SIGNATURE. May also include the additional flags PROTECTION_FLAG_SYSTEM or PROTECTION_FLAG_DEVELOPMENT (which only make sense in combination with the base PROTECTION_SIGNATURE.

Public Constructors

public PermissionInfo ()

Added in API level 1

public PermissionInfo (PermissionInfo orig)

Added in API level 1

Parameters
orig PermissionInfo

Public Methods

public int describeContents ()

Added in API level 1

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
int a bitmask indicating the set of special object types marshalled by the Parcelable.

public CharSequence loadDescription (PackageManager pm)

Added in API level 1

Retrieve the textual description of this permission. This will call back on the given PackageManager to load the description from the application.

Parameters
pm PackageManager: A PackageManager from which the label can be loaded; usually the PackageManager from which you originally retrieved this item.
Returns
CharSequence Returns a CharSequence containing the permission's description. If there is no description, null is returned.

public String toString ()

Added in API level 1

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
String a printable representation of this object.

public void writeToParcel (Parcel dest, int parcelableFlags)

Added in API level 1

Parameters
dest Parcel
parcelableFlags int