PackagePolicy
class PackagePolicy : Parcelable
| kotlin.Any | |
| ↳ | android.app.admin.PackagePolicy |
A generic class that defines which APK packages are in scope for some device policy.
The packages can be defined using either an allowlist or a blocklist. In allowlist mode, it could optionally include all system packages that meet the specific criteria of the device policy in question.
Summary
| Constants | |
|---|---|
| static Int |
PackagePolicy type indicator for |
| static Int |
PackagePolicy type indicator for |
| static Int |
PackagePolicy type indicator for |
| Inherited constants | |
|---|---|
| Public constructors | |
|---|---|
PackagePolicy(policyType: Int)Create the package policy |
|
PackagePolicy(policyType: Int, packageNames: MutableSet<String!>)Create the package policy |
|
| Public methods | |
|---|---|
| Int | |
| Boolean | |
| MutableSet<String!> |
Returns the list of packages to use as an allow/deny list based on policy type |
| Int |
Returns the current policy type |
| Int |
hashCode() |
| Unit |
writeToParcel(dest: Parcel, flags: Int)Flatten this object in to a Parcel. |
| Properties | |
|---|---|
| static Parcelable.Creator<PackagePolicy!> | |
Constants
PACKAGE_POLICY_ALLOWLIST
static val PACKAGE_POLICY_ALLOWLIST: Int
PackagePolicy type indicator for PackagePolicy
This constant indicates that all packages are denied except for the packages returned by PackagePolicy.getPackageNames(), which acts as an allowlist.
Value: 3PACKAGE_POLICY_ALLOWLIST_AND_SYSTEM
static val PACKAGE_POLICY_ALLOWLIST_AND_SYSTEM: Int
PackagePolicy type indicator for PackagePolicy
This constant indicates system packages are allowed in addition to the packages returned by PackagePolicy.getPackageNames(), which acts as an allowlist.
Functions that accept PackagePolicy will further clarify how this policy is interpreted.
Value: 2PACKAGE_POLICY_BLOCKLIST
static val PACKAGE_POLICY_BLOCKLIST: Int
PackagePolicy type indicator for PackagePolicy
This constant indicates that all packages are allowed except for the packages returned by PackagePolicy.getPackageNames(), which acts as a denylist.
Value: 1Public constructors
PackagePolicy
PackagePolicy(policyType: Int)
Create the package policy
| Parameters | |
|---|---|
policyType |
Int: indicates how to interpret this policy Value is android.app.admin.PackagePolicy#PACKAGE_POLICY_BLOCKLIST, android.app.admin.PackagePolicy#PACKAGE_POLICY_ALLOWLIST_AND_SYSTEM, or android.app.admin.PackagePolicy#PACKAGE_POLICY_ALLOWLIST |
PackagePolicy
PackagePolicy(
policyType: Int,
packageNames: MutableSet<String!>)
Create the package policy
| Parameters | |
|---|---|
policyType |
Int: indicates how to interpret this policy Value is android.app.admin.PackagePolicy#PACKAGE_POLICY_BLOCKLIST, android.app.admin.PackagePolicy#PACKAGE_POLICY_ALLOWLIST_AND_SYSTEM, or android.app.admin.PackagePolicy#PACKAGE_POLICY_ALLOWLIST |
packageNames |
MutableSet<String!>: allowlist or a denylist, based on policyType This value cannot be null. |
Public methods
describeContents
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 |
equals
fun equals(other: Any?): Boolean
| Parameters | |
|---|---|
obj |
the reference object with which to compare. |
| Return | |
|---|---|
Boolean |
true if this object is the same as the obj argument; false otherwise. |
getPackageNames
fun getPackageNames(): MutableSet<String!>
Returns the list of packages to use as an allow/deny list based on policy type
| Return | |
|---|---|
MutableSet<String!> |
This value cannot be null. |
getPolicyType
fun getPolicyType(): Int
Returns the current policy type
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
dest |
Parcel: This value cannot be null. |
flags |
Int: 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 |