# Print output for @column tags ?>
public
class
PermissionInfo
extends PackageItemInfo
implements
Parcelable
java.lang.Object | ||
↳ | android.content.pm.PackageItemInfo | |
↳ | android.content.pm.PermissionInfo |
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.
Constants | |
---|---|
int |
FLAG_COSTS_MONEY
Flag for |
int |
FLAG_HARD_RESTRICTED
Flag for |
int |
FLAG_IMMUTABLY_RESTRICTED
Flag for |
int |
FLAG_INSTALLED
Flag for |
int |
FLAG_SOFT_RESTRICTED
Flag for |
int |
PROTECTION_DANGEROUS
Dangerous value for |
int |
PROTECTION_FLAG_APPOP
Additional flag for |
int |
PROTECTION_FLAG_DEVELOPMENT
Additional flag for |
int |
PROTECTION_FLAG_INSTALLER
Additional flag for |
int |
PROTECTION_FLAG_INSTANT
Additional flag for |
int |
PROTECTION_FLAG_PRE23
Additional flag for |
int |
PROTECTION_FLAG_PREINSTALLED
Additional flag for |
int |
PROTECTION_FLAG_PRIVILEGED
Additional flag for |
int |
PROTECTION_FLAG_RUNTIME_ONLY
Additional flag for |
int |
PROTECTION_FLAG_SETUP
Additional flag for |
int |
PROTECTION_FLAG_SYSTEM
This constant is deprecated.
Old name for |
int |
PROTECTION_FLAG_VERIFIER
Additional flag for |
int |
PROTECTION_MASK_BASE
This constant is deprecated. Use #getProtection() instead. |
int |
PROTECTION_MASK_FLAGS
This constant is deprecated. Use #getProtectionFlags() instead. |
int |
PROTECTION_NORMAL
A normal application value for |
int |
PROTECTION_SIGNATURE
System-level value for |
int |
PROTECTION_SIGNATURE_OR_SYSTEM
This constant is deprecated.
Use |
Inherited constants |
---|
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
|
public
String |
group
The group this permission is a part of, as per
|
public
CharSequence |
nonLocalizedDescription
The description string provided in the AndroidManifest file, if any. |
public
int |
protectionLevel
This field is deprecated. Use #getProtection() and #getProtectionFlags() instead. |
Inherited fields |
---|
Public constructors | |
---|---|
PermissionInfo()
This constructor is deprecated. Should only be created by the system. |
|
PermissionInfo(PermissionInfo orig)
This constructor is deprecated. Should only be created by the system. |
Public methods | |
---|---|
int
|
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
int
|
getProtection()
Return the base permission type. |
int
|
getProtectionFlags()
Return the additional flags in |
CharSequence
|
loadDescription(PackageManager pm)
Retrieve the textual description of this permission. |
String
|
toString()
Returns a string representation of the object. |
void
|
writeToParcel(Parcel dest, int parcelableFlags)
|
Inherited methods | |
---|---|
public static final int FLAG_COSTS_MONEY
Flag for flags
, corresponding to costsMoney
value of R.attr.permissionFlags
.
Constant Value: 1 (0x00000001)
public static final int FLAG_HARD_RESTRICTED
Flag for flags
, corresponding to hardRestricted
value of R.attr.permissionFlags
.
This permission is restricted by the platform and it would be grantable only to apps that meet special criteria per platform policy.
Constant Value: 4 (0x00000004)
public static final int FLAG_IMMUTABLY_RESTRICTED
Flag for flags
, corresponding to immutablyRestricted
value of R.attr.permissionFlags
.
This permission is restricted immutably which means that its restriction state may be specified only on the first install of the app and will stay in this initial whitelist state until the app is uninstalled.
Constant Value: 16 (0x00000010)
public static final int FLAG_INSTALLED
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 FLAG_SOFT_RESTRICTED
Flag for flags
, corresponding to softRestricted
value of R.attr.permissionFlags
.
This permission is restricted by the platform and it would be grantable in its full form to apps that meet special criteria per platform policy. Otherwise, a weaker form of the permission would be granted. The weak grant depends on the permission.
Constant Value: 8 (0x00000008)
public static final int PROTECTION_DANGEROUS
Dangerous value for protectionLevel
, corresponding
to the dangerous
value of
R.attr.protectionLevel
.
Constant Value: 1 (0x00000001)
public static final int PROTECTION_FLAG_APPOP
Additional flag for protectionLevel
, corresponding
to the appop
value of
R.attr.protectionLevel
.
Constant Value: 64 (0x00000040)
public static final int PROTECTION_FLAG_DEVELOPMENT
Additional flag for protectionLevel
, corresponding
to the development
value of
R.attr.protectionLevel
.
Constant Value: 32 (0x00000020)
public static final int PROTECTION_FLAG_INSTALLER
Additional flag for protectionLevel
, corresponding
to the installer
value of
R.attr.protectionLevel
.
Constant Value: 256 (0x00000100)
public static final int PROTECTION_FLAG_INSTANT
Additional flag for protectionLevel
, corresponding
to the instant
value of
R.attr.protectionLevel
.
Constant Value: 4096 (0x00001000)
public static final int PROTECTION_FLAG_PRE23
Additional flag for protectionLevel
, corresponding
to the pre23
value of
R.attr.protectionLevel
.
Constant Value: 128 (0x00000080)
public static final int PROTECTION_FLAG_PREINSTALLED
Additional flag for protectionLevel
, corresponding
to the preinstalled
value of
R.attr.protectionLevel
.
Constant Value: 1024 (0x00000400)
public static final int PROTECTION_FLAG_PRIVILEGED
Additional flag for protectionLevel
, corresponding
to the privileged
value of
R.attr.protectionLevel
.
Constant Value: 16 (0x00000010)
public static final int PROTECTION_FLAG_RUNTIME_ONLY
Additional flag for protectionLevel
, corresponding
to the runtime
value of
R.attr.protectionLevel
.
Constant Value: 8192 (0x00002000)
public static final int PROTECTION_FLAG_SETUP
Additional flag for protectionLevel
, corresponding
to the setup
value of
R.attr.protectionLevel
.
Constant Value: 2048 (0x00000800)
public static final int PROTECTION_FLAG_SYSTEM
This constant is deprecated.
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
Additional flag for protectionLevel
, corresponding
to the verifier
value of
R.attr.protectionLevel
.
Constant Value: 512 (0x00000200)
public static final int PROTECTION_MASK_BASE
This constant is deprecated.
Use #getProtection() instead.
Mask for protectionLevel
: the basic protection type.
Constant Value: 15 (0x0000000f)
public static final int PROTECTION_MASK_FLAGS
This constant is deprecated.
Use #getProtectionFlags() instead.
Mask for protectionLevel
: additional flag bits.
Constant Value: 65520 (0x0000fff0)
public static final int PROTECTION_NORMAL
A normal application value for protectionLevel
, corresponding
to the normal
value of
R.attr.protectionLevel
.
Constant Value: 0 (0x00000000)
public static final int PROTECTION_SIGNATURE
System-level value for protectionLevel
, corresponding
to the signature
value of
R.attr.protectionLevel
.
Constant Value: 2 (0x00000002)
public static final int PROTECTION_SIGNATURE_OR_SYSTEM
This constant is deprecated.
Use PROTECTION_SIGNATURE
|PROTECTION_FLAG_PRIVILEGED
instead.
Constant Value: 3 (0x00000003)
public int descriptionRes
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
Additional flags about this permission as given by
R.attr.permissionFlags
.
Value is either 0
or a combination of FLAG_COSTS_MONEY
, android.content.pm.PermissionInfo.FLAG_REMOVED, FLAG_HARD_RESTRICTED
, FLAG_SOFT_RESTRICTED
, FLAG_IMMUTABLY_RESTRICTED
, and FLAG_INSTALLED
public CharSequence nonLocalizedDescription
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
PermissionInfo#loadDescription
instead.
public int protectionLevel
This field is deprecated.
Use #getProtection() and #getProtectionFlags() instead.
The level of access this permission is protecting, as per
R.attr.protectionLevel
. Consists of
a base permission type and zero or more flags. Use the following functions
to extract them.
int basePermissionType = permissionInfo.getProtection(); int permissionFlags = permissionInfo.getProtectionFlags();Base permission types are
PROTECTION_NORMAL
,
PROTECTION_DANGEROUS
, PROTECTION_SIGNATURE
and the deprecated PROTECTION_SIGNATURE_OR_SYSTEM
.
Flags are listed under R.attr.protectionLevel
.
public PermissionInfo ()
This constructor is deprecated.
Should only be created by the system.
public PermissionInfo (PermissionInfo orig)
This constructor is deprecated.
Should only be created by the system.
Parameters | |
---|---|
orig |
PermissionInfo : This value cannot be null . |
public int describeContents ()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of writeToParcel(android.os.Parcel, int)
,
the return value of this method must include the
CONTENTS_FILE_DESCRIPTOR
bit.
Returns | |
---|---|
int |
a bitmask indicating the set of special object types marshaled
by this Parcelable object instance.
Value is either 0 or CONTENTS_FILE_DESCRIPTOR |
public int getProtection ()
Return the base permission type.
Returns | |
---|---|
int |
Value is PROTECTION_NORMAL , PROTECTION_DANGEROUS , PROTECTION_SIGNATURE , or PROTECTION_SIGNATURE_OR_SYSTEM |
public int getProtectionFlags ()
Return the additional flags in protectionLevel
.
Returns | |
---|---|
int |
Value is either 0 or a combination of PROTECTION_FLAG_PRIVILEGED , PROTECTION_FLAG_SYSTEM , PROTECTION_FLAG_DEVELOPMENT , PROTECTION_FLAG_APPOP , PROTECTION_FLAG_PRE23 , PROTECTION_FLAG_INSTALLER , PROTECTION_FLAG_VERIFIER , PROTECTION_FLAG_PREINSTALLED , PROTECTION_FLAG_SETUP , PROTECTION_FLAG_INSTANT , PROTECTION_FLAG_RUNTIME_ONLY , android.content.pm.PermissionInfo.PROTECTION_FLAG_OEM, android.content.pm.PermissionInfo.PROTECTION_FLAG_VENDOR_PRIVILEGED, android.content.pm.PermissionInfo.PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER, android.content.pm.PermissionInfo.PROTECTION_FLAG_WELLBEING, android.content.pm.PermissionInfo.PROTECTION_FLAG_DOCUMENTER, android.content.pm.PermissionInfo.PROTECTION_FLAG_CONFIGURATOR, android.content.pm.PermissionInfo.PROTECTION_FLAG_INCIDENT_REPORT_APPROVER, android.content.pm.PermissionInfo.PROTECTION_FLAG_APP_PREDICTOR, android.content.pm.PermissionInfo.PROTECTION_FLAG_COMPANION, and android.content.pm.PermissionInfo.PROTECTION_FLAG_RETAIL_DEMO |
public CharSequence loadDescription (PackageManager pm)
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.
This value cannot be null . |
Returns | |
---|---|
CharSequence |
Returns a CharSequence containing the permission's description. If there is no description, null is returned. |
public String toString ()
Returns a string representation of the object. In general, the
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
Returns | |
---|---|
String |
a string representation of the object. |
public void writeToParcel (Parcel dest, int parcelableFlags)
Parameters | |
---|---|
dest |
Parcel |
parcelableFlags |
int |