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 |
static Int |
Flag for |
static Int |
Flag for |
static Int |
Flag for |
static Int |
Flag for |
static Int |
Dangerous value for |
static Int |
Additional flag for |
static Int |
Additional flag for |
static Int |
Additional flag for |
static Int |
Additional flag for |
static Int |
Additional flag for |
static Int |
Additional flag for |
static Int |
Additional flag for |
static Int |
Additional flag for |
static Int |
Additional flag for |
static Int | |
static Int |
Additional flag for |
static Int |
System-level value for |
static Int |
Mask for |
static Int |
Mask for |
static Int |
A normal application value for |
static Int |
System-level value for |
static Int |
Inherited constants | |
---|---|
Public constructors | |
---|---|
PermissionInfo(orig: PermissionInfo) |
Public methods | |
---|---|
open Int | |
open Int |
Return the base permission type. |
open Int |
Return the additional flags in |
open CharSequence? |
Retrieve the textual description of this permission. |
open String |
toString() |
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 |
String? |
The group this permission is a part of, as per |
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
static val FLAG_COSTS_MONEY: Int
Flag for flags
, corresponding to costsMoney
value of android.R.attr#permissionFlags
.
Value: 1
FLAG_HARD_RESTRICTED
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
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
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
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
static val PROTECTION_DANGEROUS: Int
Dangerous value for protectionLevel
, corresponding to the dangerous
value of android.R.attr#protectionLevel
.
Value: 1
PROTECTION_FLAG_APPOP
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
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
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
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
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
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
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
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
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
static valPROTECTION_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
static val PROTECTION_FLAG_VERIFIER: Int
Additional flag for protectionLevel
, corresponding to the verifier
value of android.R.attr#protectionLevel
.
Value: 512
PROTECTION_INTERNAL
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
static valPROTECTION_MASK_BASE: Int
Deprecated: Use #getProtection() instead.
Mask for protectionLevel
: the basic protection type.
Value: 15
PROTECTION_MASK_FLAGS
static valPROTECTION_MASK_FLAGS: Int
Deprecated: Use #getProtectionFlags() instead.
Mask for protectionLevel
: additional flag bits.
Value: 65520
PROTECTION_NORMAL
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
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
static valPROTECTION_SIGNATURE_OR_SYSTEM: Int
Deprecated: Use PROTECTION_SIGNATURE
|PROTECTION_FLAG_PRIVILEGED
instead.
Value: 3
Public constructors
PermissionInfo
PermissionInfo()
Deprecated: Should only be created by the system.
PermissionInfo
PermissionInfo(orig: PermissionInfo)
Deprecated: Should only be created by the system.
Parameters | |
---|---|
orig |
PermissionInfo: This value cannot be null . |
Public methods
describeContents
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 |
getProtection
open fun getProtection(): Int
Return the base permission type.
getProtectionFlags
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
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
open fun toString(): String
Return | |
---|---|
String |
a string representation of the object. |
writeToParcel
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
descriptionRes
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.
flags
var flags: Int
Additional flags about this permission as given by android.R.attr#permissionFlags
.
Value is either 0
or a combination of android.content.pm.PermissionInfo#FLAG_COSTS_MONEY
, android.content.pm.PermissionInfo.FLAG_REMOVED, android.content.pm.PermissionInfo#FLAG_HARD_RESTRICTED
, android.content.pm.PermissionInfo#FLAG_SOFT_RESTRICTED
, android.content.pm.PermissionInfo#FLAG_IMMUTABLY_RESTRICTED
, and android.content.pm.PermissionInfo#FLAG_INSTALLED
group
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
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
varprotectionLevel: 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
.