Added in API level 1

PermissionInfo

open class PermissionInfo : PackageItemInfo, Parcelable
kotlin.Any
   ↳ 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.

Summary

Constants
static Int

Flag for flags, corresponding to costsMoney value of android.R.attr#permissionFlags.

static Int

Flag for flags, corresponding to hardRestricted value of android.R.attr#permissionFlags.

static Int

Flag for flags, corresponding to immutablyRestricted value of android.R.attr#permissionFlags.

static Int

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

static Int

Flag for flags, corresponding to softRestricted value of android.R.attr#permissionFlags.

static Int

Dangerous value for protectionLevel, corresponding to the dangerous value of android.R.attr#protectionLevel.

static Int

Additional flag for protectionLevel, corresponding to the appop value of android.R.attr#protectionLevel.

static Int

Additional flag for protectionLevel, corresponding to the development value of android.R.attr#protectionLevel.

static Int

Additional flag for protectionLevel, corresponding to the installer value of android.R.attr#protectionLevel.

static Int

Additional flag for protectionLevel, corresponding to the instant value of android.R.attr#protectionLevel.

static Int

Additional flag for protectionLevel, corresponding to the pre23 value of android.R.attr#protectionLevel.

static Int

Additional flag for protectionLevel, corresponding to the preinstalled value of android.R.attr#protectionLevel.

static Int

Additional flag for protectionLevel, corresponding to the privileged value of android.R.attr#protectionLevel.

static Int

Additional flag for protectionLevel, corresponding to the runtime value of android.R.attr#protectionLevel.

static Int

Additional flag for protectionLevel, corresponding to the setup value of android.R.attr#protectionLevel.

static Int

static Int

Additional flag for protectionLevel, corresponding to the verifier value of android.R.attr#protectionLevel.

static Int

System-level value for protectionLevel, corresponding to the internal value of android.R.attr#protectionLevel.

static Int

Mask for protectionLevel: the basic protection type.

static Int

Mask for protectionLevel: additional flag bits.

static Int

A normal application value for protectionLevel, corresponding to the normal value of android.R.attr#protectionLevel.

static Int

System-level value for protectionLevel, corresponding to the signature value of android.R.attr#protectionLevel.

static Int

Inherited constants
Public constructors

Public methods
open Int

open Int

Return the base permission type.

open Int

Return the additional flags in protectionLevel.

open CharSequence?

Retrieve the textual description of this permission.

open String

open Unit
writeToParcel(dest: Parcel, parcelableFlags: Int)

Inherited functions
Properties
static Parcelable.Creator<PermissionInfo!>

Int

A string resource identifier (in the package's resources) of this permission's description.

Int

Additional flags about this permission as given by android.R.attr#permissionFlags.

String?

The group this permission is a part of, as per android.R.attr#permissionGroup.

CharSequence?

The description string provided in the AndroidManifest file, if any.

Int

The level of access this permission is protecting, as per .

Inherited properties

Constants

FLAG_COSTS_MONEY

Added in API level 17
static val FLAG_COSTS_MONEY: Int

Flag for flags, corresponding to costsMoney value of android.R.attr#permissionFlags.

Value: 1

FLAG_HARD_RESTRICTED

Added in API level 29
static val FLAG_HARD_RESTRICTED: Int

Flag for flags, corresponding to hardRestricted value of android.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.

Value: 4

FLAG_IMMUTABLY_RESTRICTED

Added in API level 29
static val FLAG_IMMUTABLY_RESTRICTED: Int

Flag for flags, corresponding to immutablyRestricted value of android.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 allowlist state until the app is uninstalled.

Value: 16

FLAG_INSTALLED

Added in API level 23
static val FLAG_INSTALLED: Int

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

Value: 1073741824

FLAG_SOFT_RESTRICTED

Added in API level 29
static val FLAG_SOFT_RESTRICTED: Int

Flag for flags, corresponding to softRestricted value of android.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.

Value: 8

PROTECTION_DANGEROUS

Added in API level 1
static val PROTECTION_DANGEROUS: Int

Dangerous value for protectionLevel, corresponding to the dangerous value of android.R.attr#protectionLevel.

Value: 1

PROTECTION_FLAG_APPOP

Added in API level 21
static val PROTECTION_FLAG_APPOP: Int

Additional flag for protectionLevel, corresponding to the appop value of android.R.attr#protectionLevel.

Value: 64

PROTECTION_FLAG_DEVELOPMENT

Added in API level 16
static val PROTECTION_FLAG_DEVELOPMENT: Int

Additional flag for protectionLevel, corresponding to the development value of android.R.attr#protectionLevel.

Value: 32

PROTECTION_FLAG_INSTALLER

Added in API level 23
static val PROTECTION_FLAG_INSTALLER: Int

Additional flag for protectionLevel, corresponding to the installer value of android.R.attr#protectionLevel.

Value: 256

PROTECTION_FLAG_INSTANT

Added in API level 27
static val PROTECTION_FLAG_INSTANT: Int

Additional flag for protectionLevel, corresponding to the instant value of android.R.attr#protectionLevel.

Value: 4096

PROTECTION_FLAG_PRE23

Added in API level 23
static val PROTECTION_FLAG_PRE23: Int

Additional flag for protectionLevel, corresponding to the pre23 value of android.R.attr#protectionLevel.

Value: 128

PROTECTION_FLAG_PREINSTALLED

Added in API level 23
static val PROTECTION_FLAG_PREINSTALLED: Int

Additional flag for protectionLevel, corresponding to the preinstalled value of android.R.attr#protectionLevel.

Value: 1024

PROTECTION_FLAG_PRIVILEGED

Added in API level 23
static val PROTECTION_FLAG_PRIVILEGED: Int

Additional flag for protectionLevel, corresponding to the privileged value of android.R.attr#protectionLevel.

Value: 16

PROTECTION_FLAG_RUNTIME_ONLY

Added in API level 26
static val PROTECTION_FLAG_RUNTIME_ONLY: Int

Additional flag for protectionLevel, corresponding to the runtime value of android.R.attr#protectionLevel.

Value: 8192

PROTECTION_FLAG_SETUP

Added in API level 24
static val PROTECTION_FLAG_SETUP: Int

Additional flag for protectionLevel, corresponding to the setup value of android.R.attr#protectionLevel.

Value: 2048

PROTECTION_FLAG_SYSTEM

Added in API level 16
Deprecated in API level 23
static val PROTECTION_FLAG_SYSTEM: Int

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.

Value: 16

PROTECTION_FLAG_VERIFIER

Added in API level 23
static val PROTECTION_FLAG_VERIFIER: Int

Additional flag for protectionLevel, corresponding to the verifier value of android.R.attr#protectionLevel.

Value: 512

PROTECTION_INTERNAL

Added in API level 31
static val PROTECTION_INTERNAL: Int

System-level value for protectionLevel, corresponding to the internal value of android.R.attr#protectionLevel.

Value: 4

PROTECTION_MASK_BASE

Added in API level 16
Deprecated in API level 28
static val PROTECTION_MASK_BASE: Int

Deprecated: Use #getProtection() instead.

Mask for protectionLevel: the basic protection type.

Value: 15

PROTECTION_MASK_FLAGS

Added in API level 16
Deprecated in API level 28
static val PROTECTION_MASK_FLAGS: Int

Deprecated: Use #getProtectionFlags() instead.

Mask for protectionLevel: additional flag bits.

Value: 65520

PROTECTION_NORMAL

Added in API level 1
static val PROTECTION_NORMAL: Int

A normal application value for protectionLevel, corresponding to the normal value of android.R.attr#protectionLevel.

Value: 0

PROTECTION_SIGNATURE

Added in API level 1
static val PROTECTION_SIGNATURE: Int

System-level value for protectionLevel, corresponding to the signature value of android.R.attr#protectionLevel.

Value: 2

PROTECTION_SIGNATURE_OR_SYSTEM

Added in API level 1
Deprecated in API level 23
static val PROTECTION_SIGNATURE_OR_SYSTEM: Int

Deprecated: Use PROTECTION_SIGNATURE|PROTECTION_FLAG_PRIVILEGED instead.

Value: 3

Public constructors

PermissionInfo

Added in API level 1
PermissionInfo()

Deprecated: Should only be created by the system.

PermissionInfo

Added in API level 1
PermissionInfo(orig: PermissionInfo)

Deprecated: Should only be created by the system.

Parameters
orig PermissionInfo: This value cannot be null.

Public methods

describeContents

Added in API level 1
open fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getProtectionFlags

Added in API level 28
open fun getProtectionFlags(): Int

Return the additional flags in protectionLevel.

Return
Int Value is either 0 or a combination of android.content.pm.PermissionInfo#PROTECTION_FLAG_PRIVILEGED, android.content.pm.PermissionInfo#PROTECTION_FLAG_SYSTEM, android.content.pm.PermissionInfo#PROTECTION_FLAG_DEVELOPMENT, android.content.pm.PermissionInfo#PROTECTION_FLAG_APPOP, android.content.pm.PermissionInfo#PROTECTION_FLAG_PRE23, android.content.pm.PermissionInfo#PROTECTION_FLAG_INSTALLER, android.content.pm.PermissionInfo#PROTECTION_FLAG_VERIFIER, android.content.pm.PermissionInfo#PROTECTION_FLAG_PREINSTALLED, android.content.pm.PermissionInfo#PROTECTION_FLAG_SETUP, android.content.pm.PermissionInfo#PROTECTION_FLAG_INSTANT, android.content.pm.PermissionInfo#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_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, android.content.pm.PermissionInfo.PROTECTION_FLAG_RETAIL_DEMO, android.content.pm.PermissionInfo.PROTECTION_FLAG_RECENTS, android.content.pm.PermissionInfo.PROTECTION_FLAG_ROLE, android.content.pm.PermissionInfo.PROTECTION_FLAG_KNOWN_SIGNER, and android.content.pm.PermissionInfo.PROTECTION_FLAG_MODULE

loadDescription

Added in API level 1
open fun loadDescription(pm: PackageManager): CharSequence?

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.
Return
CharSequence? Returns a CharSequence containing the permission's description. If there is no description, null is returned.

toString

Added in API level 1
open fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 1
open fun writeToParcel(
    dest: Parcel,
    parcelableFlags: Int
): Unit
Parameters
dest Parcel: The Parcel in which the object should be written. This value cannot be null.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 1
static val CREATOR: Parcelable.Creator<PermissionInfo!>

descriptionRes

Added in API level 1
var descriptionRes: Int

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

group

Added in API level 1
var group: String?

The group this permission is a part of, as per android.R.attr#permissionGroup.

The actual grouping of platform-defined runtime permissions is subject to change and can be queried with PackageManager#getGroupOfPlatformPermission.

nonLocalizedDescription

Added in API level 1
var nonLocalizedDescription: CharSequence?

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.

protectionLevel

Added in API level 1
Deprecated in API level 28
var protectionLevel: Int

Deprecated: Use #getProtection() and #getProtectionFlags() instead.

The level of access this permission is protecting, as per . 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, PROTECTION_INTERNAL and the deprecated PROTECTION_SIGNATURE_OR_SYSTEM. Flags are listed under android.R.attr#protectionLevel.