Added in API level 34

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 PackagePolicy

static Int

PackagePolicy type indicator for PackagePolicy

static Int

PackagePolicy type indicator for PackagePolicy

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
equals(other: Any?)

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

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<PackagePolicy!>

Constants

PACKAGE_POLICY_ALLOWLIST

Added in API level 34
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: 3

PACKAGE_POLICY_ALLOWLIST_AND_SYSTEM

Added in API level 34
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: 2

PACKAGE_POLICY_BLOCKLIST

Added in API level 34
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: 1

Public constructors

PackagePolicy

Added in API level 34
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

Added in API level 34
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

Added in API level 34
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

Added in API level 34
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

Added in API level 34
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.

hashCode

Added in API level 34
fun hashCode(): Int
Return
Int a hash code value for this object.

writeToParcel

Added in API level 34
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

Properties

CREATOR

Added in API level 34
static val CREATOR: Parcelable.Creator<PackagePolicy!>