Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# DevicePolicyManager

*** ** * ** ***

```
open class DevicePolicyManager
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.app.admin.DevicePolicyManager](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#) |

Manages device policy and restrictions applied to the user of the device or apps running on the device.

This class contains three types of methods:

1. Those aimed at [managing apps](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#managingapps)
2. Those aimed at the [Device Policy Management Role Holder](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#roleholder)
3. Those aimed at [apps which wish to respect device policy](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#querying)

The intended caller for each API is indicated in its Javadoc.

**Managing Apps**

Apps can be made capable of setting device policy ("Managing Apps") either by being set as a [Device Administrator](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#deviceadmin), being set as a [Device Policy Controller](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#devicepolicycontroller), or by holding the appropriate [Permissions](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#permissions).

A **Device Administrator** is an app which is able to enforce device policies that it has declared in its device admin XML file. An app can prompt the user to give it device administrator privileges using the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_ADD_DEVICE_ADMIN:kotlin.String` action.

For more information about Device Administration, read the [Device Administration](https://developer.android.com/guide/topics/admin/device-admin.html) developer guide.

Device Administrator apps can also be recognised as **Device Policy Controllers**. Device Policy Controllers can be one of two types:

- A *Device Owner* , which only ever exists on the `https://developer.android.com/reference/kotlin/android/os/UserManager.html#isSystemUser()` or Main User, is the most powerful type of Device Policy Controller and can affect policy across the device.
- A *Profile Owner* , which can exist on any user, can affect policy on the user it is on, and when it is running on `https://developer.android.com/reference/kotlin/android/os/UserManager.html#isProfile()` has [limited](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#profile-on-parent) ability to affect policy on its parent.

Additional capabilities can be provided to Device Policy Controllers in the following circumstances:

- A Profile Owner on an [organization owned](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#organization-owned) device has access to additional abilities, both [affecting policy on the profile's](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#profile-on-parent-organization-owned) parent and also the profile itself.
- A Profile Owner running on the `https://developer.android.com/reference/kotlin/android/os/UserManager.html#isSystemUser()` has access to additional capabilities which affect the `https://developer.android.com/reference/kotlin/android/os/UserManager.html#isSystemUser()` and also the whole device.
- A Profile Owner running on an [affiliated](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#affiliated) user has capabilities similar to that of a [Device Owner](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#deviceowner)

For more information, see [Building a Device Policy Controller](https://developer.android.com/work/dpc/build-dpc).

[Permissions](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#permissions) are generally only given to apps fulfilling particular key roles on the device (such as managing `https://developer.android.com/reference/kotlin/android/devicelock/DeviceLockManager.html#`).

**Device Policy Management Role Holder**

One app on the device fulfills the Device Policy Management Role and is trusted with managing the overall state of Device Policy. This has access to much more powerful methods than [managing apps](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#managingapps).

**Querying Device Policy**

In most cases, regular apps do not need to concern themselves with device policy, and restrictions will be enforced automatically. There are some cases where an app may wish to query device policy to provide a better user experience. Only a small number of policies allow apps to query them directly. These APIs will typically have no special required permissions.

**Managed Provisioning**

Managed Provisioning is the process of recognising an app as a [Device Owner](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#deviceowner) or [Profile Owner](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#profileowner). It involves presenting education and consent screens to the user to ensure they are aware of the capabilities this grants the [Device Policy Controller](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#devicepolicycontroller)

For more information on provisioning, see [Building a Device Policy Controller](https://developer.android.com/work/dpc/build-dpc).

A **Managed Profile** enables data separation. For example to use a device both for personal and corporate usage. The managed profile and its parent share a launcher.

**Affiliation**

Using the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)` method, a [Device Owner](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#deviceowner) can set a list of affiliation ids for the `https://developer.android.com/reference/kotlin/android/os/UserManager.html#isSystemUser()`. Any [Profile Owner](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#profileowner) on the same device can also call `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)` to set affiliation ids for the `https://developer.android.com/reference/kotlin/android/os/UserManager.html#` it is on. When there is the same ID present in both lists, the user is said to be "affiliated" and we can refer to the [Profile Owner](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#profileowner) as a "profile owner on an affiliated user" or an "affiliated profile owner". Becoming affiliated grants the [Profile Owner](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#profileowner) capabilities similar to that of the [Device Owner](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#deviceowner). It also allows use of the #bindDeviceAdminServiceAsUser APIs for direct communication between the [Device Owner](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#deviceowner) and affiliated [Profile Owners](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#profileowner).

**Organization Owned**
An organization owned device is one which is not owned by the person making use of the device and is instead owned by an organization such as their employer or education provider. These devices are recognised as being organization owned either by the presence of a [device owner](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#deviceowner) or of a `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isOrganizationOwnedDeviceWithManagedProfile()`.

Profile owners running on an [organization owned](https://developer.android.com/reference/kotlin/android/app/admin/organization-owned) device can exercise additional capabilities using the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` API which apply to the parent user. Each API will indicate if it is usable in this way.

**Android Automotive**

On `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_AUTOMOTIVE:kotlin.String`, some methods can throw `https://developer.android.com/reference/kotlin/android/app/admin/UnsafeStateException` if an action is unsafe (for example, if the vehicle is moving). Callers running on `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_AUTOMOTIVE:kotlin.String` should always check for this exception.   
Restricted for SDK Runtime environment in API level 34.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_DEVICE_ADMIN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

## Summary

| Nested classes ||
|---|---|
| abstract | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager.InstallSystemUpdateCallback` Callback used in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installSystemUpdate(android.content.ComponentName,%20android.net.Uri,%20java.util.concurrent.Executor,%20android.app.admin.DevicePolicyManager.InstallSystemUpdateCallback)` to indicate that there was an error while trying to install an update. |
| abstract | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager.OnClearApplicationUserDataListener` Callback used in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#clearApplicationUserData(android.content.ComponentName,%20kotlin.String,%20java.util.concurrent.Executor,%20android.app.admin.DevicePolicyManager.OnClearApplicationUserDataListener)` to indicate that the clearing of an application's user data is done. |

| Constants ||
|---|---|
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_ADD_DEVICE_ADMIN:kotlin.String` Activity action: ask the user to add a new device administrator to the system. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_ADMIN_POLICY_COMPLIANCE:kotlin.String` Activity action: Starts the administrator to show policy compliance for the provisioning. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_APPLICATION_DELEGATION_SCOPES_CHANGED:kotlin.String` Broadcast Action: Sent after application delegation scopes are changed. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_CHECK_POLICY_COMPLIANCE:kotlin.String` Activity action: launch the DPC to check policy compliance. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_DEVICE_ADMIN_SERVICE:kotlin.String` Service action: Action for a service that device owner and profile owner can optionally own. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_DEVICE_FINANCING_STATE_CHANGED:kotlin.String` Broadcast Action: Broadcast sent to indicate that the device financing state has changed. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_DEVICE_OWNER_CHANGED:kotlin.String` Broadcast action: sent when the device owner is set, changed or cleared. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_DEVICE_POLICY_RESOURCE_UPDATED:kotlin.String` Broadcast action: notify system apps (e.g. settings, SysUI, etc) that the device management resources with IDs |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String` Activity action: Starts the administrator to get the mode for the provisioning. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_MANAGED_PROFILE_PROVISIONED:kotlin.String` Broadcast Action: This broadcast is sent to indicate that provisioning of a managed profile has completed successfully. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROFILE_OWNER_CHANGED:kotlin.String` Broadcast action: sent when the profile owner is set, changed or cleared. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISIONING_SUCCESSFUL:kotlin.String` Activity action: This activity action is sent to indicate that provisioning of a managed profile or managed device has completed successfully. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_DEVICE:kotlin.String` Activity action: Starts the provisioning flow which sets up a managed device. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE:kotlin.String` Activity action: Starts the provisioning flow which sets up a [managed profile](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#managed-profile). |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD:kotlin.String` Activity action: have the user enter a new password for the parent profile. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PASSWORD:kotlin.String` Activity action: have the user enter a new password. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_START_ENCRYPTION:kotlin.String` Activity action: begin the process of encrypting data on the device. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SYSTEM_UPDATE_POLICY_CHANGED:kotlin.String` Broadcast action: notify that a new local system update policy has been set by the device owner. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#APP_FUNCTIONS_DISABLED:kotlin.Int` Indicates that `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionManager.html#` is controlled and disabled by policy, i. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#APP_FUNCTIONS_DISABLED_CROSS_PROFILE:kotlin.Int` Indicates that `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionManager.html#` is controlled and disabled by a policy for cross profile interactions only, i. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#APP_FUNCTIONS_NOT_CONTROLLED_BY_POLICY:kotlin.Int` Indicates that `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionManager.html#` is not controlled by policy. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_DISABLED:kotlin.Int` Specifies the "disabled" auto time state. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ENABLED:kotlin.Int` Specifies the "enabled" auto time state. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_NOT_CONTROLLED_BY_POLICY:kotlin.Int` Specifies that the auto time state is not controlled by device policy. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_DISABLED:kotlin.Int` Specifies the "disabled" auto time zone state. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_ENABLED:kotlin.Int` Specifies the "enabled" auto time zone state. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_NOT_CONTROLLED_BY_POLICY:kotlin.Int` Specifies that the auto time zone state is not controlled by device policy. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#CONTENT_PROTECTION_DISABLED:kotlin.Int` Indicates that content protection is controlled and disabled by a policy (default). |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#CONTENT_PROTECTION_ENABLED:kotlin.Int` Indicates that content protection is controlled and enabled by a policy. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#CONTENT_PROTECTION_NOT_CONTROLLED_BY_POLICY:kotlin.Int` Indicates that content protection is not controlled by policy, allowing user to choose. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_APP_RESTRICTIONS:kotlin.String` Delegation of application restrictions management. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_BLOCK_UNINSTALL:kotlin.String` Delegation of application uninstall block. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_INSTALL:kotlin.String` Delegation of certificate installation and management. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` Grants access to selection of KeyChain certificates on behalf of requesting apps. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_ENABLE_SYSTEM_APP:kotlin.String` Delegation for enabling system apps. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_INSTALL_EXISTING_PACKAGE:kotlin.String` Delegation for installing existing packages. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_KEEP_UNINSTALLED_PACKAGES:kotlin.String` Delegation of management of uninstalled packages. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_NETWORK_LOGGING:kotlin.String` Grants access to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setNetworkLoggingEnabled(android.content.ComponentName,%20kotlin.Boolean)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isNetworkLoggingEnabled(android.content.ComponentName)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#retrieveNetworkLogs(android.content.ComponentName,%20kotlin.Long)`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PACKAGE_ACCESS:kotlin.String` Delegation of package access state. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PERMISSION_GRANT:kotlin.String` Delegation of permission policy and permission grant state. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_SECURITY_LOGGING:kotlin.String` Grants access to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setSecurityLoggingEnabled(android.content.ComponentName,%20kotlin.Boolean)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isSecurityLoggingEnabled(android.content.ComponentName)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#retrieveSecurityLogs(android.content.ComponentName)`, and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#retrievePreRebootSecurityLogs(android.content.ComponentName)`. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVATING:kotlin.Int` Result code for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()`: indicating that encryption is not currently active, but is currently being activated. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE:kotlin.Int` Result code for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStorageEncryption(android.content.ComponentName,%20kotlin.Boolean)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()`: indicating that encryption is active. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE_DEFAULT_KEY:kotlin.Int` Result code for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()`: indicating that encryption is active, but the encryption key is not cryptographically protected by the user's credentials. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE_PER_USER:kotlin.Int` Result code for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()`: indicating that encryption is active and the encryption key is tied to the user or profile. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_INACTIVE:kotlin.Int` Result code for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStorageEncryption(android.content.ComponentName,%20kotlin.Boolean)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()`: indicating that encryption is supported, but is not currently active. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_UNSUPPORTED:kotlin.Int` Result code for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStorageEncryption(android.content.ComponentName,%20kotlin.Boolean)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()`: indicating that encryption is not supported. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_ADD_EXPLANATION:kotlin.String` An optional CharSequence providing additional explanation for why the admin is being added. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_DELEGATION_SCOPES:kotlin.String` An `ArrayList<String>` corresponding to the delegation scopes given to an app in the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_APPLICATION_DELEGATION_SCOPES_CHANGED:kotlin.String` broadcast. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_DEVICE_ADMIN:kotlin.String` The ComponentName of the administrator component. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_DEVICE_PASSWORD_REQUIREMENT_ONLY:kotlin.String` A boolean extra for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD:kotlin.String` requesting that only device password requirement is enforced during the parent profile password enrolment flow. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PASSWORD_COMPLEXITY:kotlin.String` An integer indicating the complexity level of the new password an app would like the user to set when launching the action `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PASSWORD:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE:kotlin.String` An `https://developer.android.com/reference/kotlin/android/accounts/Account.html#` extra holding the account to migrate during managed profile provisioning. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE:kotlin.String` A `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#` extra of type `https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#` that is passed directly to the [Device Policy Controller](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#devicepolicycontroller) after [provisioning](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#managed-provisioning). |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ALLOWED_PROVISIONING_MODES:kotlin.String` An `https://developer.android.com/reference/kotlin/java/util/ArrayList.html#` of `https://developer.android.com/reference/kotlin/java/lang/Integer.html#` extra specifying the allowed provisioning modes. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ALLOW_OFFLINE:kotlin.String` A boolean extra indicating whether offline provisioning should be used. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME:kotlin.String` A ComponentName extra indicating the `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` of the application that will be set as the [Device Policy Controller](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#devicepolicycontroller). |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_MINIMUM_VERSION_CODE:kotlin.String` An int extra holding a minimum required version code for the device admin package. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM:kotlin.String` A String extra holding the URL-safe base64 encoded SHA-256 hash of the file at download location specified in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER:kotlin.String` A String extra holding a http cookie header which should be used in the http request to the url specified in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION:kotlin.String` A String extra holding a url that specifies the download location of the device admin package. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME:kotlin.String` A String extra holding the package name of the application that will be set as [Device Policy Controller](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#devicepolicycontroller). |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM:kotlin.String` A String extra holding the URL-safe base64 encoded SHA-256 checksum of any signature of the android package archive at the download location specified in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DISCLAIMERS:kotlin.String` A `https://developer.android.com/reference/kotlin/android/os/Bundle.html#`\[\] extra consisting of list of disclaimer headers and disclaimer contents. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DISCLAIMER_CONTENT:kotlin.String` A `https://developer.android.com/reference/kotlin/android/net/Uri.html#` extra pointing to disclaimer content. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DISCLAIMER_HEADER:kotlin.String` A String extra of localized disclaimer header. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_EMAIL_ADDRESS:kotlin.String` <br /> |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_IMEI:kotlin.String` A string extra holding the IMEI (International Mobile Equipment Identity) of the device. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION:kotlin.String` Boolean extra to indicate that the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE:kotlin.String` should be kept. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_KEEP_SCREEN_ON:kotlin.String` A `boolean` flag that indicates whether the screen should be on throughout the provisioning flow. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED:kotlin.String` A Boolean extra that can be used by the mobile device management application to skip the disabling of system apps during provisioning when set to `true`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_LOCALE:kotlin.String` A String extra holding the `https://developer.android.com/reference/kotlin/java/util/Locale.html#` that the device will be set to. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_LOCAL_TIME:kotlin.String` A Long extra holding the wall clock time (in milliseconds) to be set on the device's `https://developer.android.com/reference/kotlin/android/app/AlarmManager.html#`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_LOGO_URI:kotlin.String` A `https://developer.android.com/reference/kotlin/android/net/Uri.html#` extra pointing to a logo image. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_MAIN_COLOR:kotlin.String` A integer extra indicating the predominant color to show during the provisioning. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_MODE:kotlin.String` An intent extra holding the provisioning mode returned by the administrator. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SENSORS_PERMISSION_GRANT_OPT_OUT:kotlin.String` A boolean extra indicating the admin of a fully-managed device opts out of controlling permission grants for sensor-related permissions, see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermissionGrantState(android.content.ComponentName,%20kotlin.String,%20kotlin.String,%20kotlin.Int)`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SERIAL_NUMBER:kotlin.String` A string extra holding the serial number of the device. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SHOULD_LAUNCH_RESULT_INTENT:kotlin.String` A boolean extra that determines whether the provisioning flow should launch the resulting launch intent, if one is supplied by the device policy management role holder via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESULT_LAUNCH_INTENT:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS:kotlin.String` A boolean extra indicating if the education screens from the provisioning flow should be skipped. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SKIP_ENCRYPTION:kotlin.String` A boolean extra indicating whether device encryption can be skipped as part of [provisioning](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#managed-provisioning). |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SKIP_USER_CONSENT:kotlin.String` A boolean extra indicating if the user consent steps from the [provisioning flow](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#managed-provisioning) should be skipped. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_TIME_ZONE:kotlin.String` A String extra holding the time zone `https://developer.android.com/reference/kotlin/android/app/AlarmManager.html#` that the device will be set to. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_USE_MOBILE_DATA:kotlin.String` A boolean extra indicating if mobile data should be used during the provisioning flow for downloading the admin app. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_ANONYMOUS_IDENTITY:kotlin.String` The anonymous identity of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_CA_CERTIFICATE:kotlin.String` The CA certificate of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_DOMAIN:kotlin.String` The domain of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_EAP_METHOD:kotlin.String` The EAP method of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String` and could be one of `PEAP`, `TLS`, `TTLS`, `PWD`, `SIM`, `AKA` or `AKA_PRIME`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_HIDDEN:kotlin.String` A boolean extra indicating whether the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String` is hidden or not. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_IDENTITY:kotlin.String` The identity of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_PAC_URL:kotlin.String` A String extra holding the proxy auto-config (PAC) URL for the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_PASSWORD:kotlin.String` A String extra holding the password of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_PHASE2_AUTH:kotlin.String` The phase 2 authentication of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String` and could be one of `NONE`, `PAP`, `MSCHAP`, `MSCHAPV2`, `GTC`, `SIM`, `AKA` or `AKA_PRIME`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_PROXY_BYPASS:kotlin.String` A String extra holding the proxy bypass for the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_PROXY_HOST:kotlin.String` A String extra holding the proxy host for the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_PROXY_PORT:kotlin.String` An int extra holding the proxy port for the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SECURITY_TYPE:kotlin.String` A String extra indicating the security type of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String` and could be one of `NONE`, `WPA`, `WEP` or `EAP`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String` A String extra holding the ssid of the wifi network that should be used during nfc device owner provisioning for downloading the mobile device management application. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_USER_CERTIFICATE:kotlin.String` The user certificate of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESOURCE_IDS:kotlin.String` An integer array extra for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_DEVICE_POLICY_RESOURCE_UPDATED:kotlin.String` to indicate which resource IDs (i.e. strings and drawables) have been updated. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESOURCE_TYPE:kotlin.String` An `int` extra for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_DEVICE_POLICY_RESOURCE_UPDATED:kotlin.String` to indicate the type of the resource being updated, the type can be `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESOURCE_TYPE_DRAWABLE:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESOURCE_TYPE_STRING:kotlin.Int` |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESOURCE_TYPE_DRAWABLE:kotlin.Int` A `int` value for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESOURCE_TYPE:kotlin.String` to indicate that a resource of type `https://developer.android.com/reference/kotlin/android/graphics/drawable/Drawable.html#` is being updated. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESOURCE_TYPE_STRING:kotlin.Int` A `int` value for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESOURCE_TYPE:kotlin.String` to indicate that a resource of type `https://developer.android.com/reference/kotlin/java/lang/String.html#` is being updated. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESULT_LAUNCH_INTENT:kotlin.String` An `https://developer.android.com/reference/kotlin/android/content/Intent.html#` result extra specifying the `https://developer.android.com/reference/kotlin/android/content/Intent.html#` to be launched after provisioning is finalized. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY:kotlin.Int` Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#lockNow(kotlin.Int)`: also evict the user's credential encryption key from the keyring. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#FLAG_MANAGED_CAN_ACCESS_PARENT:kotlin.Int` Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addCrossProfileIntentFilter(android.content.ComponentName,%20android.content.IntentFilter,%20kotlin.Int)` to allow activities in the managed profile to access intents sent from the parent profile. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#FLAG_PARENT_CAN_ACCESS_MANAGED:kotlin.Int` Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addCrossProfileIntentFilter(android.content.ComponentName,%20android.content.IntentFilter,%20kotlin.Int)` to allow activities in the parent profile to access intents sent from the managed profile. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_BASE_INFO:kotlin.Int` Specifies that the device should attest its manufacturer details. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_IMEI:kotlin.Int` Specifies that the device should attest its IMEI. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_INDIVIDUAL_ATTESTATION:kotlin.Int` Specifies that the device should attest using an individual attestation certificate. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_MEID:kotlin.Int` Specifies that the device should attest its MEID. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_SERIAL:kotlin.Int` Specifies that the device should attest its serial number. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#INSTALLKEY_REQUEST_CREDENTIALS_ACCESS:kotlin.Int` Specifies that the calling app should be granted access to the installed credentials immediately. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#INSTALLKEY_SET_USER_SELECTABLE:kotlin.Int` Specifies that a user can select the key via the Certificate Selection prompt. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_BIOMETRICS:kotlin.Int` Disable all biometric authentication on keyguard secure screens (e.g. PIN/Pattern/Password). |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_FACE:kotlin.Int` Disable face authentication on keyguard secure screens (e.g. PIN/Pattern/Password). |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_FEATURES_ALL:kotlin.Int` Disable all current and future keyguard customizations. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_FEATURES_NONE:kotlin.Int` Widgets are enabled in keyguard |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_FINGERPRINT:kotlin.Int` Disable fingerprint authentication on keyguard secure screens (e.g. PIN/Pattern/Password). |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_IRIS:kotlin.Int` Disable iris authentication on keyguard secure screens (e.g. PIN/Pattern/Password). |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_REMOTE_INPUT:kotlin.Int` Disable text entry into notifications on secure keyguard screens (e.g. PIN/Pattern/Password). |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_SECURE_CAMERA:kotlin.Int` Disable the camera on secure keyguard screens (e.g. PIN/Pattern/Password) |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_SECURE_NOTIFICATIONS:kotlin.Int` Disable showing all notifications on secure keyguard screens (e.g. PIN/Pattern/Password) |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_SHORTCUTS_ALL:kotlin.Int` Disable all keyguard shortcuts. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_TRUST_AGENTS:kotlin.Int` Disable trust agents on secure keyguard screens (e.g. PIN/Pattern/Password). |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS:kotlin.Int` Only allow redacted notifications on secure keyguard screens (e.g. PIN/Pattern/Password) |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_WIDGETS_ALL:kotlin.Int` Disable all keyguard widgets. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LEAVE_ALL_SYSTEM_APPS_ENABLED:kotlin.Int` Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#createAndManageUser(android.content.ComponentName,%20kotlin.String,%20android.content.ComponentName,%20android.os.PersistableBundle,%20kotlin.Int)` to specify that the newly created user should skip the disabling of system apps during provisioning. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_BLOCK_ACTIVITY_START_IN_TASK:kotlin.Int` Enable blocking of non-allowlisted activities from being started into a locked task. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_GLOBAL_ACTIONS:kotlin.Int` Enable the global actions dialog during LockTask mode. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_HOME:kotlin.Int` Enable the Home button during LockTask mode. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_KEYGUARD:kotlin.Int` Enable the keyguard during LockTask mode. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_NONE:kotlin.Int` Disable all configurable SystemUI features during LockTask mode. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_NOTIFICATIONS:kotlin.Int` Enable notifications during LockTask mode. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_OVERVIEW:kotlin.Int` Enable the Overview button and the Overview screen during LockTask mode. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_SYSTEM_INFO:kotlin.Int` Enable the system info area in the status bar during LockTask mode. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MAKE_USER_EPHEMERAL:kotlin.Int` Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#createAndManageUser(android.content.ComponentName,%20kotlin.String,%20android.content.ComponentName,%20android.os.PersistableBundle,%20kotlin.Int)` to specify that the user should be created ephemeral. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` This MIME type is used for starting the device owner provisioning. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MTE_DISABLED:kotlin.Int` Require that MTE be disabled on the device. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MTE_ENABLED:kotlin.Int` Require that MTE be enabled on the device, if supported. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MTE_NOT_CONTROLLED_BY_POLICY:kotlin.Int` Allow the user to choose whether to enable MTE on the device. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_DISABLED:kotlin.Int` Indicates that nearby streaming is disabled. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_ENABLED:kotlin.Int` Indicates that nearby streaming is enabled. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY:kotlin.Int` Indicates that nearby streaming is not controlled by policy, which means nearby streaming is allowed. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY:kotlin.Int` Indicates that nearby streaming is enabled only to devices offering a comparable level of security, with the same authenticated managed account. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#OPERATION_SAFETY_REASON_DRIVING_DISTRACTION:kotlin.Int` Indicates that a `https://developer.android.com/reference/kotlin/android/app/admin/UnsafeStateException` was thrown because the operation would distract the driver of the vehicle. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_HIGH:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_LOW:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_MEDIUM:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_NONE:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`: no password. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_ALPHABETIC:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: the user must have entered a password containing at least alphabetic (or other symbol) characters. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_ALPHANUMERIC:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: the user must have entered a password containing at least *both\>* numeric *and* alphabetic (or other symbol) characters. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_BIOMETRIC_WEAK:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: the policy allows for low-security biometric recognition technology. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: allows the admin to set precisely how many characters of various types the password should contain to satisfy the policy. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_NUMERIC:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: the user must have entered a password containing at least numeric characters. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_NUMERIC_COMPLEX:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: the user must have entered a password containing at least numeric characters with no repeating (4444) or ordered (1234, 4321, 2468) sequences. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_SOMETHING:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: the policy requires some kind of password or pattern, but doesn't care what it is. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_UNSPECIFIED:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: the policy has no requirements for the password. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_DEFAULT:kotlin.Int` Runtime permission state: The user can manage the permission through the UI. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_DENIED:kotlin.Int` Runtime permission state: The permission is denied to the app and the user cannot manage the permission through the UI. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_GRANTED:kotlin.Int` Runtime permission state: The permission is granted to the app and the user cannot manage the permission through the UI. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_POLICY_AUTO_DENY:kotlin.Int` Permission policy to always deny new permission requests for runtime permissions. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_POLICY_AUTO_GRANT:kotlin.Int` Permission policy to always grant new permission requests for runtime permissions. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_POLICY_PROMPT:kotlin.Int` Permission policy to prompt user for new permission requests for runtime permissions. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERSONAL_APPS_NOT_SUSPENDED:kotlin.Int` Return value for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPersonalAppsSuspendedReasons(android.content.ComponentName)` when personal apps are not suspended. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERSONAL_APPS_SUSPENDED_EXPLICITLY:kotlin.Int` Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPersonalAppsSuspendedReasons(android.content.ComponentName)` return value. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERSONAL_APPS_SUSPENDED_PROFILE_TIMEOUT:kotlin.Int` Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPersonalAppsSuspendedReasons(android.content.ComponentName)` return value. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#POLICY_DISABLE_CAMERA:kotlin.String` Constant to indicate the feature of disabling the camera. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#POLICY_DISABLE_SCREEN_CAPTURE:kotlin.String` Constant to indicate the feature of disabling screen captures. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#POLICY_SCOPE_DEVICE:kotlin.Int` Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPolicy(android.app.admin.PolicyIdentifier,%20kotlin.Int,%20android.app.admin.DevicePolicyManager.setPolicy.T)` to apply the policy to the entire device. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#POLICY_SCOPE_PARENT_USER:kotlin.Int` Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPolicy(android.app.admin.PolicyIdentifier,%20kotlin.Int,%20android.app.admin.DevicePolicyManager.setPolicy.T)` to apply the policy to the parent user of the current user. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#POLICY_SCOPE_USER:kotlin.Int` Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPolicy(android.app.admin.PolicyIdentifier,%20kotlin.Int,%20android.app.admin.DevicePolicyManager.setPolicy.T)` to apply the policy to the same user as the current user. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PRIVATE_DNS_MODE_OFF:kotlin.Int` Specifies that Private DNS was turned off completely. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PRIVATE_DNS_MODE_OPPORTUNISTIC:kotlin.Int` Specifies that the device owner requested opportunistic DNS over TLS |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PRIVATE_DNS_MODE_PROVIDER_HOSTNAME:kotlin.Int` Specifies that the device owner configured a specific host to use for Private DNS. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PRIVATE_DNS_MODE_UNKNOWN:kotlin.Int` Specifies that the Private DNS setting is in an unknown state. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PRIVATE_DNS_SET_ERROR_FAILURE_SETTING:kotlin.Int` General failure to set the Private DNS mode, not due to one of the reasons listed above. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PRIVATE_DNS_SET_ERROR_HOST_NOT_SERVING:kotlin.Int` If the `privateDnsHost` provided was of a valid hostname but that host was found to not support DNS-over-TLS. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PRIVATE_DNS_SET_NO_ERROR:kotlin.Int` The selected mode has been set successfully. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PROVISIONING_MODE_FULLY_MANAGED_DEVICE:kotlin.Int` The provisioning mode for fully managed device. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PROVISIONING_MODE_MANAGED_PROFILE:kotlin.Int` The provisioning mode for managed profile. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PROVISIONING_MODE_MANAGED_PROFILE_ON_PERSONAL_DEVICE:kotlin.Int` The provisioning mode for a managed profile on a personal device. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT:kotlin.Int` Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPasswordWithToken(android.content.ComponentName,%20kotlin.String,%20kotlin.ByteArray,%20kotlin.Int)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPassword(kotlin.String,%20kotlin.Int)`: don't ask for user credentials on device boot. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#RESET_PASSWORD_REQUIRE_ENTRY:kotlin.Int` Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPasswordWithToken(android.content.ComponentName,%20kotlin.String,%20kotlin.ByteArray,%20kotlin.Int)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPassword(kotlin.String,%20kotlin.Int)`: don't allow other admins to change the password again until the user has entered it. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#SKIP_SETUP_WIZARD:kotlin.Int` Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#createAndManageUser(android.content.ComponentName,%20kotlin.String,%20android.content.ComponentName,%20android.os.PersistableBundle,%20kotlin.Int)` to skip setup wizard after creating a new user. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_192:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`: enterprise 192 bit network. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_EAP:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`: enterprise EAP network. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_OPEN:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`: no minimum security level. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_PERSONAL:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`: personal network such as WEP, WPA2-PSK. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_PERSONAL_WPA:kotlin.Int` Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`: personal network without WEP. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_EUICC:kotlin.Int` Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeDevice(kotlin.Int)`: also erase the device's eUICC data. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_EXTERNAL_STORAGE:kotlin.Int` Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int)`: also erase the device's adopted external storage (such as adopted SD cards). |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_RESET_PROTECTION_DATA:kotlin.Int` Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int)`: also erase the factory reset protection data. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_SILENTLY:kotlin.Int` Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int)`: won't show reason for wiping to the user. |

| Public methods ||
|---|---|
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#acknowledgeDeviceCompliant()()` Called by a profile owner of an organization-owned managed profile to acknowledge that the device is compliant and the user can turn the profile off if needed according to the maximum time off policy. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addCrossProfileIntentFilter(android.content.ComponentName,%20android.content.IntentFilter,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, filter: https://developer.android.com/reference/kotlin/android/content/IntentFilter.html#!, flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by the profile owner of a managed profile so that some intents sent in the managed profile can also be resolved in the parent, or vice versa. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addCrossProfileWidgetProvider(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Called by the profile owner of a managed profile or a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_PROFILE_INTERACTION:kotlin.String` to enable widget providers from a given package to be available in the parent profile. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addOverrideApn(android.content.ComponentName,%20android.telephony.data.ApnSetting)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, apnSetting: https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#)` Called by device owner or managed profile owner to add an override APN. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addPersistentPreferredActivity(android.content.ComponentName,%20android.content.IntentFilter,%20android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, filter: https://developer.android.com/reference/kotlin/android/content/IntentFilter.html#!, activity: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by a profile owner or device owner or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_LOCK_TASK:kotlin.String`. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addUserRestriction(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Called by a profile owner, device owner or a holder of any permission that is associated with a user restriction to set a user restriction specified by the key. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addUserRestrictionGlobally(kotlin.String)(key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Called by a profile owner, device owner or a holder of any permission that is associated with a user restriction to set a user restriction specified by the provided `key` globally on all users. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#bindDeviceAdminServiceAsUser(android.content.ComponentName,%20android.content.Intent,%20android.content.ServiceConnection,%20android.content.Context.BindServiceFlags,%20android.os.UserHandle)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, serviceIntent: https://developer.android.com/reference/kotlin/android/content/Intent.html#, conn: https://developer.android.com/reference/kotlin/android/content/ServiceConnection.html#, flags: https://developer.android.com/reference/kotlin/android/content/Context.BindServiceFlags.html#, targetUser: https://developer.android.com/reference/kotlin/android/os/UserHandle.html#)` See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#bindDeviceAdminServiceAsUser(android.content.ComponentName,%20android.content.Intent,%20android.content.ServiceConnection,%20kotlin.Int,%20android.os.UserHandle)`. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#bindDeviceAdminServiceAsUser(android.content.ComponentName,%20android.content.Intent,%20android.content.ServiceConnection,%20kotlin.Int,%20android.os.UserHandle)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, serviceIntent: https://developer.android.com/reference/kotlin/android/content/Intent.html#, conn: https://developer.android.com/reference/kotlin/android/content/ServiceConnection.html#, flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, targetUser: https://developer.android.com/reference/kotlin/android/os/UserHandle.html#)` Called by a device owner to bind to a service from a secondary managed user or vice versa. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#canAdminGrantSensorsPermissions()()` Returns true if the caller is running on a device where an admin can grant permissions related to device sensors. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#canUsbDataSignalingBeDisabled()()` Returns whether enabling or disabling USB data signaling is supported on the device. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#clearApplicationUserData(android.content.ComponentName,%20kotlin.String,%20java.util.concurrent.Executor,%20android.app.admin.DevicePolicyManager.OnClearApplicationUserDataListener)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, executor: https://developer.android.com/reference/kotlin/java/util/concurrent/Executor.html#, listener: https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager.OnClearApplicationUserDataListener)` Called by the device owner or profile owner to clear application user data of a given package. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#clearCrossProfileIntentFilters(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Called by a profile owner of a managed profile to remove the cross-profile intent filters that go from the managed profile to the parent, or from the parent to the managed profile. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#clearDeviceOwnerApp(kotlin.String)(packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Clears the current device owner. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#clearPackagePersistentPreferredActivities(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Called by a profile owner or device owner or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_LOCK_TASK:kotlin.String` to remove all persistent intent handler preferences associated with the given package that were set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addPersistentPreferredActivity(android.content.ComponentName,%20android.content.IntentFilter,%20android.content.ComponentName)`. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#clearProfileOwner(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Clears the active profile owner. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#clearResetPasswordToken(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Called by a profile, device owner or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_RESET_PASSWORD:kotlin.String` to revoke the current password reset token. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#clearUserRestriction(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Called by a profile owner, device owner or a holder of any permission that is associated with a user restriction to clear a user restriction specified by the key. |
| open [Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#)! | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#createAdminSupportIntent(kotlin.String)(restriction: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Called by any app to display a support dialog when a feature was disabled by an admin. |
| open [UserHandle](https://developer.android.com/reference/kotlin/android/os/UserHandle.html#)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#createAndManageUser(android.content.ComponentName,%20kotlin.String,%20android.content.ComponentName,%20android.os.PersistableBundle,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, name: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, profileOwner: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, adminExtras: https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#?, flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by a device owner to create a user with the specified name and a given component of the calling package as profile owner. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#enableSystemApp(android.content.ComponentName,%20android.content.Intent)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, intent: https://developer.android.com/reference/kotlin/android/content/Intent.html#!)` Re-enable system apps by intent that were disabled by default when the user was initialized. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#enableSystemApp(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Re-enable a system app that was disabled by default when the user was initialized. |
| open [AttestedKeyPair](https://developer.android.com/reference/kotlin/android/security/AttestedKeyPair.html#)! | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#generateKeyPair(android.content.ComponentName,%20kotlin.String,%20android.security.keystore.KeyGenParameterSpec,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, algorithm: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, keySpec: https://developer.android.com/reference/kotlin/android/security/keystore/KeyGenParameterSpec.html#, idAttestationFlags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` This API can be called by the following to generate a new private/public key pair: - Device owner - Profile owner - Delegated certificate installer - Credential management app - An app that holds the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission If the device supports key generation via secure hardware, this method is useful for creating a key in KeyChain that never left the secure hardware. <br /> |
| open [AttestedKeyPair](https://developer.android.com/reference/kotlin/android/security/AttestedKeyPair.html#) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#generateKeyPair(kotlin.String,%20android.security.keystore.KeyGenParameterSpec,%20kotlin.Int,%20kotlin.Int)(algorithm: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, keySpec: https://developer.android.com/reference/kotlin/android/security/keystore/KeyGenParameterSpec.html#, idAttestationFlags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, scope: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Generates a new private/public key pair with a specified scope. |
| open [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getAccountTypesWithManagementDisabled()()` Gets the array of accounts for which account management is disabled by the profile owner or device owner. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)!\>? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getActiveAdmins()()` Return a list of all currently active device administrators' component names. |
| open [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getAffiliationIds(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Returns the set of affiliation ids previously set via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)`, or an empty set if none have been set. |
| open [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getAlwaysOnVpnLockdownWhitelist(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by device or profile owner to query the set of packages that are allowed to access the network directly when always-on VPN is in lockdown mode but not connected. |
| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getAlwaysOnVpnPackage(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by a device or profile owner to read the name of the package administering an always-on VPN connection for the current user. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getAppFunctionsPolicy()()` Returns the current `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionManager.html#` policy. |
| open [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getApplicationRestrictions(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Retrieves the application restrictions for a given target application running in the calling user. |
| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getApplicationRestrictionsManagingPackage(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by a profile owner or device owner to retrieve the application restrictions managing package for the current user, or `null` if none is set. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getAutoTimeEnabled(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Returns true if auto time is enabled on the device. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getAutoTimePolicy()()` Returns current auto time policy's state. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getAutoTimeRequired()()` <br /> |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getAutoTimeZoneEnabled(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Returns true if auto time zone is enabled on the device. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getAutoTimeZonePolicy()()` Returns auto time zone policy's current state. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[UserHandle](https://developer.android.com/reference/kotlin/android/os/UserHandle.html#)!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getBindDeviceAdminTargetUsers(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Returns the list of target users that the calling device owner or owner of secondary user can use when calling #bindDeviceAdminServiceAsUser. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getBluetoothContactSharingDisabled(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by a profile owner of a managed profile to determine whether or not Bluetooth devices cannot access enterprise contacts. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCameraDisabled(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Determine whether or not the device's cameras have been disabled for this user, either by the calling admin, if specified, or all admins. |
| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCertInstallerPackage(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by a profile owner or device owner to retrieve the certificate installer for the user, or `null` if none is set. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getContentProtectionPolicy(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Returns the current content protection policy. |
| open [PackagePolicy](https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCredentialManagerPolicy()()` Called by a device owner or profile owner of a managed profile to retrieve the credential manager policy. |
| open [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCrossProfileCalendarPackages(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Gets a set of package names that are allowed to access cross-profile calendar APIs. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCrossProfileCallerIdDisabled(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by a profile owner of a managed profile to determine whether or not caller-Id information has been disabled. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCrossProfileContactsSearchDisabled(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by a profile owner of a managed profile to determine whether or not contacts search has been disabled. |
| open [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCrossProfilePackages(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Returns the set of package names that the admin has previously set as allowed to request user consent for cross-profile communication, via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCrossProfilePackages(android.content.ComponentName,%20kotlin.collections.MutableSet)`. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCrossProfileWidgetProviders(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Called by the profile owner of a managed profile or a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_PROFILE_INTERACTION:kotlin.String` to query providers from which packages are available in the parent profile. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCurrentFailedPasswordAttempts()()` Retrieve the number of times the user has failed at entering a password since that last successful password entry. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getDelegatePackages(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, delegationScope: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Called by a profile owner or device owner to retrieve a list of delegate packages that were granted a delegation scope. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getDelegatedScopes(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, delegatedPackage: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Called by a profile owner or device owner to retrieve a list of the scopes given to a delegate package. |
| open [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)! | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getDeviceOwnerLockScreenInfo()()` <br /> |
| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getDevicePolicyManagementRoleHolderPackage()()` Returns the package name of the device policy management role holder. |
| open [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)! | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getEndUserSessionMessage(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Returns the user session end message. |
| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getEnrollmentSpecificId()()` Returns an enrollment-specific identifier of this device, which is guaranteed to be the same value for the same device, enrolled into the same organization by the same managing app. |
| open [FactoryResetProtectionPolicy](https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getFactoryResetProtectionPolicy(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Callable by device owner or profile owner of an organization-owned device, to retrieve the current factory reset protection (FRP) policy set previously by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setFactoryResetProtectionPolicy(android.content.ComponentName,%20android.app.admin.FactoryResetProtectionPolicy)`. |
| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getGlobalPrivateDnsHost(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Returns the system-wide Private DNS host. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getGlobalPrivateDnsMode(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Returns the system-wide Private DNS mode. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getInstalledCaCerts(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Returns all CA certificates that are currently trusted, excluding system CA certificates. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getKeepUninstalledPackages(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Get the list of apps to keep around as APKs even if no user has currently installed it. |
| open [MutableMap](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/index.html)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!, [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getKeyPairGrants(kotlin.String)(alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Called by a device or profile owner, or delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), to query which apps have access to a given KeyChain key. |
| open [MutableMap](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/index.html)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!, [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getKeyPairGrants(kotlin.String,%20kotlin.Int)(alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, scope: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by a device or profile owner, delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), or permission caller, to query which apps have access to a given KeyChain key in the specified scope. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getKeyguardDisabledFeatures(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Determine whether or not features have been disabled in keyguard either by the calling admin, if specified, or all admins that set restrictions on this user and its participating profiles. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getLockTaskFeatures(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Gets which system features are enabled for LockTask mode. |
| open [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getLockTaskPackages(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Returns the list of packages allowed to start the lock task mode. |
| open [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getLongSupportMessage(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by a device admin to get the long support message. |
| open [PackagePolicy](https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getManagedProfileCallerIdAccessPolicy()()` Called by a profile owner of a managed profile to retrieve the caller id policy. |
| open [PackagePolicy](https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getManagedProfileContactsAccessPolicy()()` Called by a profile owner of a managed profile to determine the current policy applied to managed profile contacts. |
| open [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getManagedProfileMaximumTimeOff(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by a profile owner of an organization-owned managed profile to get maximum time the profile is allowed to be turned off. |
| open [ManagedSubscriptionsPolicy](https://developer.android.com/reference/kotlin/android/app/admin/ManagedSubscriptionsPolicy) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getManagedSubscriptionsPolicy()()` Returns the current `https://developer.android.com/reference/kotlin/android/app/admin/ManagedSubscriptionsPolicy`. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMaximumFailedPasswordsForWipe(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Retrieve the current maximum number of login attempts that are allowed before the device or profile is wiped, for a particular admin or all admins that set restrictions on this user and its participating profiles. |
| open [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMaximumTimeToLock(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Retrieve the current maximum time to unlock for a particular admin or all admins that set restrictions on this user and its participating profiles. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMeteredDataDisabledPackages(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by a device or profile owner to retrieve the list of packages which are restricted by the admin from using metered data. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()()` Returns the current Wi-Fi minimum security level. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMtePolicy()()` Called by a device owner, profile owner of an organization-owned device to get the Memory Tagging Extension (MTE) policy [Learn more about MTE](https://source.android.com/docs/security/test/memory-safety/arm-mte) |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getNearbyAppStreamingPolicy()()` Returns the current runtime nearby app streaming policy set by the device or profile owner. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getNearbyNotificationStreamingPolicy()()` Returns the current runtime nearby notification streaming policy set by the device or profile owner. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getOrganizationColor(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by a profile owner of a managed profile to retrieve the color used for customization. |
| open [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getOrganizationName(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Called by the device owner (since API 26) or profile owner (since API 24) or holders of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_ORGANIZATION_IDENTITY:kotlin.String` to retrieve the name of the organization under management. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[ApnSetting](https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#)!\>! | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getOverrideApns(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by device owner or managed profile owner to get all override APNs inserted by device owner or managed profile owner previously using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addOverrideApn(android.content.ComponentName,%20android.telephony.data.ApnSetting)`. |
| open [DevicePolicyManager](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Called by the profile owner of a managed profile or other apps in a managed profile to obtain a `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` whose calls act on the parent profile. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()()` Returns how complex the current user's screen lock is. |
| open [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordExpiration(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Get the current password expiration time for a particular admin or all admins that set restrictions on this user and its participating profiles. |
| open [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordExpirationTimeout(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Get the password expiration timeout for the given admin. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordHistoryLength(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Retrieve the current password history length for a particular admin or all admins that set restrictions on this user and its participating profiles. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMaximumLength(kotlin.Int)(quality: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Return the maximum password length that the device supports for a particular password quality. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumLength(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Retrieve the current minimum password length for a particular admin or all admins that set restrictions on this user and its participating profiles. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumLetters(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Retrieve the current number of letters required in the password for a particular admin or all admins that set restrictions on this user and its participating profiles. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumLowerCase(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Retrieve the current number of lower case letters required in the password for a particular admin or all admins that set restrictions on this user and its participating profiles. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumNonLetter(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Retrieve the current number of non-letter characters required in the password for a particular admin or all admins that set restrictions on this user and its participating profiles. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumNumeric(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Retrieve the current number of numerical digits required in the password for a particular admin or all admins that set restrictions on this user and its participating profiles. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumSymbols(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Retrieve the current number of symbols required in the password for a particular admin or all admins that set restrictions on this user and its participating profiles. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumUpperCase(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Retrieve the current number of upper case letters required in the password for a particular admin or all admins that set restrictions on this user and its participating profiles. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordQuality(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Retrieve the current minimum password quality for a particular admin or all admins that set restrictions on this user and its participating profiles. |
| open [SystemUpdateInfo](https://developer.android.com/reference/kotlin/android/app/admin/SystemUpdateInfo)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPendingSystemUpdate(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Get information about a pending system update. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPermissionGrantState(android.content.ComponentName,%20kotlin.String,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, permission: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Returns the current grant state of a runtime permission for a specific application. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPermissionPolicy(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#!)` Returns the current runtime permission policy set by the device or profile owner. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPermittedAccessibilityServices(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Returns the list of permitted accessibility services set by this device or profile owner. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPermittedCrossProfileNotificationListeners(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Returns the list of packages installed on the primary user that allowed to use a `https://developer.android.com/reference/kotlin/android/service/notification/NotificationListenerService.html#` to receive notifications from this managed profile, as set by the profile owner. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPermittedInputMethods(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Returns the list of permitted input methods set by this device or profile owner. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPersonalAppsSuspendedReasons(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by profile owner of an organization-owned managed profile to check whether personal apps are suspended. |
| open T? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPolicy(android.app.admin.PolicyIdentifier,%20kotlin.Int)(id: https://developer.android.com/reference/kotlin/android/app/admin/PolicyIdentifier<T>, scope: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Gets the value of the given policy, as it was set by the caller. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[PreferentialNetworkServiceConfig](https://developer.android.com/reference/kotlin/android/app/admin/PreferentialNetworkServiceConfig)!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPreferentialNetworkServiceConfigs()()` Get preferential network configuration |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getRequiredPasswordComplexity()()` Gets the password complexity requirement set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`, for the current user. |
| open [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getRequiredStrongAuthTimeout(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Determine for how long the user will be able to use secondary, non strong auth for authentication, since last strong method authentication (password, pin or pattern) was used. |
| open T? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getResolvedDeviceWidePolicy(android.app.admin.PolicyIdentifier)(id: https://developer.android.com/reference/kotlin/android/app/admin/PolicyIdentifier<T>)` Returns the resolved value of the given device-wide policy. |
| open T? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getResolvedPerUserPolicy(android.app.admin.PolicyIdentifier)(id: https://developer.android.com/reference/kotlin/android/app/admin/PolicyIdentifier<T>)` Returns the resolved value of the given per-user policy. |
| open [DevicePolicyResourcesManager](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyResourcesManager) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getResources()()` Returns a `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyResourcesManager` containing the required APIs to set, reset, and get device policy related resources. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getScreenCaptureDisabled(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Determine whether or not screen capture has been disabled by the calling admin, if specified, or all admins. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[UserHandle](https://developer.android.com/reference/kotlin/android/os/UserHandle.html#)!\>! | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getSecondaryUsers(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by a device owner to list all secondary users on the device. |
| open [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)! | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getShortSupportMessage(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Called by a device admin or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_SUPPORT_MESSAGE:kotlin.String` to get the short support message. |
| open [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)! | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStartUserSessionMessage(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Returns the user session start message. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryption(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` <br /> |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()()` Called by an application that is administering the device to determine the current encryption status of the device. |
| open [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getSubscriptionIds()()` Returns the subscription ids of all subscriptions which were downloaded by the calling admin. |
| open [SystemUpdatePolicy](https://developer.android.com/reference/kotlin/android/app/admin/SystemUpdatePolicy)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getSystemUpdatePolicy()()` Retrieve a local system update policy set previously by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setSystemUpdatePolicy(android.content.ComponentName,%20android.app.admin.SystemUpdatePolicy)`. |
| open [PersistableBundle](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getTransferOwnershipBundle()()` Returns the data passed from the current administrator to the new administrator during an ownership transfer. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[PersistableBundle](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#)!\>? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getTrustAgentConfiguration(android.content.ComponentName,%20android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, agent: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Gets configuration for the given trust agent based on aggregating all calls to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setTrustAgentConfiguration(android.content.ComponentName,%20android.content.ComponentName,%20android.os.PersistableBundle)` for all device admins. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getUserControlDisabledPackages(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Returns the list of packages over which user control is disabled by a device or profile owner or holders of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_APPS_CONTROL:kotlin.String`. |
| open [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getUserRestrictions(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by an admin to get user restrictions set by themselves with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addUserRestriction(android.content.ComponentName,%20kotlin.String)`. |
| open [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getUserRestrictionsGlobally()()` Called by a profile or device owner to get global user restrictions set with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addUserRestrictionGlobally(kotlin.String)`. |
| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getWifiMacAddress(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Gets the MAC address of the Wi-Fi device. |
| open [WifiSsidPolicy](https://developer.android.com/reference/kotlin/android/app/admin/WifiSsidPolicy)? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getWifiSsidPolicy()()` Returns the current Wi-Fi SSID policy. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#grantKeyPairToApp(android.content.ComponentName,%20kotlin.String,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Called by a device or profile owner, or delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), to grant an application access to an already-installed (or generated) KeyChain key. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#grantKeyPairToApp(kotlin.String,%20kotlin.String,%20kotlin.Int)(alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, scope: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by a device or profile owner, delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), or permission caller, to grant an application access to an already-installed (or generated) KeyChain key in the specified scope. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#grantKeyPairToWifiAuth(kotlin.String)(alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Called by a device or profile owner, or delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), to allow using a KeyChain key pair for authentication to Wifi networks. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#grantKeyPairToWifiAuth(kotlin.String,%20kotlin.Int)(alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, scope: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by a device or profile owner, delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), or permission caller, to allow using a KeyChain key pair of the specified scope for authentication to Wifi networks. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#hasCaCertInstalled(android.content.ComponentName,%20kotlin.ByteArray)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, certBuffer: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html!)` Returns whether this certificate is installed as a trusted CA. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#hasGrantedPolicy(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, usesPolicy: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Returns true if an administrator has been granted a particular device policy. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#hasKeyPair(kotlin.String)(alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` This API can be called by the following to query whether a certificate and private key are installed under a given alias: - Device owner - Profile owner - Delegated certificate installer - Credential management app - An app that holds the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission If called by the credential management app, the alias must exist in the credential management app's `https://developer.android.com/reference/kotlin/android/security/AppUriAuthenticationPolicy.html#`. <br /> |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#hasKeyPair(kotlin.String,%20kotlin.Int)(alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, scope: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` This API can be called by the following to query whether a certificate and private key are installed under a given alias for the specified scope: - Device owner - Profile owner - Delegated certificate installer - Credential management app (user-specific keychain only) - An app that holds the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission <br /> |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#hasLockdownAdminConfiguredNetworks(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Called by a device owner or a profile owner of an organization-owned managed profile to determine whether the user is prevented from modifying networks configured by the admin. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installCaCert(android.content.ComponentName,%20kotlin.ByteArray)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, certBuffer: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html!)` Installs the given certificate as a user CA. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installExistingPackage(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Install an existing package that has been installed in another user, or has been kept after removal via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setKeepUninstalledPackages(android.content.ComponentName,%20kotlin.collections.MutableList)`. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installKeyPair(android.content.ComponentName,%20java.security.PrivateKey,%20java.security.cert.Certificate,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, privKey: https://developer.android.com/reference/kotlin/java/security/PrivateKey.html#, cert: https://developer.android.com/reference/kotlin/java/security/cert/Certificate.html#, alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` This API can be called by the following to install a certificate and corresponding private key: - Device owner - Profile owner - Delegated certificate installer - Credential management app - An app that holds the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission All apps within the profile will be able to access the certificate and use the private key, given direct user approval. <br /> |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installKeyPair(android.content.ComponentName,%20java.security.PrivateKey,%20kotlin.Array,%20kotlin.String,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, privKey: https://developer.android.com/reference/kotlin/java/security/PrivateKey.html#, certs: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/java/security/cert/Certificate.html#!>, alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, requestAccess: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` This API can be called by the following to install a certificate chain and corresponding private key for the leaf certificate: - Device owner - Profile owner - Delegated certificate installer - Credential management app - An app that holds the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission All apps within the profile will be able to access the certificate chain and use the private key, given direct user approval. <br /> |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installKeyPair(android.content.ComponentName,%20java.security.PrivateKey,%20kotlin.Array,%20kotlin.String,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, privKey: https://developer.android.com/reference/kotlin/java/security/PrivateKey.html#, certs: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/java/security/cert/Certificate.html#!>, alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` This API can be called by the following to install a certificate chain and corresponding private key for the leaf certificate: - Device owner - Profile owner - Delegated certificate installer - Credential management app - An app that holds the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission All apps within the profile will be able to access the certificate chain and use the private key, given direct user approval (if the user is allowed to select the private key). <br /> |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installSystemUpdate(android.content.ComponentName,%20android.net.Uri,%20java.util.concurrent.Executor,%20android.app.admin.DevicePolicyManager.InstallSystemUpdateCallback)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, updateFilePath: https://developer.android.com/reference/kotlin/android/net/Uri.html#, executor: https://developer.android.com/reference/kotlin/java/util/concurrent/Executor.html#, callback: https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager.InstallSystemUpdateCallback)` Called by device owner or profile owner of an organization-owned managed profile to install a system update from the given file. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isActivePasswordSufficient()()` Determines whether the calling user's current password meets policy requirements (e.g. quality, minimum length). |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isActivePasswordSufficientForDeviceRequirement()()` Called by profile owner of a managed profile to determine whether the current device password meets policy requirements set explicitly device-wide. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAdminActive(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Return true if the given administrator component is currently active (enabled) in the system. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()()` Returns whether this user is affiliated with the device. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAlwaysOnVpnLockdownEnabled(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by device or profile owner to query whether current always-on VPN is configured in lockdown mode. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isApplicationHidden(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Determine if a package is hidden. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isBackupServiceEnabled(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Return whether the backup service is enabled by the device owner or profile owner for the current user, as previously set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setBackupServiceEnabled(android.content.ComponentName,%20kotlin.Boolean)`. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isCallerApplicationRestrictionsManagingPackage()()` Called by any application to find out whether it has been granted permission via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setApplicationRestrictionsManagingPackage(android.content.ComponentName,%20kotlin.String)` to manage application restrictions for the calling user. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isCommonCriteriaModeEnabled(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Returns whether Common Criteria mode is currently enabled. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isComplianceAcknowledgementRequired()()` Called by a profile owner of an organization-owned managed profile to query whether it needs to acknowledge device compliance to allow the user to turn the profile off if needed according to the maximum profile time off policy. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isDeviceFinanced()()` Returns `true` if this device is marked as a financed device. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isDeviceIdAttestationSupported()()` Returns `true` if the device supports attestation of device identifiers in addition to key attestation. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isDeviceOwnerApp(kotlin.String)(packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Used to determine if a particular package has been registered as a Device Owner app. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isEphemeralUser(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Checks if the profile owner is running in an ephemeral user. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isKeyPairGrantedToWifiAuth(kotlin.String)(alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Called by a device or profile owner, or delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), to query whether a KeyChain key pair can be used for authentication to Wifi networks. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isKeyPairGrantedToWifiAuth(kotlin.String,%20kotlin.Int)(alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, scope: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by a device or profile owner, delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), or permission caller, to query whether a KeyChain key pair of the specified scope can be used for authentication to Wifi networks. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isLockTaskPermitted(kotlin.String)(pkg: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` This function lets the caller know whether the given component is allowed to start the lock task mode. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isLogoutEnabled()()` Returns whether logout is enabled by a device owner. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isManagedProfile(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Return if this user is a managed profile of another user. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isMasterVolumeMuted(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by profile or device owners to check whether the global volume mute is on or off. |
| open static [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isMtePolicyEnforced()()` Get the current MTE state of the device. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isNetworkLoggingEnabled(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Return whether network logging is enabled by a device owner or profile owner of a managed profile. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isOrganizationOwnedDeviceWithManagedProfile()()` Apps can use this method to find out if the device was provisioned as organization-owend device with a managed profile. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isOutgoingEsimTransferAllowed(kotlin.Int)(subscriptionId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Returns whether an outgoing eSIM transfer is allowed for a specific subscription. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isOverrideApnEnabled(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by device owner to check if override APNs are currently enabled. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isPackageSuspended(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Determine if a package is suspended. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isPreferentialNetworkServiceEnabled()()` Indicates whether preferential network service is enabled. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isProfileOwnerApp(kotlin.String)(packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Used to determine if a particular package is registered as the profile owner for the user. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isProvisioningAllowed(kotlin.String)(action: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Returns whether it is possible for the caller to initiate provisioning of a managed profile or device, setting itself as the device or profile owner. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isResetPasswordTokenActive(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Called by a profile, device owner or a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_RESET_PASSWORD:kotlin.String` to check if the current reset password token is active. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isSafeOperation(kotlin.Int)(reason: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Checks if it's safe to run operations that can be affected by the given `reason`. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isSecurityLoggingEnabled(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Return whether security logging is enabled or not by the admin. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isStatusBarDisabled()()` Returns whether the status bar is disabled/enabled, see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStatusBarDisabled(android.content.ComponentName,%20kotlin.Boolean)`. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isUninstallBlocked(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Check whether the user has been blocked by device policy from uninstalling a package. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isUniqueDeviceAttestationSupported()()` Returns `true` if the StrongBox Keymaster implementation on the device was provisioned with an individual attestation certificate and can sign attestation records using it (as attestation using an individual attestation certificate is a feature only Keymaster implementations with StrongBox security level can implement). |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isUsbDataSignalingEnabled()()` Returns whether USB data signaling is currently enabled. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isUsingUnifiedPassword(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` When called by a profile owner of a managed profile returns true if the profile uses unified challenge with its parent user. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[UserHandle](https://developer.android.com/reference/kotlin/android/os/UserHandle.html#)!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#listForegroundAffiliatedUsers()()` Gets the list of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()` users running on foreground. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#lockNow()()` Make the device lock immediately, as if the lock screen timeout has expired at the point of this call. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#lockNow(kotlin.Int)(flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Make the device lock immediately, as if the lock screen timeout has expired at the point of this call. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#logoutUser(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by a profile owner of secondary user that is affiliated with the device to stop the calling user and switch back to primary user (when the user was `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#switchUser(android.content.ComponentName,%20android.os.UserHandle)` switched to) or stop the user (when it was `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#startUserInBackground(android.content.ComponentName,%20android.os.UserHandle)`. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#reboot(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by device owner or holders of the permission android. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#removeActiveAdmin(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Remove a current administration component. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#removeCrossProfileWidgetProvider(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Called by the profile owner of a managed profile or a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_PROFILE_INTERACTION:kotlin.String` to disable widget providers from a given package to be available in the parent profile. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#removeKeyPair(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` This API can be called by the following to remove a certificate and private key pair installed under a given alias: - Device owner - Profile owner - Delegated certificate installer - Credential management app <br /> |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#removeKeyPair(kotlin.String,%20kotlin.Int)(alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, scope: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` This API can be called by the following to remove a certificate and private key pair installed under a given alias, specifying whether it resides in user-specific or device-wide keychain: - Device owner - Profile owner - Delegated certificate installer - Credential management app (user-specific keychain only) <br /> |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#removeOverrideApn(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, apnId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by device owner or managed profile owner to remove an override APN. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#removeUser(android.content.ComponentName,%20android.os.UserHandle)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, userHandle: https://developer.android.com/reference/kotlin/android/os/UserHandle.html#)` Called by a device owner to remove a user/profile and all associated data. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#requestBugreport(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Called by a device owner to request a bugreport. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPassword(kotlin.String,%20kotlin.Int)(password: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!, flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Force a new password for device unlock (the password needed to access the entire device) or the work profile challenge on the current user. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPasswordWithToken(android.content.ComponentName,%20kotlin.String,%20kotlin.ByteArray,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, password: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!, token: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html!, flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by device or profile owner to force set a new device unlock password or a managed profile challenge on current user. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[NetworkEvent](https://developer.android.com/reference/kotlin/android/app/admin/NetworkEvent)!\>? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#retrieveNetworkLogs(android.content.ComponentName,%20kotlin.Long)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, batchToken: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Called by device owner, profile owner of a managed profile or delegated app with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_NETWORK_LOGGING:kotlin.String` to retrieve the most recent batch of network logging events. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[SecurityLog.SecurityEvent](https://developer.android.com/reference/kotlin/android/app/admin/SecurityLog.SecurityEvent)!\>? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#retrievePreRebootSecurityLogs(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Called by device owner or profile owner of an organization-owned managed profile to retrieve device logs from before the device's last reboot. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[SecurityLog.SecurityEvent](https://developer.android.com/reference/kotlin/android/app/admin/SecurityLog.SecurityEvent)!\>? | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#retrieveSecurityLogs(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Called by device owner or profile owner of an organization-owned managed profile to retrieve all new security logging entries since the last call to this API after device boots. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#revokeKeyPairFromApp(android.content.ComponentName,%20kotlin.String,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Called by a device or profile owner, or delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), to revoke an application's grant to a KeyChain key pair. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#revokeKeyPairFromApp(kotlin.String,%20kotlin.String,%20kotlin.Int)(alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, scope: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by a device or profile owner, delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), or permission caller, to revoke an application's grant to a KeyChain key pair for the specified scope. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#revokeKeyPairFromWifiAuth(kotlin.String)(alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Called by a device or profile owner, or delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), to deny using a KeyChain key pair for authentication to Wifi networks. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#revokeKeyPairFromWifiAuth(kotlin.String,%20kotlin.Int)(alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, scope: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by a device or profile owner, delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), or permission caller, to deny using a KeyChain key pair of the specified scope for authentication to Wifi networks. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAccountManagementDisabled(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, accountType: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!, disabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a device owner or profile owner to disable account management for a specific type of account. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, ids: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>)` Indicates the entity that controls the device. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAlwaysOnVpnPackage(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, vpnPackage: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?, lockdownEnabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a device or profile owner to configure an always-on VPN connection through a specific application for the current user. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAlwaysOnVpnPackage(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean,%20kotlin.collections.MutableSet)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, vpnPackage: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?, lockdownEnabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html, lockdownAllowlist: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>?)` A version of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAlwaysOnVpnPackage(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)` that allows the admin to specify a set of apps that should be able to access the network directly when VPN is not connected. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAppFunctionsPolicy(kotlin.Int)(policy: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Sets the `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionManager.html#` policy which controls app functions operations on the device. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setApplicationHidden(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!, hidden: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Hide or unhide packages. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setApplicationRestrictions(android.content.ComponentName,%20kotlin.String,%20android.os.Bundle)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!, settings: https://developer.android.com/reference/kotlin/android/os/Bundle.html#!)` Sets the application restrictions for a given target application running in the calling user. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setApplicationRestrictionsManagingPackage(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?)` Called by a profile owner or device owner to grant permission to a package to manage application restrictions for the calling user via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setApplicationRestrictions(android.content.ComponentName,%20kotlin.String,%20android.os.Bundle)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getApplicationRestrictions(android.content.ComponentName,%20kotlin.String)`. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAutoTimeEnabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, enabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a device owner, a profile owner for the primary user or a profile owner of an organization-owned managed profile to turn auto time on and off. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAutoTimePolicy(kotlin.Int)(policy: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by a device owner, a profile owner for the primary user or a profile owner of an organization-owned managed profile to turn auto time on and off i. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAutoTimeRequired(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, required: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a device owner, or alternatively a profile owner from Android 8. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAutoTimeZoneEnabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, enabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a device owner, a profile owner for the primary user or a profile owner of an organization-owned managed profile to turn auto time zone on and off. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAutoTimeZonePolicy(kotlin.Int)(policy: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by a device owner, a profile owner for the primary user or a profile owner of an organization-owned managed profile to turn auto time zone on and off. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setBackupServiceEnabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, enabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Allows the device owner or profile owner to enable or disable the backup service. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setBluetoothContactSharingDisabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, disabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a profile owner of a managed profile to set whether bluetooth devices can access enterprise contacts. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCameraDisabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, disabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by an application that is administering the device to disable all cameras on the device, for this user. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCertInstallerPackage(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, installerPackage: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?)` Called by a profile owner or device owner to grant access to privileged certificate manipulation APIs to a third-party certificate installer app. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCommonCriteriaModeEnabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, enabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by device owner or profile owner of an organization-owned managed profile to toggle Common Criteria mode for the device. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setConfiguredNetworksLockdownState(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, lockdown: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a device owner or a profile owner of an organization-owned managed profile to control whether the user can change networks configured by the admin. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setContentProtectionPolicy(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, policy: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Sets the content protection policy which controls scanning for deceptive apps. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCredentialManagerPolicy(android.app.admin.PackagePolicy)(policy: https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy?)` Called by a device owner or profile owner of a managed profile to set the credential manager policy. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCrossProfileCalendarPackages(android.content.ComponentName,%20kotlin.collections.MutableSet)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, packageNames: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>?)` Allows a set of packages to access cross-profile calendar APIs. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCrossProfileCallerIdDisabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, disabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a profile owner of a managed profile to set whether caller-Id information from the managed profile will be shown in the parent profile, for incoming calls. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCrossProfileContactsSearchDisabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, disabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a profile owner of a managed profile to set whether contacts search from the managed profile will be shown in the parent profile, for incoming calls. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCrossProfilePackages(android.content.ComponentName,%20kotlin.collections.MutableSet)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, packageNames: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>)` Sets the set of admin-allowlisted package names that are allowed to request user consent for cross-profile communication. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCrossProfileWidgetProviders(kotlin.collections.MutableSet)(packageNames: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>)` Called by the profile owner of a managed profile or a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_PROFILE_INTERACTION:kotlin.String` to enable widget providers from packages to be available in the parent profile. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDefaultDialerApplication(kotlin.String)(packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Must be called by a device owner or a profile owner of an organization-owned managed profile to set the default dialer application for the calling user. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDefaultSmsApplication(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Must be called by a device owner or a profile owner of an organization-owned managed profile to set the default SMS application. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, delegatePackage: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, scopes: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>)` Called by a profile owner or device owner to grant access to privileged APIs to another app. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDeviceOwnerLockScreenInfo(android.content.ComponentName,%20kotlin.CharSequence)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, info: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!)` Sets the device owner information to be shown on the lock screen. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setEndUserSessionMessage(android.content.ComponentName,%20kotlin.CharSequence)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, endUserSessionMessage: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html?)` Called by a device owner to specify the user session end message. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setFactoryResetProtectionPolicy(android.content.ComponentName,%20android.app.admin.FactoryResetProtectionPolicy)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, policy: https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy?)` Callable by device owner or profile owner of an organization-owned device, to set a factory reset protection (FRP) policy. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setGlobalPrivateDnsModeOpportunistic(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Sets the global Private DNS mode to opportunistic. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setGlobalPrivateDnsModeSpecifiedHost(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, privateDnsHost: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Sets the global Private DNS host to be used. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setGlobalSetting(android.content.ComponentName,%20kotlin.String,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, setting: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` This method is mostly deprecated. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setKeepUninstalledPackages(android.content.ComponentName,%20kotlin.collections.MutableList)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageNames: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>)` Set a list of apps to keep around as APKs even if no user has currently installed it. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setKeyPairCertificate(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, certs: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://developer.android.com/reference/kotlin/java/security/cert/Certificate.html#!>, isUserSelectable: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` This API can be called by the following to associate certificates with a key pair that was generated using #generateKeyPair, and set whether the key is available for the user to choose in the certificate selection prompt: - Device owner - Profile owner - Delegated certificate installer - Credential management app <br /> |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setKeyPairCertificate(kotlin.String,%20kotlin.collections.MutableList,%20kotlin.Boolean,%20kotlin.Int)(alias: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, certs: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://developer.android.com/reference/kotlin/java/security/cert/Certificate.html#!>, isUserSelectable: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html, scope: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Associates certificate chain with a specific scoped key. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setKeyguardDisabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, disabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a device owner or profile owner of secondary users that is affiliated with the device to disable the keyguard altogether. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setKeyguardDisabledFeatures(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, which: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by an application that is administering the device to disable keyguard customizations, such as widgets. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLocationEnabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, locationEnabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by device owners to set the user's global location setting. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Sets which system features are enabled when the device runs in lock task mode. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskPackages(android.content.ComponentName,%20kotlin.Array)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packages: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>)` Sets which packages may enter lock task mode. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLogoutEnabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, enabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a device owner to specify whether logout is enabled for all secondary users. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLongSupportMessage(android.content.ComponentName,%20kotlin.CharSequence)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, message: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html?)` Called by a device admin to set the long support message. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedProfileCallerIdAccessPolicy(android.app.admin.PackagePolicy)(policy: https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy?)` Called by a profile owner of a managed profile to set the packages that are allowed to lookup contacts in the managed profile based on caller id information. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedProfileContactsAccessPolicy(android.app.admin.PackagePolicy)(policy: https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy?)` Called by a profile owner of a managed profile to set the packages that are allowed access to the managed profile contacts from the parent user. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedProfileMaximumTimeOff(android.content.ComponentName,%20kotlin.Long)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, timeoutMillis: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Called by a profile owner of an organization-owned managed profile to set maximum time the profile is allowed to be turned off. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedSubscriptionsPolicy(android.app.admin.ManagedSubscriptionsPolicy)(policy: https://developer.android.com/reference/kotlin/android/app/admin/ManagedSubscriptionsPolicy?)` Called by a profile owner of an organization-owned device to specify `https://developer.android.com/reference/kotlin/android/app/admin/ManagedSubscriptionsPolicy` |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMasterVolumeMuted(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, on: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by profile or device owners to set the global volume mute on or off. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMaximumFailedPasswordsForWipe(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, num: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Setting this to a value greater than zero enables a policy that will perform a device or profile wipe after too many incorrect device-unlock passwords have been entered. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMaximumTimeToLock(android.content.ComponentName,%20kotlin.Long)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, timeMs: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Called by an application that is administering the device to set the maximum time for user activity until the device will lock. |
| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMeteredDataDisabledPackages(android.content.ComponentName,%20kotlin.collections.MutableList)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, packageNames: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>)` Called by a device or profile owner to restrict packages from using metered data. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)(level: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by device owner or profile owner of an organization-owned managed profile to specify the minimum security level required for Wi-Fi networks. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMtePolicy(kotlin.Int)(policy: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by a device owner, profile owner of an organization-owned device, to set the Memory Tagging Extension (MTE) policy. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setNearbyAppStreamingPolicy(kotlin.Int)(policy: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by a device/profile owner to set nearby app streaming policy. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setNearbyNotificationStreamingPolicy(kotlin.Int)(policy: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by a device/profile owner to set nearby notification streaming policy. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setNetworkLoggingEnabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, enabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a device owner, profile owner of a managed profile or delegated app with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_NETWORK_LOGGING:kotlin.String` to control the network logging feature. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setOrganizationColor(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, color: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by a profile owner of a managed profile to set the color used for customization. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setOrganizationId(kotlin.String)(enterpriseId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Sets the Enterprise ID for the work profile or managed device. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setOrganizationName(android.content.ComponentName,%20kotlin.CharSequence)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, title: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html?)` Called by the device owner (since API 26) or profile owner (since API 24) to set the name of the organization under management. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setOverrideApnsEnabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, enabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by device owner to set if override APNs should be enabled. |
| open [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\> | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPackagesSuspended(android.content.ComponentName,%20kotlin.Array,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageNames: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>, suspended: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by device or profile owners to suspend packages for this user. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordExpirationTimeout(android.content.ComponentName,%20kotlin.Long)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, timeout: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Called by a device admin to set the password expiration timeout. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordHistoryLength(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, length: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by an application that is administering the device to set the length of the password history. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumLength(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, length: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by an application that is administering the device to set the minimum allowed password length. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumLetters(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, length: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by an application that is administering the device to set the minimum number of letters required in the password. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumLowerCase(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, length: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by an application that is administering the device to set the minimum number of lower case letters required in the password. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumNonLetter(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, length: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by an application that is administering the device to set the minimum number of non-letter characters (numerical digits or symbols) required in the password. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumNumeric(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, length: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by an application that is administering the device to set the minimum number of numerical digits required in the password. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumSymbols(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, length: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by an application that is administering the device to set the minimum number of symbols required in the password. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumUpperCase(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, length: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by an application that is administering the device to set the minimum number of upper case letters required in the password. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, quality: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Called by an application that is administering the device to set the password restrictions it is imposing. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermissionGrantState(android.content.ComponentName,%20kotlin.String,%20kotlin.String,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, permission: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, grantState: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Sets the grant state of a runtime permission for a specific application. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermissionPolicy(android.content.ComponentName,%20kotlin.Int)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, policy: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set the default response for future runtime permission requests by applications. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermittedAccessibilityServices(android.content.ComponentName,%20kotlin.collections.MutableList)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, packageNames: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>!)` Called by a profile or device owner to set the permitted `https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.html#`. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermittedCrossProfileNotificationListeners(android.content.ComponentName,%20kotlin.collections.MutableList)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, packageList: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>?)` Called by a profile owner of a managed profile to set the packages that are allowed to use a `https://developer.android.com/reference/kotlin/android/service/notification/NotificationListenerService.html#` in the primary user to see notifications from the managed profile. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermittedInputMethods(android.content.ComponentName,%20kotlin.collections.MutableList)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageNames: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>!)` Called by a profile or device owner or holder of the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_INPUT_METHODS:kotlin.String` permission to set the permitted input methods services for this user. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPersonalAppsSuspended(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, suspended: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a profile owner of an organization-owned managed profile to suspend personal apps on the device. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPolicy(android.app.admin.PolicyIdentifier,%20kotlin.Int,%20android.app.admin.DevicePolicyManager.setPolicy.T)(id: https://developer.android.com/reference/kotlin/android/app/admin/PolicyIdentifier<T>, scope: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, value: T?)` Sets the given policy. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPreferentialNetworkServiceConfigs(kotlin.collections.MutableList)(preferentialNetworkServiceConfigs: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://developer.android.com/reference/kotlin/android/app/admin/PreferentialNetworkServiceConfig!>)` Sets preferential network configurations. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPreferentialNetworkServiceEnabled(kotlin.Boolean)(enabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Sets whether preferential network service is enabled. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setProfileEnabled(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)` Sets the enabled state of the profile. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setProfileName(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, profileName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Sets the name of the profile. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRecommendedGlobalProxy(android.content.ComponentName,%20android.net.ProxyInfo)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, proxyInfo: https://developer.android.com/reference/kotlin/android/net/ProxyInfo.html#?)` Set a network-independent global HTTP proxy. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)(passwordComplexity: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Sets a minimum password complexity requirement for the user's screen lock. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredStrongAuthTimeout(android.content.ComponentName,%20kotlin.Long)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, timeoutMs: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Called by a device/profile owner to set the timeout after which unlocking with secondary, non strong auth (e.g. fingerprint, face, trust agents) times out, i. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setResetPasswordToken(android.content.ComponentName,%20kotlin.ByteArray)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, token: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html!)` Called by a profile or device owner to provision a token which can later be used to reset the device lockscreen password (if called by device owner), or managed profile challenge (if called by profile owner), via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPasswordWithToken(android.content.ComponentName,%20kotlin.String,%20kotlin.ByteArray,%20kotlin.Int)`. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRestrictionsProvider(android.content.ComponentName,%20android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, provider: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Designates a specific service component as the provider for making permission requests of a local or remote administrator of the user. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setScreenCaptureDisabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, disabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a device/profile owner to set whether the screen capture is disabled. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setSecureSetting(android.content.ComponentName,%20kotlin.String,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, setting: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` This method is mostly deprecated. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setSecurityLoggingEnabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, enabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by device owner or a profile owner of an organization-owned managed profile to control the security logging feature. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setShortSupportMessage(android.content.ComponentName,%20kotlin.CharSequence)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, message: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html?)` Called by a device admin to set the short support message. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStartUserSessionMessage(android.content.ComponentName,%20kotlin.CharSequence)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, startUserSessionMessage: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html?)` Called by a device owner to specify the user session start message. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStatusBarDisabled(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, disabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by device owner or profile owner of secondary users that is affiliated with the device to disable the status bar. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStorageEncryption(android.content.ComponentName,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, encrypt: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` <br /> |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setSystemSetting(android.content.ComponentName,%20kotlin.String,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, setting: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Called by a device or profile owner to update `https://developer.android.com/reference/kotlin/android/provider/Settings.System.html#` settings. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setSystemUpdatePolicy(android.content.ComponentName,%20android.app.admin.SystemUpdatePolicy)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, policy: https://developer.android.com/reference/kotlin/android/app/admin/SystemUpdatePolicy!)` Called by device owners or profile owners of an organization-owned managed profile to set a local system update policy. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setTime(android.content.ComponentName,%20kotlin.Long)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, millis: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Called by a device owner or a profile owner of an organization-owned managed profile to set the system wall clock time. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setTimeZone(android.content.ComponentName,%20kotlin.String)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, timeZone: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Called by a device owner or a profile owner of an organization-owned managed profile to set the system's persistent default time zone. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setTrustAgentConfiguration(android.content.ComponentName,%20android.content.ComponentName,%20android.os.PersistableBundle)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, target: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, configuration: https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#!)` Sets a list of configuration features to enable for a trust agent component. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setUninstallBlocked(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!, uninstallBlocked: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Change whether a user can uninstall a package. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setUsbDataSignalingEnabled(kotlin.Boolean)(enabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Called by a device owner or profile owner of an organization-owned managed profile to enable or disable USB data signaling for the device. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setUserControlDisabledPackages(android.content.ComponentName,%20kotlin.collections.MutableList)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, packages: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>)` Called by a device owner or a profile owner or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_APPS_CONTROL:kotlin.String` to disable user control over apps. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setUserIcon(android.content.ComponentName,%20android.graphics.Bitmap)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, icon: https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#!)` Called by profile or device owners to set the user's photo. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setWifiSsidPolicy(android.app.admin.WifiSsidPolicy)(policy: https://developer.android.com/reference/kotlin/android/app/admin/WifiSsidPolicy?)` Called by device owner or profile owner of an organization-owned managed profile to specify the Wi-Fi SSID policy (`https://developer.android.com/reference/kotlin/android/app/admin/WifiSsidPolicy`). |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#startUserInBackground(android.content.ComponentName,%20android.os.UserHandle)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, userHandle: https://developer.android.com/reference/kotlin/android/os/UserHandle.html#)` Called by a device owner to start the specified secondary user in background. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#stopUser(android.content.ComponentName,%20android.os.UserHandle)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, userHandle: https://developer.android.com/reference/kotlin/android/os/UserHandle.html#)` Called by a device owner to stop the specified secondary user. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#switchUser(android.content.ComponentName,%20android.os.UserHandle)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, userHandle: https://developer.android.com/reference/kotlin/android/os/UserHandle.html#?)` Called by a device owner to switch the specified secondary user to the foreground. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#transferOwnership(android.content.ComponentName,%20android.content.ComponentName,%20android.os.PersistableBundle)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, target: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, bundle: https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#?)` Changes the current administrator to another one. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#uninstallAllUserCaCerts(android.content.ComponentName)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?)` Uninstalls all custom trusted CA certificates from the profile. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#uninstallCaCert(android.content.ComponentName,%20kotlin.ByteArray)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#?, certBuffer: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html!)` Uninstalls the given certificate from trusted user CAs, if present. |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#updateOverrideApn(android.content.ComponentName,%20kotlin.Int,%20android.telephony.data.ApnSetting)(admin: https://developer.android.com/reference/kotlin/android/content/ComponentName.html#, apnId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, apnSetting: https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#)` Called by device owner or managed profile owner to update an override APN. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int)(flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int,%20kotlin.CharSequence)` |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int,%20kotlin.CharSequence)(flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, reason: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)` Ask that all user data be wiped. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeDevice(kotlin.Int)(flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Ask that the device be wiped and factory reset. |

## Constants

### ACTION_ADD_DEVICE_ADMIN

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_ADD_DEVICE_ADMIN: String
```

Activity action: ask the user to add a new device administrator to the system. The desired policy is the ComponentName of the policy in the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_DEVICE_ADMIN:kotlin.String` extra field. This will invoke a UI to bring the user through adding the device administrator to the system (or allowing them to reject it).

You can optionally include the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_ADD_EXPLANATION:kotlin.String` field to provide the user with additional explanation (in addition to your component's description) about what is being added.

If your administrator is already active, this will ordinarily return immediately (without user intervention). However, if your administrator has been updated and is requesting additional uses-policy flags, the user will be presented with the new list. New policies will not be available to the updated administrator until the user has accepted the new list.

    Value: "android.app.action.ADD_DEVICE_ADMIN"

### ACTION_ADMIN_POLICY_COMPLIANCE

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_ADMIN_POLICY_COMPLIANCE: String
```

Activity action: Starts the administrator to show policy compliance for the provisioning. This action is used any time that the administrator has an opportunity to show policy compliance before the end of setup wizard. This could happen as part of the admin-integrated provisioning flow (in which case this gets sent after `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String`), or it could happen during provisioning finalization if the administrator supports finalization during setup wizard.

Intents with this action may also be supplied with the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE:kotlin.String` extra.

    Value: "android.app.action.ADMIN_POLICY_COMPLIANCE"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String`

### ACTION_APPLICATION_DELEGATION_SCOPES_CHANGED

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_APPLICATION_DELEGATION_SCOPES_CHANGED: String
```

Broadcast Action: Sent after application delegation scopes are changed. The new delegation scopes will be sent in an `ArrayList<String>` extra identified by the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_DELEGATION_SCOPES:kotlin.String` key.

**Note:** This is a protected intent that can only be sent by the system.

    Value: "android.app.action.APPLICATION_DELEGATION_SCOPES_CHANGED"

### ACTION_CHECK_POLICY_COMPLIANCE

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_CHECK_POLICY_COMPLIANCE: String
```

Activity action: launch the DPC to check policy compliance. This intent is launched when the user taps on the notification about personal apps suspension. When handling this intent the DPC must check if personal apps should still be suspended and either unsuspend them or instruct the user on how to resolve the noncompliance causing the suspension.

    Value: "android.app.action.CHECK_POLICY_COMPLIANCE"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPersonalAppsSuspended(android.content.ComponentName,%20kotlin.Boolean)`

### ACTION_DEVICE_ADMIN_SERVICE

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_DEVICE_ADMIN_SERVICE: String
```

Service action: Action for a service that device owner and profile owner can optionally own. If a device owner or a profile owner has such a service, the system tries to keep a bound connection to it, in order to keep their process always running. The service must be protected with the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#BIND_DEVICE_ADMIN:kotlin.String` permission.

    Value: "android.app.action.DEVICE_ADMIN_SERVICE"

### ACTION_DEVICE_FINANCING_STATE_CHANGED

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_DEVICE_FINANCING_STATE_CHANGED: String
```

Broadcast Action: Broadcast sent to indicate that the device financing state has changed.

This occurs when, for example, a financing kiosk app has been added or removed.

To query the current device financing state see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isDeviceFinanced()`.

This will be delivered to the following apps if they include a receiver for this action in their manifest:

- Device owner admins.
- Organization-owned profile owner admins
- The supervision app
- The device management role holder

    Value: "android.app.admin.action.DEVICE_FINANCING_STATE_CHANGED"

### ACTION_DEVICE_OWNER_CHANGED

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_DEVICE_OWNER_CHANGED: String
```

Broadcast action: sent when the device owner is set, changed or cleared. This broadcast is sent only to the primary user.

    Value: "android.app.action.DEVICE_OWNER_CHANGED"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_DEVICE:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#transferOwnership(android.content.ComponentName,%20android.content.ComponentName,%20android.os.PersistableBundle)`

### ACTION_DEVICE_POLICY_RESOURCE_UPDATED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_DEVICE_POLICY_RESOURCE_UPDATED: String
```

Broadcast action: notify system apps (e.g. settings, SysUI, etc) that the device management resources with IDs `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESOURCE_IDS:kotlin.String` has been updated, the updated resources can be retrieved using android.app.admin.DevicePolicyResourcesManager#getDrawable and android.app.admin.DevicePolicyResourcesManager#getString.

This broadcast is sent to registered receivers only.

`https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESOURCE_TYPE:kotlin.String` will be included to identify the type of resource being updated.

    Value: "android.app.action.DEVICE_POLICY_RESOURCE_UPDATED"

### ACTION_GET_PROVISIONING_MODE

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_GET_PROVISIONING_MODE: String
```

Activity action: Starts the administrator to get the mode for the provisioning. This intent may contain the following extras:

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_IMEI:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SERIAL_NUMBER:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ALLOWED_PROVISIONING_MODES:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SENSORS_PERMISSION_GRANT_OPT_OUT:kotlin.String`

<br />

The target activity should return one of the following values in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_MODE:kotlin.String` as result:

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PROVISIONING_MODE_FULLY_MANAGED_DEVICE:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PROVISIONING_MODE_MANAGED_PROFILE:kotlin.Int`

If performing fully-managed device provisioning and the admin app desires to show its own education screens, the target activity can additionally return `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS:kotlin.String` set to `true`.

The target activity may also return the account that needs to be migrated from primary user to managed profile in case of a profile owner provisioning in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE:kotlin.String` as result.

The target activity may also include the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE:kotlin.String` extra in the intent result. The values of this `https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#` will be sent as an intent extra of the same name to the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_ADMIN_POLICY_COMPLIANCE:kotlin.String` activity, along with the values of the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE:kotlin.String` extra that are already supplied to this activity.

Other extras the target activity may include in the intent result:

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DISCLAIMERS:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SKIP_ENCRYPTION:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_KEEP_SCREEN_ON:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION:kotlin.String` for work profile provisioning
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED:kotlin.String` for work profile provisioning
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SENSORS_PERMISSION_GRANT_OPT_OUT:kotlin.String` for fully-managed device provisioning
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_LOCALE:kotlin.String` for fully-managed device provisioning
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_LOCAL_TIME:kotlin.String` for fully-managed device provisioning
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_TIME_ZONE:kotlin.String` for fully-managed device provisioning

    Value: "android.app.action.GET_PROVISIONING_MODE"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_ADMIN_POLICY_COMPLIANCE:kotlin.String`

### ACTION_MANAGED_PROFILE_PROVISIONED

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_MANAGED_PROFILE_PROVISIONED: String
```

Broadcast Action: This broadcast is sent to indicate that provisioning of a managed profile has completed successfully.

The broadcast is limited to the primary profile, to the app specified in the provisioning intent with action `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE:kotlin.String`.

This intent will contain the following extras

- `https://developer.android.com/reference/kotlin/android/content/Intent.html#EXTRA_USER:kotlin.String`, corresponds to the `https://developer.android.com/reference/kotlin/android/os/UserHandle.html#` of the managed profile.
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE:kotlin.String`, corresponds to the account requested to be migrated at provisioning time, if any.

    Value: "android.app.action.MANAGED_PROFILE_PROVISIONED"

### ACTION_PROFILE_OWNER_CHANGED

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_PROFILE_OWNER_CHANGED: String
```

Broadcast action: sent when the profile owner is set, changed or cleared. This broadcast is sent only to the user managed by the new profile owner.

    Value: "android.app.action.PROFILE_OWNER_CHANGED"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#transferOwnership(android.content.ComponentName,%20android.content.ComponentName,%20android.os.PersistableBundle)`

### ACTION_PROVISIONING_SUCCESSFUL

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_PROVISIONING_SUCCESSFUL: String
```

Activity action: This activity action is sent to indicate that provisioning of a managed profile or managed device has completed successfully. It'll be sent at the same time as `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#ACTION_PROFILE_PROVISIONING_COMPLETE:kotlin.String` broadcast but this will be delivered faster as it's an activity intent.

The intent is only sent to the new device or profile owner.

    Value: "android.app.action.PROVISIONING_SUCCESSFUL"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_DEVICE:kotlin.String`

### ACTION_PROVISION_MANAGED_DEVICE

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_PROVISION_MANAGED_DEVICE: String
```

**Deprecated:** *to support `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int` and later, admin apps must implement activities with intent filters for the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_ADMIN_POLICY_COMPLIANCE:kotlin.String` intent actions; using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_DEVICE:kotlin.String` to start provisioning will cause the provisioning to fail; to additionally support pre-`https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int`, admin apps must also continue to use this constant.*

Activity action: Starts the provisioning flow which sets up a managed device. Must be started with `https://developer.android.com/reference/kotlin/android/app/Activity.html#startActivityForResult(android.content.Intent,%20kotlin.Int)`.

During device owner provisioning a device admin app is set as the owner of the device. A device owner has full control over the device. The device owner can not be modified by the user.

A typical use case would be a device that is owned by a company, but used by either an employee or client.

An intent with this action can be sent only on an unprovisioned device. It is possible to check if provisioning is allowed or not by querying the method `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isProvisioningAllowed(kotlin.String)`.

The intent contains the following extras:

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SKIP_ENCRYPTION:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_LOGO_URI:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DISCLAIMERS:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS:kotlin.String`, optional

When device owner provisioning has completed, an intent of the type `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#ACTION_PROFILE_PROVISIONING_COMPLETE:kotlin.String` is broadcast to the device owner.

From version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#O:kotlin.Int`, when device owner provisioning has completed, along with the above broadcast, activity intent `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISIONING_SUCCESSFUL:kotlin.String` will also be sent to the device owner.

If provisioning fails, the device is factory reset.

A result code of `https://developer.android.com/reference/kotlin/android/app/Activity.html#RESULT_OK:kotlin.Int` implies that the synchronous part of the provisioning flow was successful, although this doesn't guarantee the full flow will succeed. Conversely a result code of `https://developer.android.com/reference/kotlin/android/app/Activity.html#RESULT_CANCELED:kotlin.Int` implies that the user backed-out of provisioning, or some precondition for provisioning wasn't met.

    Value: "android.app.action.PROVISION_MANAGED_DEVICE"

### ACTION_PROVISION_MANAGED_PROFILE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_PROVISION_MANAGED_PROFILE: String
```

Activity action: Starts the provisioning flow which sets up a [managed profile](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#managed-profile).

It is possible to check if provisioning is allowed or not by querying the method `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isProvisioningAllowed(kotlin.String)`.

The intent may contain the following extras:

| Extra |   | Supported Versions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE:kotlin.String` |   ||
| `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SKIP_ENCRYPTION:kotlin.String` |   | `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int`+ |
| `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE:kotlin.String` |   ||
| `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_LOGO_URI:kotlin.String` |   ||
| `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SKIP_USER_CONSENT:kotlin.String` | **Can only be used by an existing device owner trying to create a managed profile** ||
| `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION:kotlin.String` |   ||
| `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DISCLAIMERS:kotlin.String` |   ||
| `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME:kotlin.String` | **Required if `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME:kotlin.String` is not specified. Must match the package name of the calling application.** | `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#LOLLIPOP:kotlin.Int`+ |
| `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME:kotlin.String` | **Required if `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME:kotlin.String` is not specified. Package name must match the package name of the calling application.** | `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int`+ |
| `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ALLOW_OFFLINE:kotlin.String` | On `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int`+, when set to true this will **force** offline provisioning instead of allowing it ||

When [managed provisioning](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#managedprovisioning) has completed, broadcasts are sent to the application specified in the provisioning intent. The `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#ACTION_PROFILE_PROVISIONING_COMPLETE:kotlin.String` broadcast is sent in the managed profile and the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_MANAGED_PROFILE_PROVISIONED:kotlin.String` broadcast is sent in the primary profile.

From version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#O:kotlin.Int`, when managed provisioning has completed, along with the above broadcast, activity intent `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISIONING_SUCCESSFUL:kotlin.String` will also be sent to the profile owner.

If provisioning fails, the managed profile is removed so the device returns to its previous state.

If launched with `https://developer.android.com/reference/kotlin/android/app/Activity.html#startActivityForResult(android.content.Intent,%20kotlin.Int)` a result code of `https://developer.android.com/reference/kotlin/android/app/Activity.html#RESULT_OK:kotlin.Int` indicates that the synchronous part of the provisioning flow was successful, although this doesn't guarantee the full flow will succeed. Conversely a result code of `https://developer.android.com/reference/kotlin/android/app/Activity.html#RESULT_CANCELED:kotlin.Int` indicates that the user backed-out of provisioning or some precondition for provisioning wasn't met.

If a [device policy management role holder](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#roleholder) updater is present on the device, an internet connection attempt must be made prior to launching this intent.

    Value: "android.app.action.PROVISION_MANAGED_PROFILE"

### ACTION_SET_NEW_PARENT_PROFILE_PASSWORD

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_SET_NEW_PARENT_PROFILE_PASSWORD: String
```

Activity action: have the user enter a new password for the parent profile. If the intent is launched from within a managed profile, this will trigger entering a new password for the parent of the profile. The caller can optionally set `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_DEVICE_PASSWORD_REQUIREMENT_ONLY:kotlin.String` to only enforce device-wide password requirement. In all other cases the behaviour is identical to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PASSWORD:kotlin.String`.

    Value: "android.app.action.SET_NEW_PARENT_PROFILE_PASSWORD"

### ACTION_SET_NEW_PASSWORD

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_SET_NEW_PASSWORD: String
```

Activity action: have the user enter a new password.

For admin apps, this activity should be launched after using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`, or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumLength(android.content.ComponentName,%20kotlin.Int)` to have the user enter a new password that meets the current requirements. You can use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isActivePasswordSufficient()` to determine whether you need to have the user select a new password in order to meet the current constraints. Upon being resumed from this activity, you can check the new password characteristics to see if they are sufficient.

Non-admin apps can use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()` to check the current screen lock complexity, and use this activity with extra `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PASSWORD_COMPLEXITY:kotlin.String` to suggest to users how complex the app wants the new screen lock to be. Note that both `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()` and the extra `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PASSWORD_COMPLEXITY:kotlin.String` require the calling app to have the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#REQUEST_PASSWORD_COMPLEXITY:kotlin.String`.

If the intent is launched from within a managed profile with a profile owner built against `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int` or before, this will trigger entering a new password for the parent of the profile. For all other cases it will trigger entering a new password for the user or profile it is launched from.

    Value: "android.app.action.SET_NEW_PASSWORD"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD:kotlin.String`

### ACTION_START_ENCRYPTION

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_START_ENCRYPTION: String
```

Activity action: begin the process of encrypting data on the device. This activity should be launched after using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStorageEncryption(android.content.ComponentName,%20kotlin.Boolean)` to request encryption be activated. After resuming from this activity, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryption(android.content.ComponentName)` to check encryption status. However, on some devices this activity may never return, as it may trigger a reboot and in some cases a complete data wipe of the device.

    Value: "android.app.action.START_ENCRYPTION"

### ACTION_SYSTEM_UPDATE_POLICY_CHANGED

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ACTION_SYSTEM_UPDATE_POLICY_CHANGED: String
```

Broadcast action: notify that a new local system update policy has been set by the device owner. The new policy can be retrieved by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getSystemUpdatePolicy()`.

    Value: "android.app.action.SYSTEM_UPDATE_POLICY_CHANGED"

### APP_FUNCTIONS_DISABLED

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val APP_FUNCTIONS_DISABLED: Int
```

Indicates that `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionManager.html#` is controlled and disabled by policy, i.e. no apps in the current user are allowed to expose app functions.

    Value: 1

### APP_FUNCTIONS_DISABLED_CROSS_PROFILE

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val APP_FUNCTIONS_DISABLED_CROSS_PROFILE: Int
```

Indicates that `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionManager.html#` is controlled and disabled by a policy for cross profile interactions only, i.e. app functions exposed by apps in the current user can only be invoked within the same user.

This is different from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#APP_FUNCTIONS_DISABLED:kotlin.Int` in that it only disables cross profile interactions (even if the caller has permissions required to interact across users). appfunctions can still be used within the a user profile boundary.

    Value: 2

### APP_FUNCTIONS_NOT_CONTROLLED_BY_POLICY

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val APP_FUNCTIONS_NOT_CONTROLLED_BY_POLICY: Int
```

Indicates that `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionManager.html#` is not controlled by policy.

If no admin set this policy, it means appfunctions are enabled.

    Value: 0

### AUTO_TIME_DISABLED

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val AUTO_TIME_DISABLED: Int
```

Specifies the "disabled" auto time state.

    Value: 1

**See Also**

### AUTO_TIME_ENABLED

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val AUTO_TIME_ENABLED: Int
```

Specifies the "enabled" auto time state.

    Value: 2

**See Also**

### AUTO_TIME_NOT_CONTROLLED_BY_POLICY

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val AUTO_TIME_NOT_CONTROLLED_BY_POLICY: Int
```

Specifies that the auto time state is not controlled by device policy.

    Value: 0

**See Also**

### AUTO_TIME_ZONE_DISABLED

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val AUTO_TIME_ZONE_DISABLED: Int
```

Specifies the "disabled" auto time zone state.

    Value: 1

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAutoTimeZonePolicy(kotlin.Int)`

### AUTO_TIME_ZONE_ENABLED

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val AUTO_TIME_ZONE_ENABLED: Int
```

Specifies the "enabled" auto time zone state.

    Value: 2

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAutoTimeZonePolicy(kotlin.Int)`

### AUTO_TIME_ZONE_NOT_CONTROLLED_BY_POLICY

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val AUTO_TIME_ZONE_NOT_CONTROLLED_BY_POLICY: Int
```

Specifies that the auto time zone state is not controlled by device policy.

    Value: 0

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAutoTimeZonePolicy(kotlin.Int)`

### CONTENT_PROTECTION_DISABLED

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_PROTECTION_DISABLED: Int
```

Indicates that content protection is controlled and disabled by a policy (default).

    Value: 1

### CONTENT_PROTECTION_ENABLED

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_PROTECTION_ENABLED: Int
```

Indicates that content protection is controlled and enabled by a policy.

    Value: 2

### CONTENT_PROTECTION_NOT_CONTROLLED_BY_POLICY

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_PROTECTION_NOT_CONTROLLED_BY_POLICY: Int
```

Indicates that content protection is not controlled by policy, allowing user to choose.

    Value: 0

### DELEGATION_APP_RESTRICTIONS

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val DELEGATION_APP_RESTRICTIONS: String
```

Delegation of application restrictions management. This scope grants access to the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setApplicationRestrictions(android.content.ComponentName,%20kotlin.String,%20android.os.Bundle)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getApplicationRestrictions(android.content.ComponentName,%20kotlin.String)` APIs.

    Value: "delegation-app-restrictions"

### DELEGATION_BLOCK_UNINSTALL

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val DELEGATION_BLOCK_UNINSTALL: String
```

Delegation of application uninstall block. This scope grants access to the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setUninstallBlocked(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)` API.

    Value: "delegation-block-uninstall"

### DELEGATION_CERT_INSTALL

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val DELEGATION_CERT_INSTALL: String
```

Delegation of certificate installation and management. This scope grants access to the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getInstalledCaCerts(android.content.ComponentName)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#hasCaCertInstalled(android.content.ComponentName,%20kotlin.ByteArray)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installCaCert(android.content.ComponentName,%20kotlin.ByteArray)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#uninstallCaCert(android.content.ComponentName,%20kotlin.ByteArray)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#uninstallAllUserCaCerts(android.content.ComponentName)` and #installKeyPair APIs. This scope also grants the ability to read identifiers that the delegating device owner or profile owner can obtain. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getEnrollmentSpecificId()`.

    Value: "delegation-cert-install"

### DELEGATION_CERT_SELECTION

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val DELEGATION_CERT_SELECTION: String
```

Grants access to selection of KeyChain certificates on behalf of requesting apps. Once granted the app will start receiving `https://developer.android.com/reference/kotlin/android/app/admin/DelegatedAdminReceiver#onChoosePrivateKeyAlias(android.content.Context,%20android.content.Intent,%20kotlin.Int,%20android.net.Uri,%20kotlin.String)`. The caller (PO/DO) will no longer receive `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onChoosePrivateKeyAlias(android.content.Context,%20android.content.Intent,%20kotlin.Int,%20android.net.Uri,%20kotlin.String)`. There can be at most one app that has this delegation. If another app already had delegated certificate selection access, it will lose the delegation when a new app is delegated.

The delegated app can also call #grantKeyPairToApp and #revokeKeyPairFromApp to directly grant KeyChain keys to other apps.

Can be granted by Device Owner or Profile Owner.

    Value: "delegation-cert-selection"

### DELEGATION_ENABLE_SYSTEM_APP

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val DELEGATION_ENABLE_SYSTEM_APP: String
```

Delegation for enabling system apps. This scope grants access to the #enableSystemApp API.

    Value: "delegation-enable-system-app"

### DELEGATION_INSTALL_EXISTING_PACKAGE

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val DELEGATION_INSTALL_EXISTING_PACKAGE: String
```

Delegation for installing existing packages. This scope grants access to the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installExistingPackage(android.content.ComponentName,%20kotlin.String)` API.

    Value: "delegation-install-existing-package"

### DELEGATION_KEEP_UNINSTALLED_PACKAGES

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val DELEGATION_KEEP_UNINSTALLED_PACKAGES: String
```

Delegation of management of uninstalled packages. This scope grants access to the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setKeepUninstalledPackages(android.content.ComponentName,%20kotlin.collections.MutableList)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getKeepUninstalledPackages(android.content.ComponentName)` APIs.

    Value: "delegation-keep-uninstalled-packages"

### DELEGATION_NETWORK_LOGGING

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val DELEGATION_NETWORK_LOGGING: String
```

Grants access to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setNetworkLoggingEnabled(android.content.ComponentName,%20kotlin.Boolean)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isNetworkLoggingEnabled(android.content.ComponentName)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#retrieveNetworkLogs(android.content.ComponentName,%20kotlin.Long)`. Once granted the delegated app will start receiving DelegatedAdminReceiver.onNetworkLogsAvailable() callback, and Device owner or Profile Owner will no longer receive the DeviceAdminReceiver.onNetworkLogsAvailable() callback. There can be at most one app that has this delegation. If another app already had delegated network logging access, it will lose the delegation when a new app is delegated.

Device Owner can grant this access since Android 10. Profile Owner of a managed profile can grant this access since Android 12.

    Value: "delegation-network-logging"

### DELEGATION_PACKAGE_ACCESS

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val DELEGATION_PACKAGE_ACCESS: String
```

Delegation of package access state. This scope grants access to the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isApplicationHidden(android.content.ComponentName,%20kotlin.String)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setApplicationHidden(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isPackageSuspended(android.content.ComponentName,%20kotlin.String)`, and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPackagesSuspended(android.content.ComponentName,%20kotlin.Array,%20kotlin.Boolean)` APIs.

    Value: "delegation-package-access"

### DELEGATION_PERMISSION_GRANT

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val DELEGATION_PERMISSION_GRANT: String
```

Delegation of permission policy and permission grant state. This scope grants access to the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermissionPolicy(android.content.ComponentName,%20kotlin.Int)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPermissionGrantState(android.content.ComponentName,%20kotlin.String,%20kotlin.String)`, and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermissionGrantState(android.content.ComponentName,%20kotlin.String,%20kotlin.String,%20kotlin.Int)` APIs.

    Value: "delegation-permission-grant"

### DELEGATION_SECURITY_LOGGING

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val DELEGATION_SECURITY_LOGGING: String
```

Grants access to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setSecurityLoggingEnabled(android.content.ComponentName,%20kotlin.Boolean)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isSecurityLoggingEnabled(android.content.ComponentName)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#retrieveSecurityLogs(android.content.ComponentName)`, and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#retrievePreRebootSecurityLogs(android.content.ComponentName)`. Once granted the delegated app will start receiving `https://developer.android.com/reference/kotlin/android/app/admin/DelegatedAdminReceiver#onSecurityLogsAvailable(android.content.Context,%20android.content.Intent)` callback, and Device owner or Profile Owner will no longer receive the `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onSecurityLogsAvailable(android.content.Context,%20android.content.Intent)` callback. There can be at most one app that has this delegation. If another app already had delegated security logging access, it will lose the delegation when a new app is delegated.

Can only be granted by Device Owner or Profile Owner of an organization-owned managed profile.

    Value: "delegation-security-logging"

### ENCRYPTION_STATUS_ACTIVATING

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ENCRYPTION_STATUS_ACTIVATING: Int
```

**Deprecated:** *This result code has never actually been used, so there is no reason for apps to check for it.*

Result code for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()`: indicating that encryption is not currently active, but is currently being activated.

<br />

    Value: 2

### ENCRYPTION_STATUS_ACTIVE

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ENCRYPTION_STATUS_ACTIVE: Int
```

Result code for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStorageEncryption(android.content.ComponentName,%20kotlin.Boolean)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()`: indicating that encryption is active.

`https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()` can only return this value for apps targeting API level 23 or lower, or on devices that use Full Disk Encryption. Support for Full Disk Encryption was entirely removed in API level 33, having been replaced by File Based Encryption. The result code `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE_PER_USER:kotlin.Int` is used on devices that use File Based Encryption, except when the app targets API level 23 or lower.

`https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStorageEncryption(android.content.ComponentName,%20kotlin.Boolean)` can still return this value for an unrelated reason, but `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStorageEncryption(android.content.ComponentName,%20kotlin.Boolean)` is deprecated since it doesn't do anything useful.

    Value: 3

### ENCRYPTION_STATUS_ACTIVE_DEFAULT_KEY

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ENCRYPTION_STATUS_ACTIVE_DEFAULT_KEY: Int
```

Result code for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()`: indicating that encryption is active, but the encryption key is not cryptographically protected by the user's credentials.

This value can only be returned on devices that use Full Disk Encryption. Support for Full Disk Encryption was entirely removed in API level 33, having been replaced by File Based Encryption. With File Based Encryption, each user's credential-encrypted storage is always cryptographically protected by the user's credentials.

    Value: 4

### ENCRYPTION_STATUS_ACTIVE_PER_USER

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ENCRYPTION_STATUS_ACTIVE_PER_USER: Int
```

Result code for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()`: indicating that encryption is active and the encryption key is tied to the user or profile.

This value is only returned to apps targeting API level 24 and above. For apps targeting earlier API levels, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE:kotlin.Int` is returned, even if the encryption key is specific to the user or profile.

    Value: 5

### ENCRYPTION_STATUS_INACTIVE

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ENCRYPTION_STATUS_INACTIVE: Int
```

Result code for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStorageEncryption(android.content.ComponentName,%20kotlin.Boolean)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()`: indicating that encryption is supported, but is not currently active.

`https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()` can only return this value on devices that use Full Disk Encryption. Support for Full Disk Encryption was entirely removed in API level 33, having been replaced by File Based Encryption. Devices that use File Based Encryption always automatically activate their encryption on first boot.

`https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStorageEncryption(android.content.ComponentName,%20kotlin.Boolean)` can still return this value for an unrelated reason, but `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStorageEncryption(android.content.ComponentName,%20kotlin.Boolean)` is deprecated since it doesn't do anything useful.

    Value: 1

### ENCRYPTION_STATUS_UNSUPPORTED

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ENCRYPTION_STATUS_UNSUPPORTED: Int
```

Result code for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStorageEncryption(android.content.ComponentName,%20kotlin.Boolean)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()`: indicating that encryption is not supported.

    Value: 0

### EXTRA_ADD_EXPLANATION

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_ADD_EXPLANATION: String
```

An optional CharSequence providing additional explanation for why the admin is being added.

    Value: "android.app.extra.ADD_EXPLANATION"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_ADD_DEVICE_ADMIN:kotlin.String`

### EXTRA_DELEGATION_SCOPES

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_DELEGATION_SCOPES: String
```

An `ArrayList<String>` corresponding to the delegation scopes given to an app in the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_APPLICATION_DELEGATION_SCOPES_CHANGED:kotlin.String` broadcast.

    Value: "android.app.extra.DELEGATION_SCOPES"

### EXTRA_DEVICE_ADMIN

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_DEVICE_ADMIN: String
```

The ComponentName of the administrator component.

    Value: "android.app.extra.DEVICE_ADMIN"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_ADD_DEVICE_ADMIN:kotlin.String`

### EXTRA_DEVICE_PASSWORD_REQUIREMENT_ONLY

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_DEVICE_PASSWORD_REQUIREMENT_ONLY: String
```

A boolean extra for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD:kotlin.String` requesting that only device password requirement is enforced during the parent profile password enrolment flow.

Normally when enrolling password for the parent profile, both the device-wide password requirement (requirement set via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` instance) and the profile password requirement are enforced, if the profile currently does not have a separate work challenge. By setting this to `true`, profile password requirement is explicitly disregarded.

    Value: "android.app.extra.DEVICE_PASSWORD_REQUIREMENT_ONLY"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isActivePasswordSufficientForDeviceRequirement()`

### EXTRA_PASSWORD_COMPLEXITY

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PASSWORD_COMPLEXITY: String
```

An integer indicating the complexity level of the new password an app would like the user to set when launching the action `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PASSWORD:kotlin.String`.

Must be one of

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_HIGH:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_MEDIUM:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_LOW:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_NONE:kotlin.Int`

If an invalid value is used, it will be treated as `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_NONE:kotlin.Int`.   
Requires `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#REQUEST_PASSWORD_COMPLEXITY:kotlin.String`

    Value: "android.app.extra.PASSWORD_COMPLEXITY"

### EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE

Added in [API level 22](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE: String
```

An `https://developer.android.com/reference/kotlin/android/accounts/Account.html#` extra holding the account to migrate during managed profile provisioning.

If the account supplied is present in the user, it will be copied, along with its credentials to the managed profile and removed from the user.

    Value: "android.app.extra.PROVISIONING_ACCOUNT_TO_MIGRATE"

### EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE: String
```

A `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#` extra of type `https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#` that is passed directly to the [Device Policy Controller](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#devicepolicycontroller) after [provisioning](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#managed-provisioning).

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int`, if used with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` as part of NFC managed device provisioning, the NFC message should contain a stringified `https://developer.android.com/reference/kotlin/java/util/Properties.html#` instance, whose string properties will be converted into a `https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#` and passed to the management application after provisioning.

    Value: "android.app.extra.PROVISIONING_ADMIN_EXTRAS_BUNDLE"

### EXTRA_PROVISIONING_ALLOWED_PROVISIONING_MODES

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_ALLOWED_PROVISIONING_MODES: String
```

An `https://developer.android.com/reference/kotlin/java/util/ArrayList.html#` of `https://developer.android.com/reference/kotlin/java/lang/Integer.html#` extra specifying the allowed provisioning modes.

This extra will be passed to the admin app's `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String` activity, whose result intent must contain `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_MODE:kotlin.String` set to one of the values in this array.

If the value set to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_MODE:kotlin.String` is not in the array, provisioning will fail.

    Value: "android.app.extra.PROVISIONING_ALLOWED_PROVISIONING_MODES"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PROVISIONING_MODE_MANAGED_PROFILE:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PROVISIONING_MODE_FULLY_MANAGED_DEVICE:kotlin.Int`

### EXTRA_PROVISIONING_ALLOW_OFFLINE

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_ALLOW_OFFLINE: String
```

A boolean extra indicating whether offline provisioning should be used.

The default value is `false`.

    Value: "android.app.extra.PROVISIONING_ALLOW_OFFLINE"

### EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME: String
```

A ComponentName extra indicating the `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` of the application that will be set as the [Device Policy Controller](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#devicepolicycontroller).

If an application starts provisioning directly via an intent with action `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_DEVICE:kotlin.String` the package name of this component has to match the package name of the application that started provisioning.

This component is set as device owner and active admin when device owner provisioning is started by an intent with action `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_DEVICE:kotlin.String` or by an NFC message containing an NFC record with MIME type `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String`. For the NFC record, the component name must be flattened to a string, via `https://developer.android.com/reference/kotlin/android/content/ComponentName.html#flattenToShortString()`.

    Value: "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME"

### EXTRA_PROVISIONING_DEVICE_ADMIN_MINIMUM_VERSION_CODE

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_DEVICE_ADMIN_MINIMUM_VERSION_CODE: String
```

An int extra holding a minimum required version code for the device admin package. If the device admin is already installed on the device, it will only be re-downloaded from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION:kotlin.String` if the version of the installed package is less than this version code.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_DEVICE_ADMIN_MINIMUM_VERSION_CODE"

### EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM: String
```

A String extra holding the URL-safe base64 encoded SHA-256 hash of the file at download location specified in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION:kotlin.String`.

Either this extra or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM:kotlin.String` must be present. The provided checksum must match the checksum of the file at the download location. If the checksum doesn't match an error will be shown to the user and the user will be asked to factory reset the device.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

**Note:** for devices running `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#LOLLIPOP:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#LOLLIPOP_MR1:kotlin.Int` only SHA-1 hash is supported. Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int`, this parameter accepts SHA-256 in addition to SHA-1. From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int`, only SHA-256 hash is supported.

    Value: "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM"

### EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER: String
```

A String extra holding a http cookie header which should be used in the http request to the url specified in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION:kotlin.String`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER"

### EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION: String
```

A String extra holding a url that specifies the download location of the device admin package. When not provided it is assumed that the device admin package is already installed.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION"

### EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME: String
```

**Deprecated:** *Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME:kotlin.String`.*

A String extra holding the package name of the application that will be set as [Device Policy Controller](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#devicepolicycontroller).

When this extra is set, the application must have exactly one `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver`. This receiver will be set as the [Device Policy Controller](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#devicepolicycontroller).

    Value: "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME"

### EXTRA_PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM: String
```

A String extra holding the URL-safe base64 encoded SHA-256 checksum of any signature of the android package archive at the download location specified in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION:kotlin.String`.

The signatures of an android package archive can be obtained using android.content.pm.PackageManager#getPackageArchiveInfo with flag `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#GET_SIGNATURES:kotlin.Int`.

Either this extra or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM:kotlin.String` must be present. The provided checksum must match the checksum of any signature of the file at the download location. If the checksum does not match an error will be shown to the user and the user will be asked to factory reset the device.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM"

### EXTRA_PROVISIONING_DISCLAIMERS

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_DISCLAIMERS: String
```

A `https://developer.android.com/reference/kotlin/android/os/Bundle.html#`\[\] extra consisting of list of disclaimer headers and disclaimer contents.

Each `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` must have both `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DISCLAIMER_HEADER:kotlin.String` as disclaimer header, and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DISCLAIMER_CONTENT:kotlin.String` as disclaimer content.

The extra typically contains one disclaimer from the company of mobile device management application (MDM), and one disclaimer from the organization.

Call `https://developer.android.com/reference/kotlin/android/os/Bundle.html#putParcelableArray(kotlin.String,%20kotlin.Array)` to put the `https://developer.android.com/reference/kotlin/android/os/Bundle.html#`\[\]

Maximum 3 key-value pairs can be specified. The rest will be ignored.

Can be used in an intent with action `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE:kotlin.String`. This extra can also be returned by the admin app when performing the admin-integrated provisioning flow as a result of the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String` activity.

    Value: "android.app.extra.PROVISIONING_DISCLAIMERS"

### EXTRA_PROVISIONING_DISCLAIMER_CONTENT

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_DISCLAIMER_CONTENT: String
```

A `https://developer.android.com/reference/kotlin/android/net/Uri.html#` extra pointing to disclaimer content.

##### The following URI schemes are accepted:

- content (`https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#SCHEME_CONTENT:kotlin.String`)
- android.resource (`https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#SCHEME_ANDROID_RESOURCE:kotlin.String`)

<br />

Styled text is supported. This is parsed by `https://developer.android.com/reference/kotlin/android/text/Html.html#fromHtml(kotlin.String)` and displayed in a `https://developer.android.com/reference/kotlin/android/widget/TextView.html#`.

If a `content:` URI is passed, the intent should also have the flag `https://developer.android.com/reference/kotlin/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMISSION:kotlin.Int` and the uri should be added to the `https://developer.android.com/reference/kotlin/android/content/ClipData.html#` of the intent.

`https://developer.android.com/reference/kotlin/android/content/pm/ApplicationInfo.html#FLAG_SYSTEM:kotlin.Int` can also insert a disclaimer by declaring an application-level meta-data in `AndroidManifest.xml`.

For example:

```kotlin
<meta-data
       android:name="android.app.extra.PROVISIONING_DISCLAIMER_CONTENT"
       android:resource="@string/disclaimer_content"
  />
```

This must be accompanied with another extra using the key `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DISCLAIMER_HEADER:kotlin.String`.

    Value: "android.app.extra.PROVISIONING_DISCLAIMER_CONTENT"

### EXTRA_PROVISIONING_DISCLAIMER_HEADER

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_DISCLAIMER_HEADER: String
```

A String extra of localized disclaimer header.

The extra is typically the company name of mobile device management application (MDM) or the organization name.

`https://developer.android.com/reference/kotlin/android/content/pm/ApplicationInfo.html#FLAG_SYSTEM:kotlin.Int` can also insert a disclaimer by declaring an application-level meta-data in `AndroidManifest.xml`.

For example:

```kotlin
<meta-data
       android:name="android.app.extra.PROVISIONING_DISCLAIMER_HEADER"
       android:resource="@string/disclaimer_header"
  />
```

This must be accompanied with another extra using the key `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DISCLAIMER_CONTENT:kotlin.String`.

    Value: "android.app.extra.PROVISIONING_DISCLAIMER_HEADER"

### EXTRA_PROVISIONING_EMAIL_ADDRESS

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_EMAIL_ADDRESS: String
```

**Deprecated:** *From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#O:kotlin.Int`, never used while provisioning the device.*

    Value: "android.app.extra.PROVISIONING_EMAIL_ADDRESS"

### EXTRA_PROVISIONING_IMEI

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_IMEI: String
```

A string extra holding the IMEI (International Mobile Equipment Identity) of the device.

    Value: "android.app.extra.PROVISIONING_IMEI"

### EXTRA_PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION: String
```

Boolean extra to indicate that the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE:kotlin.String` should be kept.

If it's set to `true`, the account will not be removed from the user after it is migrated to the newly created user or profile.

Defaults to `false`

    Value: "android.app.extra.PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE:kotlin.String`

### EXTRA_PROVISIONING_KEEP_SCREEN_ON

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_KEEP_SCREEN_ON: String
```

**Deprecated:** *from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, the flag wouldn't be functional. The screen is kept on throughout the provisioning flow.*

A `boolean` flag that indicates whether the screen should be on throughout the provisioning flow.

This extra can either be passed as an extra to the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE:kotlin.String` intent, or it can be returned by the admin app when performing the admin-integrated provisioning flow as a result of the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String` activity.

    Value: "android.app.extra.PROVISIONING_KEEP_SCREEN_ON"

### EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED

Added in [API level 22](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED: String
```

A Boolean extra that can be used by the mobile device management application to skip the disabling of system apps during provisioning when set to `true`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String`, an intent with action `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE:kotlin.String` that starts profile owner provisioning or set as an extra to the intent result of the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String` activity.

    Value: "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED"

### EXTRA_PROVISIONING_LOCALE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_LOCALE: String
```

A String extra holding the `https://developer.android.com/reference/kotlin/java/util/Locale.html#` that the device will be set to. Format: xx_yy, where xx is the language code, and yy the country code.

Use only for device owner provisioning. This extra can be returned by the admin app when performing the admin-integrated provisioning flow as a result of the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String` activity.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_LOCALE"

### EXTRA_PROVISIONING_LOCAL_TIME

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_LOCAL_TIME: String
```

A Long extra holding the wall clock time (in milliseconds) to be set on the device's `https://developer.android.com/reference/kotlin/android/app/AlarmManager.html#`.

Use only for device owner provisioning. This extra can be returned by the admin app when performing the admin-integrated provisioning flow as a result of the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String` activity.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_LOCAL_TIME"

### EXTRA_PROVISIONING_LOGO_URI

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_LOGO_URI: String
```

**Deprecated:** *Logo customization is no longer supported in the [provisioning flow](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#managedprovisioning).*

A `https://developer.android.com/reference/kotlin/android/net/Uri.html#` extra pointing to a logo image. This image will be shown during the provisioning. If this extra is not passed, a default image will be shown.

**The following URI schemes are accepted:**

- content (`https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#SCHEME_CONTENT:kotlin.String`)
- android.resource (`https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#SCHEME_ANDROID_RESOURCE:kotlin.String`)

It is the responsibility of the caller to provide an image with a reasonable pixel density for the device.

If a content: URI is passed, the intent should also have the flag `https://developer.android.com/reference/kotlin/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMISSION:kotlin.Int` and the uri should be added to the `https://developer.android.com/reference/kotlin/android/content/ClipData.html#` of the intent.

    Value: "android.app.extra.PROVISIONING_LOGO_URI"

### EXTRA_PROVISIONING_MAIN_COLOR

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_MAIN_COLOR: String
```

**Deprecated:** *Color customization is no longer supported in the provisioning flow.*

A integer extra indicating the predominant color to show during the provisioning. Refer to `https://developer.android.com/reference/kotlin/android/graphics/Color.html#` for how the color is represented.

Use with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE:kotlin.String` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_DEVICE:kotlin.String`.

    Value: "android.app.extra.PROVISIONING_MAIN_COLOR"

### EXTRA_PROVISIONING_MODE

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_MODE: String
```

An intent extra holding the provisioning mode returned by the administrator. The value of this extra must be one of the values provided in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ALLOWED_PROVISIONING_MODES:kotlin.String`, which is provided as an intent extra to the admin app's `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String` activity.

    Value: "android.app.extra.PROVISIONING_MODE"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PROVISIONING_MODE_FULLY_MANAGED_DEVICE:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PROVISIONING_MODE_MANAGED_PROFILE:kotlin.Int`

### EXTRA_PROVISIONING_SENSORS_PERMISSION_GRANT_OPT_OUT

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_SENSORS_PERMISSION_GRANT_OPT_OUT: String
```

A boolean extra indicating the admin of a fully-managed device opts out of controlling permission grants for sensor-related permissions, see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermissionGrantState(android.content.ComponentName,%20kotlin.String,%20kotlin.String,%20kotlin.Int)`. The default for this extra is `false` - by default, the admin of a fully-managed device has the ability to grant sensors-related permissions.

Use only for device owner provisioning. This extra can be returned by the admin app when performing the admin-integrated provisioning flow as a result of the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String` activity.

This extra may also be provided to the admin app via an intent extra for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String`.

    Value: "android.app.extra.PROVISIONING_SENSORS_PERMISSION_GRANT_OPT_OUT"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String`

### EXTRA_PROVISIONING_SERIAL_NUMBER

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_SERIAL_NUMBER: String
```

A string extra holding the serial number of the device.

    Value: "android.app.extra.PROVISIONING_SERIAL_NUMBER"

### EXTRA_PROVISIONING_SHOULD_LAUNCH_RESULT_INTENT

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_SHOULD_LAUNCH_RESULT_INTENT: String
```

A boolean extra that determines whether the provisioning flow should launch the resulting launch intent, if one is supplied by the device policy management role holder via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESULT_LAUNCH_INTENT:kotlin.String`. Default value is `false`.

If `true`, the resulting intent will be launched by the provisioning flow, if one is supplied by the device policy management role holder.

If `false`, the resulting intent will be returned as `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESULT_LAUNCH_INTENT:kotlin.String` to the provisioning initiator, if one is supplied by the device manager role holder. It will be the responsibility of the provisioning initiator to launch this `https://developer.android.com/reference/kotlin/android/content/Intent.html#` after provisioning completes.

This extra is respected when provided via the provisioning intent actions such as `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE:kotlin.String`.

    Value: "android.app.extra.PROVISIONING_SHOULD_LAUNCH_RESULT_INTENT"

### EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS: String
```

A boolean extra indicating if the education screens from the provisioning flow should be skipped. If unspecified, defaults to `false`.

This extra can be set in the following ways:

- By the admin app when performing the admin-integrated provisioning flow as a result of the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String` activity
- For managed account enrollment

If the education screens are skipped, it is the admin application's responsibility to display its own user education screens.

    Value: "android.app.extra.PROVISIONING_SKIP_EDUCATION_SCREENS"

### EXTRA_PROVISIONING_SKIP_ENCRYPTION

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_SKIP_ENCRYPTION: String
```

A boolean extra indicating whether device encryption can be skipped as part of [provisioning](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#managed-provisioning).

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` or an intent with action `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_DEVICE:kotlin.String` that starts device owner provisioning.

From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int` onwards, this is also supported for an intent with action `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE:kotlin.String`.

    Value: "android.app.extra.PROVISIONING_SKIP_ENCRYPTION"

### EXTRA_PROVISIONING_SKIP_USER_CONSENT

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_SKIP_USER_CONSENT: String
```

**Deprecated:** *this extra is no longer relevant as device owners cannot create managed profiles*

A boolean extra indicating if the user consent steps from the [provisioning flow](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#managed-provisioning) should be skipped.

If unspecified, defaults to `false`.

    Value: "android.app.extra.PROVISIONING_SKIP_USER_CONSENT"

### EXTRA_PROVISIONING_TIME_ZONE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_TIME_ZONE: String
```

A String extra holding the time zone `https://developer.android.com/reference/kotlin/android/app/AlarmManager.html#` that the device will be set to.

Use only for device owner provisioning. This extra can be returned by the admin app when performing the admin-integrated provisioning flow as a result of the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_GET_PROVISIONING_MODE:kotlin.String` activity.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_TIME_ZONE"

### EXTRA_PROVISIONING_USE_MOBILE_DATA

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_USE_MOBILE_DATA: String
```

A boolean extra indicating if mobile data should be used during the provisioning flow for downloading the admin app. If `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String` is also specified, wifi network will be used instead.

Default value is `false`.

If this extra is set to `true` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String` is not specified, this extra has different behaviour depending on the way provisioning is triggered:

- For provisioning started via a QR code or an NFC tag, mobile data is always used for downloading the admin app.
- For all other provisioning methods, a mobile data connection check is made at the start of provisioning. If mobile data is connected at that point, the admin app download will happen using mobile data. If mobile data is not connected at that point, the end-user will be asked to pick a wifi network and the admin app download will proceed over wifi.

    Value: "android.app.extra.PROVISIONING_USE_MOBILE_DATA"

### EXTRA_PROVISIONING_WIFI_ANONYMOUS_IDENTITY

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_ANONYMOUS_IDENTITY: String
```

The anonymous identity of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. This is only used if the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SECURITY_TYPE:kotlin.String` is `EAP`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_ANONYMOUS_IDENTITY"

### EXTRA_PROVISIONING_WIFI_CA_CERTIFICATE

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_CA_CERTIFICATE: String
```

The CA certificate of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. This should be an X.509 certificate Base64 encoded DER format, ie. PEM representation of a certificate without header, footer and line breaks. [More information](https://tools.ietf.org/html/rfc7468) This is only used if the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SECURITY_TYPE:kotlin.String` is `EAP`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_CA_CERTIFICATE"

### EXTRA_PROVISIONING_WIFI_DOMAIN

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_DOMAIN: String
```

The domain of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. This is only used if the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SECURITY_TYPE:kotlin.String` is `EAP`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_DOMAIN"

### EXTRA_PROVISIONING_WIFI_EAP_METHOD

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_EAP_METHOD: String
```

The EAP method of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String` and could be one of `PEAP`, `TLS`, `TTLS`, `PWD`, `SIM`, `AKA` or `AKA_PRIME`. This is only used if the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SECURITY_TYPE:kotlin.String` is `EAP`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_EAP_METHOD"

### EXTRA_PROVISIONING_WIFI_HIDDEN

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_HIDDEN: String
```

A boolean extra indicating whether the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String` is hidden or not.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_HIDDEN"

### EXTRA_PROVISIONING_WIFI_IDENTITY

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_IDENTITY: String
```

The identity of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. This is only used if the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SECURITY_TYPE:kotlin.String` is `EAP`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_IDENTITY"

### EXTRA_PROVISIONING_WIFI_PAC_URL

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_PAC_URL: String
```

A String extra holding the proxy auto-config (PAC) URL for the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_PAC_URL"

### EXTRA_PROVISIONING_WIFI_PASSWORD

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_PASSWORD: String
```

A String extra holding the password of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_PASSWORD"

### EXTRA_PROVISIONING_WIFI_PHASE2_AUTH

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_PHASE2_AUTH: String
```

The phase 2 authentication of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String` and could be one of `NONE`, `PAP`, `MSCHAP`, `MSCHAPV2`, `GTC`, `SIM`, `AKA` or `AKA_PRIME`. This is only used if the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SECURITY_TYPE:kotlin.String` is `EAP`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_PHASE2_AUTH"

### EXTRA_PROVISIONING_WIFI_PROXY_BYPASS

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_PROXY_BYPASS: String
```

A String extra holding the proxy bypass for the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_PROXY_BYPASS"

### EXTRA_PROVISIONING_WIFI_PROXY_HOST

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_PROXY_HOST: String
```

A String extra holding the proxy host for the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_PROXY_HOST"

### EXTRA_PROVISIONING_WIFI_PROXY_PORT

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_PROXY_PORT: String
```

An int extra holding the proxy port for the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_PROXY_PORT"

### EXTRA_PROVISIONING_WIFI_SECURITY_TYPE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_SECURITY_TYPE: String
```

A String extra indicating the security type of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String` and could be one of `NONE`, `WPA`, `WEP` or `EAP`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_SECURITY_TYPE"

### EXTRA_PROVISIONING_WIFI_SSID

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_SSID: String
```

A String extra holding the ssid of the wifi network that should be used during nfc device owner provisioning for downloading the mobile device management application.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_SSID"

### EXTRA_PROVISIONING_WIFI_USER_CERTIFICATE

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_PROVISIONING_WIFI_USER_CERTIFICATE: String
```

The user certificate of the wifi network in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`. This should be an X.509 certificate and private key Base64 encoded DER format, ie. PEM representation of a certificate and key without header, footer and line breaks. [More information](https://tools.ietf.org/html/rfc7468) This is only used if the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SECURITY_TYPE:kotlin.String` is `EAP`.

Use in an NFC record with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MIME_TYPE_PROVISIONING_NFC:kotlin.String` that starts device owner provisioning via an NFC bump. It can also be used for QR code provisioning.

    Value: "android.app.extra.PROVISIONING_WIFI_USER_CERTIFICATE"

### EXTRA_RESOURCE_IDS

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_RESOURCE_IDS: String
```

An integer array extra for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_DEVICE_POLICY_RESOURCE_UPDATED:kotlin.String` to indicate which resource IDs (i.e. strings and drawables) have been updated.

    Value: "android.app.extra.RESOURCE_IDS"

### EXTRA_RESOURCE_TYPE

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_RESOURCE_TYPE: String
```

An `int` extra for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_DEVICE_POLICY_RESOURCE_UPDATED:kotlin.String` to indicate the type of the resource being updated, the type can be `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESOURCE_TYPE_DRAWABLE:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESOURCE_TYPE_STRING:kotlin.Int`

    Value: "android.app.extra.RESOURCE_TYPE"

### EXTRA_RESOURCE_TYPE_DRAWABLE

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_RESOURCE_TYPE_DRAWABLE: Int
```

A `int` value for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESOURCE_TYPE:kotlin.String` to indicate that a resource of type `https://developer.android.com/reference/kotlin/android/graphics/drawable/Drawable.html#` is being updated.

    Value: 1

### EXTRA_RESOURCE_TYPE_STRING

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_RESOURCE_TYPE_STRING: Int
```

A `int` value for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_RESOURCE_TYPE:kotlin.String` to indicate that a resource of type `https://developer.android.com/reference/kotlin/java/lang/String.html#` is being updated.

    Value: 2

### EXTRA_RESULT_LAUNCH_INTENT

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_RESULT_LAUNCH_INTENT: String
```

An `https://developer.android.com/reference/kotlin/android/content/Intent.html#` result extra specifying the `https://developer.android.com/reference/kotlin/android/content/Intent.html#` to be launched after provisioning is finalized.

If `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SHOULD_LAUNCH_RESULT_INTENT:kotlin.String` is set to `false`, this result will be supplied as part of the result `https://developer.android.com/reference/kotlin/android/content/Intent.html#` for provisioning actions such as `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE:kotlin.String`. This result will also be supplied as part of the result `https://developer.android.com/reference/kotlin/android/content/Intent.html#` for the device policy management role holder provisioning actions.

    Value: "android.app.extra.RESULT_LAUNCH_INTENT"

### FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY: Int
```

Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#lockNow(kotlin.Int)`: also evict the user's credential encryption key from the keyring. The user's credential will need to be entered again in order to derive the credential encryption key that will be stored back in the keyring for future use.

This flag can only be used by a profile owner when locking a managed profile when `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()` returns `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE_PER_USER:kotlin.Int`.

In order to secure user data, the user will be stopped and restarted so apps should wait until they are next run to perform further actions.

    Value: 1

### FLAG_MANAGED_CAN_ACCESS_PARENT

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val FLAG_MANAGED_CAN_ACCESS_PARENT: Int
```

Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addCrossProfileIntentFilter(android.content.ComponentName,%20android.content.IntentFilter,%20kotlin.Int)` to allow activities in the managed profile to access intents sent from the parent profile. That is, when an app in the parent profile calls android.app.Activity#startActivity(android.content.Intent), the intent can be resolved by a matching activity in the managed profile.

    Value: 2

### FLAG_PARENT_CAN_ACCESS_MANAGED

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val FLAG_PARENT_CAN_ACCESS_MANAGED: Int
```

Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addCrossProfileIntentFilter(android.content.ComponentName,%20android.content.IntentFilter,%20kotlin.Int)` to allow activities in the parent profile to access intents sent from the managed profile. That is, when an app in the managed profile calls android.app.Activity#startActivity(android.content.Intent), the intent can be resolved by a matching activity in the parent profile.

    Value: 1

### ID_TYPE_BASE_INFO

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ID_TYPE_BASE_INFO: Int
```

Specifies that the device should attest its manufacturer details. For use with #generateKeyPair.

    Value: 1

**See Also**

### ID_TYPE_IMEI

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ID_TYPE_IMEI: Int
```

Specifies that the device should attest its IMEI. For use with #generateKeyPair.

    Value: 4

**See Also**

### ID_TYPE_INDIVIDUAL_ATTESTATION

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ID_TYPE_INDIVIDUAL_ATTESTATION: Int
```

Specifies that the device should attest using an individual attestation certificate. For use with #generateKeyPair.

    Value: 16

**See Also**

### ID_TYPE_MEID

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ID_TYPE_MEID: Int
```

Specifies that the device should attest its MEID. For use with #generateKeyPair.

    Value: 8

**See Also**

### ID_TYPE_SERIAL

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ID_TYPE_SERIAL: Int
```

Specifies that the device should attest its serial number. For use with #generateKeyPair.

    Value: 2

**See Also**

### INSTALLKEY_REQUEST_CREDENTIALS_ACCESS

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val INSTALLKEY_REQUEST_CREDENTIALS_ACCESS: Int
```

Specifies that the calling app should be granted access to the installed credentials immediately. Otherwise, access to the credentials will be gated by user approval. For use with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installKeyPair(android.content.ComponentName,%20java.security.PrivateKey,%20kotlin.Array,%20kotlin.String,%20kotlin.Int)`

    Value: 1

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installKeyPair(android.content.ComponentName,%20java.security.PrivateKey,%20kotlin.Array,%20kotlin.String,%20kotlin.Int)`

### INSTALLKEY_SET_USER_SELECTABLE

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val INSTALLKEY_SET_USER_SELECTABLE: Int
```

Specifies that a user can select the key via the Certificate Selection prompt. If this flag is not set when calling #installKeyPair, the key can only be granted access by implementing `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onChoosePrivateKeyAlias(android.content.Context,%20android.content.Intent,%20kotlin.Int,%20android.net.Uri,%20kotlin.String)`. For use with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installKeyPair(android.content.ComponentName,%20java.security.PrivateKey,%20kotlin.Array,%20kotlin.String,%20kotlin.Int)`

    Value: 2

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installKeyPair(android.content.ComponentName,%20java.security.PrivateKey,%20kotlin.Array,%20kotlin.String,%20kotlin.Int)`

### KEYGUARD_DISABLE_BIOMETRICS

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val KEYGUARD_DISABLE_BIOMETRICS: Int
```

Disable all biometric authentication on keyguard secure screens (e.g. PIN/Pattern/Password).

    Value: 416

### KEYGUARD_DISABLE_FACE

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val KEYGUARD_DISABLE_FACE: Int
```

Disable face authentication on keyguard secure screens (e.g. PIN/Pattern/Password).

    Value: 128

### KEYGUARD_DISABLE_FEATURES_ALL

Added in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val KEYGUARD_DISABLE_FEATURES_ALL: Int
```

Disable all current and future keyguard customizations.

    Value: 2147483647

### KEYGUARD_DISABLE_FEATURES_NONE

Added in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val KEYGUARD_DISABLE_FEATURES_NONE: Int
```

Widgets are enabled in keyguard

    Value: 0

### KEYGUARD_DISABLE_FINGERPRINT

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val KEYGUARD_DISABLE_FINGERPRINT: Int
```

Disable fingerprint authentication on keyguard secure screens (e.g. PIN/Pattern/Password).

    Value: 32

### KEYGUARD_DISABLE_IRIS

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val KEYGUARD_DISABLE_IRIS: Int
```

Disable iris authentication on keyguard secure screens (e.g. PIN/Pattern/Password).

    Value: 256

### KEYGUARD_DISABLE_REMOTE_INPUT

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val KEYGUARD_DISABLE_REMOTE_INPUT: Int
```

**Deprecated:** *This flag was added in version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int`, but it never had any effect.*

Disable text entry into notifications on secure keyguard screens (e.g. PIN/Pattern/Password).

    Value: 64

### KEYGUARD_DISABLE_SECURE_CAMERA

Added in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val KEYGUARD_DISABLE_SECURE_CAMERA: Int
```

Disable the camera on secure keyguard screens (e.g. PIN/Pattern/Password)

    Value: 2

### KEYGUARD_DISABLE_SECURE_NOTIFICATIONS

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val KEYGUARD_DISABLE_SECURE_NOTIFICATIONS: Int
```

Disable showing all notifications on secure keyguard screens (e.g. PIN/Pattern/Password)

    Value: 4

### KEYGUARD_DISABLE_SHORTCUTS_ALL

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val KEYGUARD_DISABLE_SHORTCUTS_ALL: Int
```

Disable all keyguard shortcuts.

    Value: 512

### KEYGUARD_DISABLE_TRUST_AGENTS

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val KEYGUARD_DISABLE_TRUST_AGENTS: Int
```

Disable trust agents on secure keyguard screens (e.g. PIN/Pattern/Password). By setting this flag alone, all trust agents are disabled. If the admin then wants to allowlist specific features of some trust agent, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setTrustAgentConfiguration(android.content.ComponentName,%20android.content.ComponentName,%20android.os.PersistableBundle)` can be used in conjuction to set trust-agent-specific configurations.

    Value: 16

### KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS: Int
```

Only allow redacted notifications on secure keyguard screens (e.g. PIN/Pattern/Password)

    Value: 8

### KEYGUARD_DISABLE_WIDGETS_ALL

Added in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val KEYGUARD_DISABLE_WIDGETS_ALL: Int
```

Disable all keyguard widgets. Has no effect between `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#LOLLIPOP:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` (both inclusive), since keyguard widget is only supported on Android versions lower than 5.0 and versions higher than 14.

    Value: 1

### LEAVE_ALL_SYSTEM_APPS_ENABLED

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val LEAVE_ALL_SYSTEM_APPS_ENABLED: Int
```

Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#createAndManageUser(android.content.ComponentName,%20kotlin.String,%20android.content.ComponentName,%20android.os.PersistableBundle,%20kotlin.Int)` to specify that the newly created user should skip the disabling of system apps during provisioning.

    Value: 16

### LOCK_TASK_FEATURE_BLOCK_ACTIVITY_START_IN_TASK

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val LOCK_TASK_FEATURE_BLOCK_ACTIVITY_START_IN_TASK: Int
```

Enable blocking of non-allowlisted activities from being started into a locked task.

    Value: 64

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)`

### LOCK_TASK_FEATURE_GLOBAL_ACTIONS

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val LOCK_TASK_FEATURE_GLOBAL_ACTIONS: Int
```

Enable the global actions dialog during LockTask mode. This is the dialog that shows up when the user long-presses the power button, for example. Note that the user may not be able to power off the device if this flag is not set.

This flag is enabled by default until `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)` is called for the first time.

    Value: 16

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)`

### LOCK_TASK_FEATURE_HOME

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val LOCK_TASK_FEATURE_HOME: Int
```

Enable the Home button during LockTask mode. Note that if a custom launcher is used, it has to be registered as the default launcher with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addPersistentPreferredActivity(android.content.ComponentName,%20android.content.IntentFilter,%20android.content.ComponentName)`, and its package needs to be allowlisted for LockTask with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskPackages(android.content.ComponentName,%20kotlin.Array)`.

    Value: 4

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)`

### LOCK_TASK_FEATURE_KEYGUARD

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val LOCK_TASK_FEATURE_KEYGUARD: Int
```

Enable the keyguard during LockTask mode. Note that if the keyguard is already disabled with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setKeyguardDisabled(android.content.ComponentName,%20kotlin.Boolean)`, setting this flag will have no effect. If this flag is not set, the keyguard will not be shown even if the user has a lock screen credential.

    Value: 32

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)`

### LOCK_TASK_FEATURE_NONE

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val LOCK_TASK_FEATURE_NONE: Int
```

Disable all configurable SystemUI features during LockTask mode. This includes,

- system info area in the status bar (connectivity icons, clock, etc.)
- notifications (including alerts, icons, and the notification shade)
- Home button
- Recents button and UI
- global actions menu (i.e. power button menu)
- keyguard

<br />

    Value: 0

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)`

### LOCK_TASK_FEATURE_NOTIFICATIONS

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val LOCK_TASK_FEATURE_NOTIFICATIONS: Int
```

Enable notifications during LockTask mode. This includes notification icons on the status bar, heads-up notifications, and the expandable notification shade. Note that the Quick Settings panel remains disabled. This feature flag can only be used in combination with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_HOME:kotlin.Int`. `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)` throws an `https://developer.android.com/reference/kotlin/java/lang/IllegalArgumentException.html#` if this feature flag is defined without `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_HOME:kotlin.Int`.

    Value: 2

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)`

### LOCK_TASK_FEATURE_OVERVIEW

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val LOCK_TASK_FEATURE_OVERVIEW: Int
```

Enable the Overview button and the Overview screen during LockTask mode. This feature flag can only be used in combination with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_HOME:kotlin.Int`, and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)` will throw an `https://developer.android.com/reference/kotlin/java/lang/IllegalArgumentException.html#` if this feature flag is defined without `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_HOME:kotlin.Int`.

    Value: 8

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)`

### LOCK_TASK_FEATURE_SYSTEM_INFO

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val LOCK_TASK_FEATURE_SYSTEM_INFO: Int
```

Enable the system info area in the status bar during LockTask mode. The system info area usually occupies the right side of the status bar (although this can differ across OEMs). It includes all system information indicators, such as date and time, connectivity, battery, vibration mode, etc.

    Value: 1

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)`

### MAKE_USER_EPHEMERAL

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val MAKE_USER_EPHEMERAL: Int
```

Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#createAndManageUser(android.content.ComponentName,%20kotlin.String,%20android.content.ComponentName,%20android.os.PersistableBundle,%20kotlin.Int)` to specify that the user should be created ephemeral. Ephemeral users will be removed after switching to another user or rebooting the device.

    Value: 2

### MIME_TYPE_PROVISIONING_NFC

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val MIME_TYPE_PROVISIONING_NFC: String
```

This MIME type is used for starting the device owner provisioning.

During device owner provisioning a device admin app is set as the owner of the device. A device owner has full control over the device. The device owner can not be modified by the user and the only way of resetting the device is if the device owner app calls a factory reset.

A typical use case would be a device that is owned by a company, but used by either an employee or client.

The NFC message must be sent to an unprovisioned device.

The NFC record must contain a serialized `https://developer.android.com/reference/kotlin/java/util/Properties.html#` object which contains the following properties:

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_LOCAL_TIME:kotlin.String` (convert to String), optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_TIME_ZONE:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_LOCALE:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SSID:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_HIDDEN:kotlin.String` (convert to String), optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_SECURITY_TYPE:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_PASSWORD:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_PROXY_HOST:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_PROXY_PORT:kotlin.String` (convert to String), optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_PROXY_BYPASS:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_PAC_URL:kotlin.String`, optional
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE:kotlin.String`, optional, supported from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_EAP_METHOD:kotlin.String`, optional, supported from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_PHASE2_AUTH:kotlin.String`, optional, supported from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_CA_CERTIFICATE:kotlin.String`, optional, supported from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_USER_CERTIFICATE:kotlin.String`, optional, supported from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_IDENTITY:kotlin.String`, optional, supported from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_ANONYMOUS_IDENTITY:kotlin.String`, optional, supported from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_WIFI_DOMAIN:kotlin.String`, optional, supported from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int`

As of `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int`, the properties should contain `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME:kotlin.String` instead of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME:kotlin.String`, (although specifying only `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME:kotlin.String` is still supported).

    Value: "application/com.android.managedprovisioning"

### MTE_DISABLED

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val MTE_DISABLED: Int
```

Require that MTE be disabled on the device. Can be set by a device owner.

    Value: 2

### MTE_ENABLED

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val MTE_ENABLED: Int
```

Require that MTE be enabled on the device, if supported. Can be set by a device owner or a profile owner of an organization-owned managed profile.

    Value: 1

### MTE_NOT_CONTROLLED_BY_POLICY

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val MTE_NOT_CONTROLLED_BY_POLICY: Int
```

Allow the user to choose whether to enable MTE on the device.

    Value: 0

### NEARBY_STREAMING_DISABLED

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val NEARBY_STREAMING_DISABLED: Int
```

Indicates that nearby streaming is disabled.

    Value: 1

### NEARBY_STREAMING_ENABLED

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val NEARBY_STREAMING_ENABLED: Int
```

Indicates that nearby streaming is enabled.

    Value: 2

### NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY: Int
```

Indicates that nearby streaming is not controlled by policy, which means nearby streaming is allowed.

    Value: 0

### NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY: Int
```

Indicates that nearby streaming is enabled only to devices offering a comparable level of security, with the same authenticated managed account.

    Value: 3

### OPERATION_SAFETY_REASON_DRIVING_DISTRACTION

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val OPERATION_SAFETY_REASON_DRIVING_DISTRACTION: Int
```

Indicates that a `https://developer.android.com/reference/kotlin/android/app/admin/UnsafeStateException` was thrown because the operation would distract the driver of the vehicle.

    Value: 1

### PASSWORD_COMPLEXITY_HIGH

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PASSWORD_COMPLEXITY_HIGH: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`. Define the high password complexity band as:

- PIN with **no** repeating (4444) or ordered (1234, 4321, 2468) sequences, length at least 8
- alphabetic, length at least 6
- alphanumeric, length at least 6

<br />

When returned from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()`, the constant represents the exact complexity band the password is in. When passed to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`, it sets the minimum complexity band which the password must meet.

    Value: 327680

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_NUMERIC_COMPLEX:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_ALPHABETIC:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_ALPHANUMERIC:kotlin.Int`

### PASSWORD_COMPLEXITY_LOW

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PASSWORD_COMPLEXITY_LOW: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`. Define the low password complexity band as:

- pattern
- PIN with repeating (4444) or ordered (1234, 4321, 2468) sequences

<br />

When returned from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()`, the constant represents the exact complexity band the password is in. When passed to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`, it sets the minimum complexity band which the password must meet.

    Value: 65536

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_SOMETHING:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_NUMERIC:kotlin.Int`

### PASSWORD_COMPLEXITY_MEDIUM

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PASSWORD_COMPLEXITY_MEDIUM: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`. Define the medium password complexity band as:

- PIN with **no** repeating (4444) or ordered (1234, 4321, 2468) sequences, length at least 4
- alphabetic, length at least 4
- alphanumeric, length at least 4

<br />

When returned from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()`, the constant represents the exact complexity band the password is in. When passed to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`, it sets the minimum complexity band which the password must meet.

    Value: 196608

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_NUMERIC_COMPLEX:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_ALPHABETIC:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_ALPHANUMERIC:kotlin.Int`

### PASSWORD_COMPLEXITY_NONE

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PASSWORD_COMPLEXITY_NONE: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`: no password.

When returned from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()`, the constant represents the exact complexity band the password is in. When passed to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`, it sets the minimum complexity band which the password must meet.

    Value: 0

### PASSWORD_QUALITY_ALPHABETIC

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PASSWORD_QUALITY_ALPHABETIC: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: the user must have entered a password containing at least alphabetic (or other symbol) characters. Note that quality constants are ordered so that higher values are more restrictive.

    Value: 262144

### PASSWORD_QUALITY_ALPHANUMERIC

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PASSWORD_QUALITY_ALPHANUMERIC: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: the user must have entered a password containing at least *both\>* numeric *and* alphabetic (or other symbol) characters. Note that quality constants are ordered so that higher values are more restrictive.

    Value: 327680

### PASSWORD_QUALITY_BIOMETRIC_WEAK

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PASSWORD_QUALITY_BIOMETRIC_WEAK: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: the policy allows for low-security biometric recognition technology. This implies technologies that can recognize the identity of an individual to about a 3 digit PIN (false detection is less than 1 in 1,000). Note that quality constants are ordered so that higher values are more restrictive.

    Value: 32768

### PASSWORD_QUALITY_COMPLEX

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PASSWORD_QUALITY_COMPLEX: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: allows the admin to set precisely how many characters of various types the password should contain to satisfy the policy. The admin should set these requirements via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumLetters(android.content.ComponentName,%20kotlin.Int)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumNumeric(android.content.ComponentName,%20kotlin.Int)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumSymbols(android.content.ComponentName,%20kotlin.Int)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumUpperCase(android.content.ComponentName,%20kotlin.Int)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumLowerCase(android.content.ComponentName,%20kotlin.Int)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumNonLetter(android.content.ComponentName,%20kotlin.Int)`, and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumLength(android.content.ComponentName,%20kotlin.Int)`. Note that quality constants are ordered so that higher values are more restrictive.

    Value: 393216

### PASSWORD_QUALITY_NUMERIC

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PASSWORD_QUALITY_NUMERIC: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: the user must have entered a password containing at least numeric characters. Note that quality constants are ordered so that higher values are more restrictive.

    Value: 131072

### PASSWORD_QUALITY_NUMERIC_COMPLEX

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PASSWORD_QUALITY_NUMERIC_COMPLEX: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: the user must have entered a password containing at least numeric characters with no repeating (4444) or ordered (1234, 4321, 2468) sequences. Note that quality constants are ordered so that higher values are more restrictive.

    Value: 196608

### PASSWORD_QUALITY_SOMETHING

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PASSWORD_QUALITY_SOMETHING: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: the policy requires some kind of password or pattern, but doesn't care what it is. Note that quality constants are ordered so that higher values are more restrictive.

    Value: 65536

### PASSWORD_QUALITY_UNSPECIFIED

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PASSWORD_QUALITY_UNSPECIFIED: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`: the policy has no requirements for the password. Note that quality constants are ordered so that higher values are more restrictive.

    Value: 0

### PERMISSION_GRANT_STATE_DEFAULT

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PERMISSION_GRANT_STATE_DEFAULT: Int
```

Runtime permission state: The user can manage the permission through the UI.

    Value: 0

### PERMISSION_GRANT_STATE_DENIED

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PERMISSION_GRANT_STATE_DENIED: Int
```

Runtime permission state: The permission is denied to the app and the user cannot manage the permission through the UI.

    Value: 2

### PERMISSION_GRANT_STATE_GRANTED

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PERMISSION_GRANT_STATE_GRANTED: Int
```

Runtime permission state: The permission is granted to the app and the user cannot manage the permission through the UI.

    Value: 1

### PERMISSION_POLICY_AUTO_DENY

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PERMISSION_POLICY_AUTO_DENY: Int
```

Permission policy to always deny new permission requests for runtime permissions. Already granted or denied permissions are not affected by this.

    Value: 2

### PERMISSION_POLICY_AUTO_GRANT

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PERMISSION_POLICY_AUTO_GRANT: Int
```

Permission policy to always grant new permission requests for runtime permissions. Already granted or denied permissions are not affected by this.

    Value: 1

### PERMISSION_POLICY_PROMPT

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PERMISSION_POLICY_PROMPT: Int
```

Permission policy to prompt user for new permission requests for runtime permissions. Already granted or denied permissions are not affected by this.

    Value: 0

### PERSONAL_APPS_NOT_SUSPENDED

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PERSONAL_APPS_NOT_SUSPENDED: Int
```

Return value for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPersonalAppsSuspendedReasons(android.content.ComponentName)` when personal apps are not suspended.

    Value: 0

### PERSONAL_APPS_SUSPENDED_EXPLICITLY

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PERSONAL_APPS_SUSPENDED_EXPLICITLY: Int
```

Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPersonalAppsSuspendedReasons(android.content.ComponentName)` return value. Set when personal apps are suspended by an admin explicitly via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPersonalAppsSuspended(android.content.ComponentName,%20kotlin.Boolean)`.

    Value: 1

### PERSONAL_APPS_SUSPENDED_PROFILE_TIMEOUT

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PERSONAL_APPS_SUSPENDED_PROFILE_TIMEOUT: Int
```

Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPersonalAppsSuspendedReasons(android.content.ComponentName)` return value. Set when personal apps are suspended by framework because managed profile was off for longer than allowed by policy.

    Value: 2

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedProfileMaximumTimeOff(android.content.ComponentName,%20kotlin.Long)`

### POLICY_DISABLE_CAMERA

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val POLICY_DISABLE_CAMERA: String
```

Constant to indicate the feature of disabling the camera. Used as argument to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#createAdminSupportIntent(kotlin.String)`.

    Value: "policy_disable_camera"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCameraDisabled(android.content.ComponentName,%20kotlin.Boolean)`

### POLICY_DISABLE_SCREEN_CAPTURE

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val POLICY_DISABLE_SCREEN_CAPTURE: String
```

Constant to indicate the feature of disabling screen captures. Used as argument to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#createAdminSupportIntent(kotlin.String)`.

    Value: "policy_disable_screen_capture"

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setScreenCaptureDisabled(android.content.ComponentName,%20kotlin.Boolean)`

### POLICY_SCOPE_DEVICE

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val POLICY_SCOPE_DEVICE: Int
```

Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPolicy(android.app.admin.PolicyIdentifier,%20kotlin.Int,%20android.app.admin.DevicePolicyManager.setPolicy.T)` to apply the policy to the entire device.

    Value: 2

### POLICY_SCOPE_PARENT_USER

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val POLICY_SCOPE_PARENT_USER: Int
```

Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPolicy(android.app.admin.PolicyIdentifier,%20kotlin.Int,%20android.app.admin.DevicePolicyManager.setPolicy.T)` to apply the policy to the parent user of the current user.

    Value: 3

### POLICY_SCOPE_USER

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val POLICY_SCOPE_USER: Int
```

Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPolicy(android.app.admin.PolicyIdentifier,%20kotlin.Int,%20android.app.admin.DevicePolicyManager.setPolicy.T)` to apply the policy to the same user as the current user.

    Value: 1

### PRIVATE_DNS_MODE_OFF

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PRIVATE_DNS_MODE_OFF: Int
```

Specifies that Private DNS was turned off completely.

    Value: 1

### PRIVATE_DNS_MODE_OPPORTUNISTIC

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PRIVATE_DNS_MODE_OPPORTUNISTIC: Int
```

Specifies that the device owner requested opportunistic DNS over TLS

    Value: 2

### PRIVATE_DNS_MODE_PROVIDER_HOSTNAME

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PRIVATE_DNS_MODE_PROVIDER_HOSTNAME: Int
```

Specifies that the device owner configured a specific host to use for Private DNS.

    Value: 3

### PRIVATE_DNS_MODE_UNKNOWN

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PRIVATE_DNS_MODE_UNKNOWN: Int
```

Specifies that the Private DNS setting is in an unknown state.

    Value: 0

### PRIVATE_DNS_SET_ERROR_FAILURE_SETTING

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PRIVATE_DNS_SET_ERROR_FAILURE_SETTING: Int
```

General failure to set the Private DNS mode, not due to one of the reasons listed above.

    Value: 2

### PRIVATE_DNS_SET_ERROR_HOST_NOT_SERVING

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PRIVATE_DNS_SET_ERROR_HOST_NOT_SERVING: Int
```

If the `privateDnsHost` provided was of a valid hostname but that host was found to not support DNS-over-TLS.

    Value: 1

### PRIVATE_DNS_SET_NO_ERROR

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PRIVATE_DNS_SET_NO_ERROR: Int
```

The selected mode has been set successfully. If the mode is `PRIVATE_DNS_MODE_PROVIDER_HOSTNAME` then it implies the supplied host is valid and reachable.

    Value: 0

### PROVISIONING_MODE_FULLY_MANAGED_DEVICE

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PROVISIONING_MODE_FULLY_MANAGED_DEVICE: Int
```

The provisioning mode for fully managed device.

    Value: 1

### PROVISIONING_MODE_MANAGED_PROFILE

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PROVISIONING_MODE_MANAGED_PROFILE: Int
```

The provisioning mode for managed profile.

    Value: 2

### PROVISIONING_MODE_MANAGED_PROFILE_ON_PERSONAL_DEVICE

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PROVISIONING_MODE_MANAGED_PROFILE_ON_PERSONAL_DEVICE: Int
```

The provisioning mode for a managed profile on a personal device.

This mode is only available when the provisioning initiator has explicitly instructed the provisioning flow to support managed profile on a personal device provisioning. In that case, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PROVISIONING_MODE_MANAGED_PROFILE:kotlin.Int` corresponds to an organization-owned managed profile, whereas this constant corresponds to a personally-owned managed profile.

    Value: 3

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_MODE:kotlin.String`

### RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT: Int
```

Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPasswordWithToken(android.content.ComponentName,%20kotlin.String,%20kotlin.ByteArray,%20kotlin.Int)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPassword(kotlin.String,%20kotlin.Int)`: don't ask for user credentials on device boot. If the flag is set, the device can be booted without asking for user password. The absence of this flag does not change the current boot requirements. This flag can be set by the device owner only. If the app is not the device owner, the flag is ignored. Once the flag is set, it cannot be reverted back without resetting the device to factory defaults.

    Value: 2

### RESET_PASSWORD_REQUIRE_ENTRY

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val RESET_PASSWORD_REQUIRE_ENTRY: Int
```

Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPasswordWithToken(android.content.ComponentName,%20kotlin.String,%20kotlin.ByteArray,%20kotlin.Int)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPassword(kotlin.String,%20kotlin.Int)`: don't allow other admins to change the password again until the user has entered it.

    Value: 1

### SKIP_SETUP_WIZARD

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val SKIP_SETUP_WIZARD: Int
```

Flag used by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#createAndManageUser(android.content.ComponentName,%20kotlin.String,%20android.content.ComponentName,%20android.os.PersistableBundle,%20kotlin.Int)` to skip setup wizard after creating a new user.

    Value: 1

### WIFI_SECURITY_ENTERPRISE_192

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val WIFI_SECURITY_ENTERPRISE_192: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`: enterprise 192 bit network.

When returned from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()`, the constant represents the current minimum security level required. When passed to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`, it sets the minimum security level a Wi-Fi network must meet.

    Value: 3

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_OPEN:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_PERSONAL:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_EAP:kotlin.Int`

### WIFI_SECURITY_ENTERPRISE_EAP

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val WIFI_SECURITY_ENTERPRISE_EAP: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`: enterprise EAP network.

When returned from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()`, the constant represents the current minimum security level required. When passed to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`, it sets the minimum security level a Wi-Fi network must meet.

    Value: 2

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_OPEN:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_PERSONAL:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_192:kotlin.Int`

### WIFI_SECURITY_OPEN

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val WIFI_SECURITY_OPEN: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`: no minimum security level.

When returned from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()`, the constant represents the current minimum security level required. When passed to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`, it sets the minimum security level a Wi-Fi network must meet.

    Value: 0

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_PERSONAL:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_EAP:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_192:kotlin.Int`

### WIFI_SECURITY_PERSONAL

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val WIFI_SECURITY_PERSONAL: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`: personal network such as WEP, WPA2-PSK.

When returned from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()`, the constant represents the current minimum security level required. When passed to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`, it sets the minimum security level a Wi-Fi network must meet.

    Value: 1

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_OPEN:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_EAP:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_192:kotlin.Int`

### WIFI_SECURITY_PERSONAL_WPA

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val WIFI_SECURITY_PERSONAL_WPA: Int
```

Constant for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`: personal network without WEP. This level covers `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_PERSONAL:kotlin.Int` but not WEP.

When returned from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMinimumRequiredWifiSecurityLevel()`, the constant represents the current minimum security level required. When passed to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`, it sets the minimum security level a Wi-Fi network must meet.

    Value: 4

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_OPEN:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_PERSONAL:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_EAP:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_192:kotlin.Int`

### WIPE_EUICC

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val WIPE_EUICC: Int
```

Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeDevice(kotlin.Int)`: also erase the device's eUICC data.

    Value: 4

### WIPE_EXTERNAL_STORAGE

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val WIPE_EXTERNAL_STORAGE: Int
```

Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int)`: also erase the device's adopted external storage (such as adopted SD cards).

    Value: 1

**See Also**

### WIPE_RESET_PROTECTION_DATA

Added in [API level 22](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val WIPE_RESET_PROTECTION_DATA: Int
```

Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int)`: also erase the factory reset protection data.

This flag may only be set by device owner admins; if it is set by other admins a `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#` will be thrown.

    Value: 2

### WIPE_SILENTLY

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val WIPE_SILENTLY: Int
```

Flag for `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int)`: won't show reason for wiping to the user.

    Value: 8

## Public methods

### acknowledgeDeviceCompliant

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun acknowledgeDeviceCompliant(): Unit
```

Called by a profile owner of an organization-owned managed profile to acknowledge that the device is compliant and the user can turn the profile off if needed according to the maximum time off policy. This method should be called when the device is deemed compliant after getting `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onComplianceAcknowledgementRequired(android.content.Context,%20android.content.Intent)` callback in case it is overridden. Before this method is called the user is still free to turn the profile off, but the timer won't be reset, so personal apps will be suspended sooner. DPCs only need acknowledging device compliance if they override `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onComplianceAcknowledgementRequired(android.content.Context,%20android.content.Intent)`, otherwise compliance is acknowledged automatically.

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the user isn't unlocked |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isComplianceAcknowledgementRequired()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedProfileMaximumTimeOff(android.content.ComponentName,%20kotlin.Long)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onComplianceAcknowledgementRequired(android.content.Context,%20android.content.Intent)`

### addCrossProfileIntentFilter

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun addCrossProfileIntentFilter(
    admin: ComponentName?, 
    filter: IntentFilter!, 
    flags: Int
): Unit
```

Called by the profile owner of a managed profile so that some intents sent in the managed profile can also be resolved in the parent, or vice versa. Only activity intents are supported.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value may be `null`. |
| `filter` | [IntentFilter](https://developer.android.com/reference/kotlin/android/content/IntentFilter.html#)!: The `https://developer.android.com/reference/kotlin/android/content/IntentFilter.html#` the intent has to match to be also resolved in the other profile |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#FLAG_MANAGED_CAN_ACCESS_PARENT:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#FLAG_PARENT_CAN_ACCESS_MANAGED:kotlin.Int` are supported. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### addCrossProfileWidgetProvider

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun addCrossProfileWidgetProvider(
    admin: ComponentName?, 
    packageName: String!
): Boolean
```

Called by the profile owner of a managed profile or a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_PROFILE_INTERACTION:kotlin.String` to enable widget providers from a given package to be available in the parent profile. As a result the user will be able to add widgets from the allowlisted package running under the profile to a widget host which runs under the parent profile, for example the home screen. Note that a package may have zero or more provider components, where each component provides a different widget type.

**Note:** By default no widget provider package is allowlisted. This API updates the allowlist incrementally. For better performance when updating multiple providers, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCrossProfileWidgetProviders(kotlin.collections.MutableSet)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The package from which widget providers are allowlisted. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | Whether the package was added. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner and not a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_PROFILE_INTERACTION:kotlin.String`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#removeCrossProfileWidgetProvider(android.content.ComponentName,%20kotlin.String)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCrossProfileWidgetProviders(android.content.ComponentName)`

### addOverrideApn

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun addOverrideApn(
    admin: ComponentName, 
    apnSetting: ApnSetting
): Int
```

Called by device owner or managed profile owner to add an override APN.

This method may returns `-1` if `apnSetting` conflicts with an existing override APN. Update the existing conflicted APN with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#updateOverrideApn(android.content.ComponentName,%20kotlin.Int,%20android.telephony.data.ApnSetting)` instead of adding a new entry.

Two override APNs are considered to conflict when all the following APIs return the same values on both override APNs:

- `https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#getOperatorNumeric()`
- `https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#getApnName()`
- `https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#getProxyAddressAsString()`
- `https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#getProxyPort()`
- `https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#getMmsProxyAddressAsString()`
- `https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#getMmsProxyPort()`
- `https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#getMmsc()`
- `https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#isEnabled()`
- `https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#getMvnoType()`
- `https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#getProtocol()`
- `https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#getRoamingProtocol()`

Before Android version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int`: Only device owners can add APNs.

Starting from Android version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int`: Both device owners and managed profile owners can add enterprise APNs (`https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#TYPE_ENTERPRISE:kotlin.Int`), while only device owners can add other type of APNs. Enterprise APNs are specific to the managed profile and do not override any user-configured VPNs. They are prerequisites for enabling preferential network service on the managed profile on 4G networks (`https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPreferentialNetworkServiceConfigs(kotlin.collections.MutableList)`).

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `apnSetting` | [ApnSetting](https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#): the override APN to insert. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The `id` of inserted override APN. Or `-1` when failed to insert into the database. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | If request is for enterprise APN `admin` is either device owner or profile owner and in all other types of APN if `admin` is not a device owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setOverrideApnsEnabled(android.content.ComponentName,%20kotlin.Boolean)`

### addPersistentPreferredActivity

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun addPersistentPreferredActivity(
    admin: ComponentName?, 
    filter: IntentFilter!, 
    activity: ComponentName
): Unit
```

Called by a profile owner or device owner or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_LOCK_TASK:kotlin.String`. to set a default activity that the system selects to handle intents that match the given `https://developer.android.com/reference/kotlin/android/content/IntentFilter.html#` instead of showing the default disambiguation mechanism. This activity will remain the default intent handler even if the set of potential event handlers for the intent filter changes and if the intent preferences are reset.

Note that the target application should still declare the activity in the manifest, the API just sets the activity to be the default one to handle the given intent filter.

The default disambiguation mechanism takes over if the activity is not installed (anymore). When the activity is (re)installed, it is automatically reset as default intent handler for the filter.

Note that calling this API to set a default intent handler, only allow to avoid the default disambiguation mechanism. Implicit intents that do not trigger this mechanism (like invoking the browser) cannot be configured as they are controlled by other configurations.

The calling device admin must be a profile owner or device owner. If it is not, a security exception will be thrown.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, after the persistent preferred activity policy has been set, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully set or not. This callback will contain:

- The policy identifier `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyIdentifiers#PERSISTENT_PREFERRED_ACTIVITY_POLICY:kotlin.String`
- The additional policy params bundle, which contains `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#EXTRA_INTENT_FILTER:kotlin.String` the intent filter the policy applies to
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully set or the reason the policy failed to be set (e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

NOTE: Performs disk I/O and shouldn't be called on the main thread.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `filter` | [IntentFilter](https://developer.android.com/reference/kotlin/android/content/IntentFilter.html#)!: The IntentFilter for which a default handler is added. |
| `activity` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): The Activity that is added as default intent handler. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_LOCK_TASK:kotlin.String`. |

### addUserRestriction

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun addUserRestriction(
    admin: ComponentName?, 
    key: String!
): Unit
```

Called by a profile owner, device owner or a holder of any permission that is associated with a user restriction to set a user restriction specified by the key.

The calling device admin must be a profile owner, device owner or holder of any permission that is associated with a user restriction; if it is not, a security exception will be thrown.

The profile owner of an organization-owned managed profile may invoke this method on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance it obtained from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, for enforcing device-wide restrictions.

See the constants in `https://developer.android.com/reference/kotlin/android/os/UserManager.html#` for the list of restrictions that can be enforced device-wide. These constants will also state in their documentation which permission is required to manage the restriction using this API.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, after the user restriction policy has been set, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully set or not. This callback will contain:

- The policy identifier returned from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyIdentifiers#getIdentifierForUserRestriction(kotlin.String)`
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully set or the reason the policy failed to be set (e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with or `null` if the caller is not a device admin. |
| `key` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The key of the restriction. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#ALLOW_PARENT_PROFILE_APP_LINKING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADD_MANAGED_PROFILE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADD_PRIVATE_PROFILE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADD_USER:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADD_WIFI_CONFIG:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADJUST_VOLUME:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_AIRPLANE_MODE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_AMBIENT_DISPLAY:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_APPS_CONTROL:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ASSIST_CONTENT:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_AUTOFILL:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_BLUETOOTH:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_BLUETOOTH_SHARING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CAMERA_TOGGLE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CELLULAR_2G:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CHANGE_NEAR_FIELD_COMMUNICATION_RADIO:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CHANGE_WIFI_STATE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_BLUETOOTH:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_BRIGHTNESS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_CELL_BROADCASTS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_CREDENTIALS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DATE_TIME:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DEFAULT_APPS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_LOCALE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_LOCATION:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_MOBILE_NETWORKS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_PRIVATE_DNS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_SCREEN_TIMEOUT:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_TETHERING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_VPN:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_WIFI:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONTENT_CAPTURE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONTENT_SUGGESTIONS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CREATE_WINDOWS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CROSS_PROFILE_COPY_PASTE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_DATA_ROAMING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_DEBUGGING_FEATURES:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_FACTORY_RESET:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_FUN:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_GRANT_ADMIN:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_TASK_CONTINUITY_HANDOFF:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_INSTALL_APPS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_INSTALL_UNKNOWN_SOURCES:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_INSTALL_UNKNOWN_SOURCES_INCLUDING_REGISTERED_APP_STORES:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_MICROPHONE_TOGGLE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_MODIFY_ACCOUNTS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_MOUNT_PHYSICAL_MEDIA:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_NETWORK_RESET:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_OUTGOING_BEAM:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_OUTGOING_CALLS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_PRINTING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_REMOVE_MANAGED_PROFILE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_REMOVE_USER:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SAFE_BOOT:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SET_USER_ICON:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SET_WALLPAPER:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SHARE_INTO_MANAGED_PROFILE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SHARE_LOCATION:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SIM_GLOBALLY:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SMS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SYSTEM_ERROR_DIALOGS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_THREAD_NETWORK:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ULTRA_WIDEBAND_RADIO:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_UNIFIED_PASSWORD:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_UNINSTALL_APPS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_UNMUTE_MICROPHONE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_USB_FILE_TRANSFER:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_USER_SWITCH:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_WIFI_DIRECT:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_WIFI_TETHERING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#ENSURE_VERIFY_APPS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#KEY_RESTRICTIONS_PENDING:kotlin.String` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner and if the caller has not been granted the permission to set the given user restriction. |

### addUserRestrictionGlobally

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun addUserRestrictionGlobally(key: String): Unit
```

Called by a profile owner, device owner or a holder of any permission that is associated with a user restriction to set a user restriction specified by the provided `key` globally on all users. To clear the restriction use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#clearUserRestriction(android.content.ComponentName,%20kotlin.String)`.

For a given user, a restriction will be set if it was applied globally or locally by any admin.

The calling device admin must be a profile owner, device owner or a holder of any permission that is associated with a user restriction; if it is not, a security exception will be thrown.

See the constants in `https://developer.android.com/reference/kotlin/android/os/UserManager.html#` for the list of restrictions that can be enforced device-wide. These constants will also state in their documentation which permission is required to manage the restriction using this API.

After the user restriction policy has been set, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully set or not. This callback will contain:

- The policy identifier returned from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyIdentifiers#getIdentifierForUserRestriction(kotlin.String)`
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully set or the reason the policy failed to be set (e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

| Parameters ||
|---|---|
| `key` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The key of the restriction. This value cannot be `null`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#ALLOW_PARENT_PROFILE_APP_LINKING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADD_MANAGED_PROFILE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADD_PRIVATE_PROFILE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADD_USER:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADD_WIFI_CONFIG:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADJUST_VOLUME:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_AIRPLANE_MODE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_AMBIENT_DISPLAY:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_APPS_CONTROL:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ASSIST_CONTENT:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_AUTOFILL:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_BLUETOOTH:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_BLUETOOTH_SHARING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CAMERA_TOGGLE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CELLULAR_2G:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CHANGE_NEAR_FIELD_COMMUNICATION_RADIO:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CHANGE_WIFI_STATE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_BLUETOOTH:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_BRIGHTNESS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_CELL_BROADCASTS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_CREDENTIALS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DATE_TIME:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DEFAULT_APPS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_LOCALE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_LOCATION:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_MOBILE_NETWORKS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_PRIVATE_DNS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_SCREEN_TIMEOUT:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_TETHERING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_VPN:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_WIFI:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONTENT_CAPTURE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONTENT_SUGGESTIONS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CREATE_WINDOWS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CROSS_PROFILE_COPY_PASTE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_DATA_ROAMING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_DEBUGGING_FEATURES:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_FACTORY_RESET:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_FUN:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_GRANT_ADMIN:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_TASK_CONTINUITY_HANDOFF:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_INSTALL_APPS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_INSTALL_UNKNOWN_SOURCES:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_INSTALL_UNKNOWN_SOURCES_INCLUDING_REGISTERED_APP_STORES:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_MICROPHONE_TOGGLE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_MODIFY_ACCOUNTS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_MOUNT_PHYSICAL_MEDIA:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_NETWORK_RESET:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_OUTGOING_BEAM:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_OUTGOING_CALLS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_PRINTING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_REMOVE_MANAGED_PROFILE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_REMOVE_USER:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SAFE_BOOT:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SET_USER_ICON:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SET_WALLPAPER:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SHARE_INTO_MANAGED_PROFILE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SHARE_LOCATION:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SIM_GLOBALLY:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SMS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SYSTEM_ERROR_DIALOGS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_THREAD_NETWORK:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ULTRA_WIDEBAND_RADIO:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_UNIFIED_PASSWORD:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_UNINSTALL_APPS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_UNMUTE_MICROPHONE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_USB_FILE_TRANSFER:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_USER_SWITCH:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_WIFI_DIRECT:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_WIFI_TETHERING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#ENSURE_VERIFY_APPS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#KEY_RESTRICTIONS_PENDING:kotlin.String` |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if caller is not targeting Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` or above. |
| `java.lang.SecurityException` | if `admin` is not a device or profile owner and if the caller has not been granted the permission to set the given user restriction. |

### bindDeviceAdminServiceAsUser

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun bindDeviceAdminServiceAsUser(
    admin: ComponentName, 
    serviceIntent: Intent, 
    conn: ServiceConnection, 
    flags: Context.BindServiceFlags, 
    targetUser: UserHandle
): Boolean
```

See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#bindDeviceAdminServiceAsUser(android.content.ComponentName,%20android.content.Intent,%20android.content.ServiceConnection,%20kotlin.Int,%20android.os.UserHandle)`. Call `https://developer.android.com/reference/kotlin/android/content/Context.BindServiceFlags.html#of(kotlin.Long)` to obtain a BindServiceFlags object.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): This value cannot be `null`. |
| `serviceIntent` | [Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#): This value cannot be `null`. |
| `conn` | [ServiceConnection](https://developer.android.com/reference/kotlin/android/content/ServiceConnection.html#): This value cannot be `null`. |
| `flags` | [Context.BindServiceFlags](https://developer.android.com/reference/kotlin/android/content/Context.BindServiceFlags.html#): This value cannot be `null`. |
| `targetUser` | [UserHandle](https://developer.android.com/reference/kotlin/android/os/UserHandle.html#): This value cannot be `null`. |

### bindDeviceAdminServiceAsUser

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun bindDeviceAdminServiceAsUser(
    admin: ComponentName, 
    serviceIntent: Intent, 
    conn: ServiceConnection, 
    flags: Int, 
    targetUser: UserHandle
): Boolean
```

Called by a device owner to bind to a service from a secondary managed user or vice versa. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getBindDeviceAdminTargetUsers(android.content.ComponentName)` for the pre-requirements of a device owner to bind to services of another managed user.

The service must be protected by `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#BIND_DEVICE_ADMIN:kotlin.String`. Note that the `https://developer.android.com/reference/kotlin/android/content/Context.html#` used to obtain this `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance via `https://developer.android.com/reference/kotlin/android/content/Context.html#getSystemService(java.lang.Class)` will be used to bind to the `https://developer.android.com/reference/kotlin/android/app/Service.html#`.

Note: This method used to be available for communication between device owner and profile owner. However, since Android 11, this combination is not possible. This method is now only useful for communication between device owner and managed secondary users.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `serviceIntent` | [Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#): Identifies the service to connect to. The Intent must specify either an explicit component name or a package name to match an `https://developer.android.com/reference/kotlin/android/content/IntentFilter.html#` published by a service. This value cannot be `null`. |
| `conn` | [ServiceConnection](https://developer.android.com/reference/kotlin/android/content/ServiceConnection.html#): Receives information as the service is started and stopped in main thread. This must be a valid `https://developer.android.com/reference/kotlin/android/content/ServiceConnection.html#` object; it must not be `null`. |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Operation options for the binding operation. See `https://developer.android.com/reference/kotlin/android/content/Context.html#bindService(android.content.Intent,%20android.content.ServiceConnection,%20kotlin.Int)`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/content/Context.html#BIND_AUTO_CREATE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/content/Context.html#BIND_DEBUG_UNBIND:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/content/Context.html#BIND_NOT_FOREGROUND:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/content/Context.html#BIND_ABOVE_CLIENT:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/content/Context.html#BIND_ALLOW_OOM_MANAGEMENT:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/content/Context.html#BIND_WAIVE_PRIORITY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/content/Context.html#BIND_IMPORTANT:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/content/Context.html#BIND_ADJUST_WITH_ACTIVITY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/content/Context.html#BIND_NOT_PERCEPTIBLE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/content/Context.html#BIND_ALLOW_ACTIVITY_STARTS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/content/Context.html#BIND_INCLUDE_CAPABILITIES:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/content/Context.html#BIND_SHARED_ISOLATED_PROCESS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/content/Context.html#BIND_PACKAGE_ISOLATED_PROCESS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/content/Context.html#BIND_EXTERNAL_SERVICE:kotlin.Int` |
| `targetUser` | [UserHandle](https://developer.android.com/reference/kotlin/android/os/UserHandle.html#): Which user to bind to. Must be one of the users returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getBindDeviceAdminTargetUsers(android.content.ComponentName)`, otherwise a `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#` will be thrown. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | If you have successfully bound to the service, `true` is returned; `false` is returned if the connection is not made and you will not receive the service object. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/content/Context.html#bindService(android.content.Intent,%20android.content.ServiceConnection,%20kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getBindDeviceAdminTargetUsers(android.content.ComponentName)`

### canAdminGrantSensorsPermissions

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun canAdminGrantSensorsPermissions(): Boolean
```

Returns true if the caller is running on a device where an admin can grant permissions related to device sensors. This is a signal that the device is a fully-managed device where personal usage is discouraged. The list of permissions is listed in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermissionGrantState(android.content.ComponentName,%20kotlin.String,%20kotlin.String,%20kotlin.Int)`. May be called by any app.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | true if an admin can grant device sensors-related permissions, false otherwise. |

### canUsbDataSignalingBeDisabled

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun canUsbDataSignalingBeDisabled(): Boolean
```

Returns whether enabling or disabling USB data signaling is supported on the device.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the device supports enabling and disabling USB data signaling. |

### clearApplicationUserData

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun clearApplicationUserData(
    admin: ComponentName, 
    packageName: String, 
    executor: Executor, 
    listener: DevicePolicyManager.OnClearApplicationUserDataListener
): Unit
```

Called by the device owner or profile owner to clear application user data of a given package. The behaviour of this is equivalent to the target application calling `https://developer.android.com/reference/kotlin/android/app/ActivityManager.html#clearApplicationUserData()`.

**Note:** an application can store data outside of its application data, e.g. external storage or user dictionary. This data will not be wiped by calling this API.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The name of the package which will have its user data wiped. This value cannot be `null`. |
| `executor` | [Executor](https://developer.android.com/reference/kotlin/java/util/concurrent/Executor.html#): The executor through which the listener should be invoked. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/kotlin/java/util/concurrent/Executor.html#`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/kotlin/android/content/Context.html#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/kotlin/java/util/concurrent/Executor.html#` that dispatches to an appropriate thread. |
| `listener` | [DevicePolicyManager.OnClearApplicationUserDataListener](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager.OnClearApplicationUserDataListener): A callback object that will inform the caller when the clearing is done. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not the device owner/profile owner. |

### clearCrossProfileIntentFilters

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun clearCrossProfileIntentFilters(admin: ComponentName?): Unit
```

Called by a profile owner of a managed profile to remove the cross-profile intent filters that go from the managed profile to the parent, or from the parent to the managed profile. Only removes those that have been set by the profile owner.

*Note* : A list of default cross profile intent filters are set up by the system when the profile is created, some of them ensure the proper functioning of the profile, while others enable sharing of data from the parent to the managed profile for user convenience. These default intent filters are not cleared when this API is called. If the default cross profile data sharing is not desired, they can be disabled with `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SHARE_INTO_MANAGED_PROFILE:kotlin.String`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value may be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner. |

### clearDeviceOwnerApp

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun clearDeviceOwnerApp(packageName: String!): Unit
```

**Deprecated:** *This method is expected to be used for testing purposes only. The device owner will lose control of the device and its data after calling it. In order to protect any sensitive data that remains on the device, it is advised that the device owner factory resets the device instead of calling this method. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int)`.*

Clears the current device owner. The caller must be the device owner. This function should be used cautiously as once it is called it cannot be undone. The device owner can only be set as a part of device setup, before it completes.

While some policies previously set by the device owner will be cleared by this method, it is a best-effort process and some other policies will still remain in place after the device owner is cleared.

| Parameters ||
|---|---|
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The package name of the device owner. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not in `packageName` or `packageName` does not own the current device owner component. |

### clearPackagePersistentPreferredActivities

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun clearPackagePersistentPreferredActivities(
    admin: ComponentName?, 
    packageName: String!
): Unit
```

Called by a profile owner or device owner or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_LOCK_TASK:kotlin.String` to remove all persistent intent handler preferences associated with the given package that were set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addPersistentPreferredActivity(android.content.ComponentName,%20android.content.IntentFilter,%20android.content.ComponentName)`.

The calling device admin must be a profile owner. If it is not, a security exception will be thrown.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, after the persistent preferred activity policy has been cleared, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully cleared or not. This callback will contain:

- The policy identifier `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyIdentifiers#PERSISTENT_PREFERRED_ACTIVITY_POLICY:kotlin.String`
- The additional policy params bundle, which contains `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#EXTRA_INTENT_FILTER:kotlin.String` the intent filter the policy applies to
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully cleared or the reason the policy failed to be cleared (e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The name of the package for which preferences are removed. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_LOCK_TASK:kotlin.String`. |

### clearProfileOwner

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun clearProfileOwner(admin: ComponentName): Unit
```

**Deprecated:** *This method is expected to be used for testing purposes only. The profile owner will lose control of the user and its data after calling it. In order to protect any sensitive data that remains on this user, it is advised that the profile owner deletes it instead of calling this method. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int)`.*

Clears the active profile owner. The caller must be the profile owner of this user, otherwise a SecurityException will be thrown. This method is not available to managed profile owners.

While some policies previously set by the profile owner will be cleared by this method, it is a best-effort process and some other policies will still remain in place after the profile owner is cleared.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): The component to remove as the profile owner. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not an active profile owner, or the method is being called from a managed profile. |

### clearResetPasswordToken

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun clearResetPasswordToken(admin: ComponentName?): Boolean
```

Called by a profile, device owner or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_RESET_PASSWORD:kotlin.String` to revoke the current password reset token.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, this method has no effect - the reset token should not have been set in the first place - and false is returned.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | true if the operation is successful, false otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if admin is not a device or profile owner and if the caller does not the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_RESET_PASSWORD:kotlin.String`. |

### clearUserRestriction

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun clearUserRestriction(
    admin: ComponentName?, 
    key: String!
): Unit
```

Called by a profile owner, device owner or a holder of any permission that is associated with a user restriction to clear a user restriction specified by the key.

The calling device admin must be a profile or device owner; if it is not, a security exception will be thrown.

The profile owner of an organization-owned managed profile may invoke this method on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance it obtained from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, for clearing device-wide restrictions.

See the constants in `https://developer.android.com/reference/kotlin/android/os/UserManager.html#` for the list of restrictions. These constants state in their documentation which permission is required to manage the restriction using this API.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, after the user restriction policy has been cleared, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully cleared or not. This callback will contain:

- The policy identifier returned from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyIdentifiers#getIdentifierForUserRestriction(kotlin.String)`
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully cleared or the reason the policy failed to be cleared (e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with or `null` if the caller is not a device admin. |
| `key` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The key of the restriction. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#ALLOW_PARENT_PROFILE_APP_LINKING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADD_MANAGED_PROFILE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADD_PRIVATE_PROFILE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADD_USER:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADD_WIFI_CONFIG:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADJUST_VOLUME:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_AIRPLANE_MODE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_AMBIENT_DISPLAY:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_APPS_CONTROL:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ASSIST_CONTENT:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_AUTOFILL:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_BLUETOOTH:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_BLUETOOTH_SHARING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CAMERA_TOGGLE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CELLULAR_2G:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CHANGE_NEAR_FIELD_COMMUNICATION_RADIO:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CHANGE_WIFI_STATE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_BLUETOOTH:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_BRIGHTNESS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_CELL_BROADCASTS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_CREDENTIALS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DATE_TIME:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DEFAULT_APPS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_LOCALE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_LOCATION:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_MOBILE_NETWORKS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_PRIVATE_DNS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_SCREEN_TIMEOUT:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_TETHERING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_VPN:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_WIFI:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONTENT_CAPTURE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONTENT_SUGGESTIONS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CREATE_WINDOWS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CROSS_PROFILE_COPY_PASTE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_DATA_ROAMING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_DEBUGGING_FEATURES:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_FACTORY_RESET:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_FUN:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_GRANT_ADMIN:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_TASK_CONTINUITY_HANDOFF:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_INSTALL_APPS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_INSTALL_UNKNOWN_SOURCES:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_INSTALL_UNKNOWN_SOURCES_INCLUDING_REGISTERED_APP_STORES:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_MICROPHONE_TOGGLE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_MODIFY_ACCOUNTS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_MOUNT_PHYSICAL_MEDIA:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_NETWORK_RESET:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_OUTGOING_BEAM:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_OUTGOING_CALLS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_PRINTING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_REMOVE_MANAGED_PROFILE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_REMOVE_USER:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SAFE_BOOT:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SET_USER_ICON:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SET_WALLPAPER:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SHARE_INTO_MANAGED_PROFILE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SHARE_LOCATION:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SIM_GLOBALLY:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SMS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_SYSTEM_ERROR_DIALOGS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_THREAD_NETWORK:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ULTRA_WIDEBAND_RADIO:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_UNIFIED_PASSWORD:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_UNINSTALL_APPS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_UNMUTE_MICROPHONE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_USB_FILE_TRANSFER:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_USER_SWITCH:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_WIFI_DIRECT:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_WIFI_TETHERING:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#ENSURE_VERIFY_APPS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#KEY_RESTRICTIONS_PENDING:kotlin.String` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner and if the caller has not been granted the permission to set the given user restriction. |

### createAdminSupportIntent

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun createAdminSupportIntent(restriction: String): Intent!
```

Called by any app to display a support dialog when a feature was disabled by an admin. This returns an intent that can be used with `https://developer.android.com/reference/kotlin/android/content/Context.html#startActivity(android.content.Intent)` to display the dialog. It will tell the user that the feature indicated by `restriction` was disabled by an admin, and include a link for more information. The default content of the dialog can be changed by the restricting admin via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setShortSupportMessage(android.content.ComponentName,%20kotlin.CharSequence)`. If the restriction is not set (i.e. the feature is available), then the return value will be `null`.

| Parameters ||
|---|---|
| `restriction` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): Indicates for which feature the dialog should be displayed. Can be a user restriction from `https://developer.android.com/reference/kotlin/android/os/UserManager.html#`, e.g. `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_ADJUST_VOLUME:kotlin.String`, or one of the constants `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#POLICY_DISABLE_CAMERA:kotlin.String` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#POLICY_DISABLE_SCREEN_CAPTURE:kotlin.String`. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/content/Intent.html#!` | Intent An intent to be used to start the dialog-activity if the restriction is set by an admin, or null if the restriction does not exist or no admin set it. |

### createAndManageUser

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun createAndManageUser(
    admin: ComponentName, 
    name: String, 
    profileOwner: ComponentName, 
    adminExtras: PersistableBundle?, 
    flags: Int
): UserHandle?
```

Called by a device owner to create a user with the specified name and a given component of the calling package as profile owner. The UserHandle returned by this method should not be persisted as user handles are recycled as users are removed and created. If you need to persist an identifier for this user, use `https://developer.android.com/reference/kotlin/android/os/UserManager.html#getSerialNumberForUser(android.os.UserHandle)`. The new user will not be started in the background.

admin is the `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` which is the device owner. profileOwner is also a DeviceAdminReceiver in the same package as admin, and will become the profile owner and will be registered as an active admin on the new user. The profile owner package will be installed on the new user.

If the adminExtras are not null, they will be stored on the device until the user is started for the first time. Then the extras will be passed to the admin when onEnable is called.

From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#P:kotlin.Int` onwards, if targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#P:kotlin.Int`, throws `https://developer.android.com/reference/kotlin/android/os/UserManager.UserOperationException.html#` instead of returning `null` on failure.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The user's name. This value cannot be `null`. |
| `profileOwner` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` will be profile owner. Has to be in the same package as admin, otherwise no user is created and an IllegalArgumentException is thrown. This value cannot be `null`. |
| `adminExtras` | [PersistableBundle](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#)?: Extras that will be passed to onEnable of the admin receiver on the new user. This value may be `null`. |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#SKIP_SETUP_WIZARD:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MAKE_USER_EPHEMERAL:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LEAVE_ALL_SYSTEM_APPS_ENABLED:kotlin.Int` are supported. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#SKIP_SETUP_WIZARD:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MAKE_USER_EPHEMERAL:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LEAVE_ALL_SYSTEM_APPS_ENABLED:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/os/UserHandle.html#?` | the `https://developer.android.com/reference/kotlin/android/os/UserHandle.html#` object for the created user, or `null` if the user could not be created. |

| Exceptions ||
|---|---|
| `android.os.UserManager.UserOperationException` | if the user could not be created and the calling app is targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#P:kotlin.Int` and running on `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#P:kotlin.Int`. |
| `java.lang.SecurityException` | if `admin` is not a device owner |

**See Also**

- `https://developer.android.com/reference/kotlin/android/os/UserHandle.html#`

### enableSystemApp

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun enableSystemApp(
    admin: ComponentName?, 
    intent: Intent!
): Int
```

Re-enable system apps by intent that were disabled by default when the user was initialized. This function can be called by a device owner, profile owner, or by a delegate given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_ENABLE_SYSTEM_APP:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if the caller is an enable system app delegate. |
| `intent` | [Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#)!: An intent matching the app(s) to be installed. All apps that resolve for this intent will be re-enabled in the calling profile. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | int The number of activities that matched the intent and were installed. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PACKAGE_ACCESS:kotlin.String`

### enableSystemApp

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun enableSystemApp(
    admin: ComponentName?, 
    packageName: String!
): Unit
```

Re-enable a system app that was disabled by default when the user was initialized. This function can be called by a device owner, profile owner, or by a delegate given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_ENABLE_SYSTEM_APP:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if the caller is an enable system app delegate. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The package to be re-enabled in the calling profile. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PACKAGE_ACCESS:kotlin.String`

### generateKeyPair

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun generateKeyPair(
    admin: ComponentName?, 
    algorithm: String, 
    keySpec: KeyGenParameterSpec, 
    idAttestationFlags: Int
): AttestedKeyPair!
```

This API can be called by the following to generate a new private/public key pair:

- Device owner
- Profile owner
- Delegated certificate installer
- Credential management app
- An app that holds the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission

If the device supports key generation via secure hardware, this method is useful for creating a key in KeyChain that never left the secure hardware. Access to the key is controlled the same way as in #installKeyPair.

<br />

This method generates a key pair within the scope of the calling user (equivalent to using `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` with the overloaded `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#generateKeyPair(kotlin.String,%20android.security.keystore.KeyGenParameterSpec,%20kotlin.Int,%20kotlin.Int)` method). To generate device-scoped key pairs (`https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`), the new overload must be used.

From Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int`, the credential management app can call this API. If called by the credential management app, the componentName must be `null`. Note, there can only be a credential management app on an unmanaged device.

Because this method might take several seconds to complete, it should only be called from a worker thread. This method returns `null` when called from the main thread.

This method is not thread-safe, calling it from multiple threads at the same time will result in undefined behavior. If the calling thread is interrupted while the invocation is in-flight, it will eventually terminate and return `null`.

Note: If the provided `alias` is of an existing alias, all former grants that apps have been given to access the key and certificates associated with this alias will be revoked.

Attestation: to enable attestation, set an attestation challenge in `keySpec` via `https://developer.android.com/reference/kotlin/android/security/keystore/KeyGenParameterSpec.Builder.html#setAttestationChallenge(kotlin.ByteArray)`. By specifying flags to the `idAttestationFlags` parameter, it is possible to request the device's unique identity to be included in the attestation record.

Specific identifiers can be included in the attestation record, and an individual attestation certificate can be used to sign the attestation record. To find out if the device supports these features, refer to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isDeviceIdAttestationSupported()` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isUniqueDeviceAttestationSupported()`.

Device owner, profile owner, their delegated certificate installer and the credential management app can use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_BASE_INFO:kotlin.Int` to request inclusion of the general device information including manufacturer, model, brand, device and product in the attestation record. Only device owner, profile owner on an organization-owned device or affiliated user, and their delegated certificate installers can use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_SERIAL:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_IMEI:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_MEID:kotlin.Int` to request unique device identifiers to be attested (the serial number, IMEI and MEID correspondingly), if supported by the device (see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isDeviceIdAttestationSupported()`). Additionally, device owner, profile owner on an organization-owned device and their delegated certificate installers can also request the attestation record to be signed using an individual attestation certificate by specifying the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_INDIVIDUAL_ATTESTATION:kotlin.Int` flag (if supported by the device, see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isUniqueDeviceAttestationSupported()`).

If any of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_SERIAL:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_IMEI:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_MEID:kotlin.Int` is set, it is implicitly assumed that `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_BASE_INFO:kotlin.Int` is also set.

Attestation using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_INDIVIDUAL_ATTESTATION:kotlin.Int` can only be requested if key generation is done in StrongBox.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if the caller is not a device admin. |
| `algorithm` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The key generation algorithm, see `https://developer.android.com/reference/kotlin/java/security/KeyPairGenerator.html#`. This value cannot be `null`. |
| `keySpec` | [KeyGenParameterSpec](https://developer.android.com/reference/kotlin/android/security/keystore/KeyGenParameterSpec.html#): Specification of the key to generate, see `https://developer.android.com/reference/kotlin/java/security/KeyPairGenerator.html#`. This value cannot be `null`. |
| `idAttestationFlags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): A bitmask of the identifiers that should be included in the attestation record (`ID_TYPE_BASE_INFO`, `ID_TYPE_SERIAL`, `ID_TYPE_IMEI` and `ID_TYPE_MEID`), and `ID_TYPE_INDIVIDUAL_ATTESTATION` if the attestation record should be signed using an individual attestation certificate. `0` should be passed in if no device identification is required in the attestation record and the batch attestation certificate should be used. If any flag is specified, then an attestation challenge must be included in the `keySpec`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_BASE_INFO:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_SERIAL:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_IMEI:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_MEID:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_INDIVIDUAL_ATTESTATION:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/security/AttestedKeyPair.html#!` | A non-null `AttestedKeyPair` if the key generation succeeded, null otherwise. |

| Exceptions ||
|---|---|
| `android.security.keystore.StrongBoxUnavailableException` | if the use of StrongBox for key generation was specified in `keySpec` but the device does not have one. |
| `java.lang.IllegalArgumentException` | in the following cases: - The alias in `keySpec` is empty. - The algorithm specification in `keySpec` is not `RSAKeyGenParameterSpec` or `ECGenParameterSpec`. - Device ID attestation was requested but the `keySpec` does not contain an attestation challenge. |
| `java.lang.SecurityException` | if `admin` is not `null` and not a device or profile owner, or `admin` is null but the calling application is not a delegated certificate installer or credential management app. If Device ID attestation is requested (using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_SERIAL:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_IMEI:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_MEID:kotlin.Int`), the caller must be the Device Owner or the Certificate Installer delegate. |
| `java.lang.UnsupportedOperationException` | if Device ID attestation or individual attestation was requested but the underlying hardware does not support it. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/security/keystore/KeyGenParameterSpec.Builder.html#setAttestationChallenge(kotlin.ByteArray)`

### generateKeyPair

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun generateKeyPair(
    algorithm: String, 
    keySpec: KeyGenParameterSpec, 
    idAttestationFlags: Int, 
    scope: Int
): AttestedKeyPair
```

Generates a new private/public key pair with a specified scope.

This method extends `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#generateKeyPair(android.content.ComponentName,%20kotlin.String,%20android.security.keystore.KeyGenParameterSpec,%20kotlin.Int)`, adding the `scope` parameter to determine if the key pair is user-specific or device-wide.

Please refer to the documentation of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#generateKeyPair(android.content.ComponentName,%20kotlin.String,%20android.security.keystore.KeyGenParameterSpec,%20kotlin.Int)` for complete details on general functionality, permissions, caller types, attestation, secure hardware usage, and exceptions.

Key differences in this overload:

- The `scope` parameter MUST be provided to define the key's visibility.
- Using `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`: The key pair will be accessible across all affiliated users on the device. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`. The caller MUST be running in an affiliated user to use this scope. Credential management apps are not permitted to use this scope.
- Using `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int`: The key pair is private to the calling user. This mirrors the behavior of the base `generateKeyPair` method.

**Note:** Like the base method, this may take several seconds and should not be called on the main thread. It is not thread-safe.

| Parameters ||
|---|---|
| `algorithm` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The key generation algorithm, see `https://developer.android.com/reference/kotlin/java/security/KeyPairGenerator.html#`. This value cannot be `null`. |
| `keySpec` | [KeyGenParameterSpec](https://developer.android.com/reference/kotlin/android/security/keystore/KeyGenParameterSpec.html#): Specification of the key to generate, see `https://developer.android.com/reference/kotlin/java/security/KeyPairGenerator.html#`. This value cannot be `null`. |
| `idAttestationFlags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): A bitmask of the identifiers that should be included in the attestation record. See base method for details. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_BASE_INFO:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_SERIAL:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_IMEI:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_MEID:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ID_TYPE_INDIVIDUAL_ATTESTATION:kotlin.Int` |
| `scope` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The scope of the key pair: `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/security/AttestedKeyPair.html#` | A non-null `AttestedKeyPair`. |

| Exceptions ||
|---|---|
| `android.security.KeyChainException` | if key pair generation fails for other internal system reasons. |
| `android.security.keystore.StrongBoxUnavailableException` | if StrongBox was requested but is unavailable. |
| `java.lang.IllegalArgumentException` | if parameters are invalid. |
| `java.lang.SecurityException` | if the caller is not authorized (see base method), or if `KEYPAIR_SCOPE_DEVICE` is requested by a non-affiliated user or credential management app. |
| `java.lang.UnsupportedOperationException` | if Device ID attestation or individual attestation was requested but the underlying hardware does not support it. |

### getAccountTypesWithManagementDisabled

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getAccountTypesWithManagementDisabled(): Array<String!>?
```

Gets the array of accounts for which account management is disabled by the profile owner or device owner.

Account management can be disabled/enabled by calling `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAccountManagementDisabled(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)`.

This method may be called on the `DevicePolicyManager` instance returned from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`. Note that only a profile owner on an organization-owned device can affect account types on the parent profile instance.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>?` | a list of account types for which account management has been disabled. This value may be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAccountManagementDisabled(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)`

### getActiveAdmins

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getActiveAdmins(): MutableList<ComponentName!>?
```

Return a list of all currently active device administrators' component names. If there are no administrators `null` may be returned.

### getAffiliationIds

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getAffiliationIds(admin: ComponentName): MutableSet<String!>
```

Returns the set of affiliation ids previously set via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)`, or an empty set if none have been set.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>` | This value cannot be `null`. |

### getAlwaysOnVpnLockdownWhitelist

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getAlwaysOnVpnLockdownWhitelist(admin: ComponentName): MutableSet<String!>?
```

Called by device or profile owner to query the set of packages that are allowed to access the network directly when always-on VPN is in lockdown mode but not connected. Returns `null` when always-on VPN is not active or not in lockdown mode.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or a profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAlwaysOnVpnPackage(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean,%20kotlin.collections.MutableSet)`

### getAlwaysOnVpnPackage

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getAlwaysOnVpnPackage(admin: ComponentName): String?
```

Called by a device or profile owner to read the name of the package administering an always-on VPN connection for the current user. If there is no such package, or the always-on VPN is provided by the system instead of by an application, `null` will be returned.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` | Package name of VPN controller responsible for always-on VPN, or `null` if none is set. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or a profile owner. |

### getAppFunctionsPolicy

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getAppFunctionsPolicy(): Int
```

Returns the current `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionManager.html#` policy.

The returned policy will be the current resolved policy rather than the policy set by the calling admin.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#APP_FUNCTIONS_NOT_CONTROLLED_BY_POLICY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#APP_FUNCTIONS_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#APP_FUNCTIONS_DISABLED_CROSS_PROFILE:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device owner, a profile owner or a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_APP_FUNCTIONS:kotlin.String`. |

### getApplicationRestrictions

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getApplicationRestrictions(
    admin: ComponentName?, 
    packageName: String!
): Bundle
```

Retrieves the application restrictions for a given target application running in the calling user.

The caller must be a profile or device owner on that user, or the package allowed to manage application restrictions via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)` with the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_APP_RESTRICTIONS:kotlin.String` scope; otherwise a security exception will be thrown.

NOTE: The method performs disk I/O and shouldn't be called on the main thread.   
This method may take several seconds to complete, so it should only be called from a worker thread.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if called by the application restrictions managing package. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The name of the package to fetch restricted settings of. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` | `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` of settings corresponding to what was set last time `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setApplicationRestrictions(android.content.ComponentName,%20kotlin.String,%20android.os.Bundle)` was called, or an empty `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` if no restrictions have been set. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_APP_RESTRICTIONS:kotlin.String`

### getApplicationRestrictionsManagingPackage

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getApplicationRestrictionsManagingPackage(admin: ComponentName): String?
```

**Deprecated:** *From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#O:kotlin.Int`. Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getDelegatePackages(android.content.ComponentName,%20kotlin.String)` with the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_APP_RESTRICTIONS:kotlin.String` scope instead.*

Called by a profile owner or device owner to retrieve the application restrictions managing package for the current user, or `null` if none is set. If there are multiple delegates this function will return one of them.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` | The package name allowed to manage application restrictions on the current user, or `null` if none is set. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### getAutoTimeEnabled

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getAutoTimeEnabled(admin: ComponentName?): Boolean
```

Returns true if auto time is enabled on the device.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | true if auto time is enabled on the device. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device owner, a profile owner for the primary user, or a profile owner of an organization-owned managed profile. |

### getAutoTimePolicy

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getAutoTimePolicy(): Int
```

Returns current auto time policy's state.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | One of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ENABLED:kotlin.Int` if enabled, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_DISABLED:kotlin.Int` if disabled and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_NOT_CONTROLLED_BY_POLICY:kotlin.Int` if it's not controlled by policy. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_NOT_CONTROLLED_BY_POLICY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ENABLED:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device owner, a profile owner for the primary user, or a profile owner of an organization-owned managed profile, or if the caller does not hold the required permission. |

### getAutoTimeRequired

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getAutoTimeRequired(): Boolean
```

**Deprecated:** *From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int`. Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getAutoTimeEnabled(android.content.ComponentName)`*

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | true if auto time is required. |

### getAutoTimeZoneEnabled

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getAutoTimeZoneEnabled(admin: ComponentName?): Boolean
```

Returns true if auto time zone is enabled on the device.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | true if auto time zone is enabled on the device. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device owner, a profile owner for the primary user, or a profile owner of an organization-owned managed profile. |

### getAutoTimeZonePolicy

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getAutoTimeZonePolicy(): Int
```

Returns auto time zone policy's current state.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | One of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_ENABLED:kotlin.Int` if enabled, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_DISABLED:kotlin.Int` if disabled and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_NOT_CONTROLLED_BY_POLICY:kotlin.Int` if the state is not controlled by policy. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_NOT_CONTROLLED_BY_POLICY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_ENABLED:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device owner, a profile owner for the primary user, or a profile owner of an organization-owned managed profile, or if the caller does not hold the required permission. |

### getBindDeviceAdminTargetUsers

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getBindDeviceAdminTargetUsers(admin: ComponentName): MutableList<UserHandle!>
```

Returns the list of target users that the calling device owner or owner of secondary user can use when calling #bindDeviceAdminServiceAsUser.

A device owner can bind to a service from a secondary managed user and vice versa, provided that both users are affiliated. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://developer.android.com/reference/kotlin/android/os/UserHandle.html#!>` | This value cannot be `null`. |

### getBluetoothContactSharingDisabled

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getBluetoothContactSharingDisabled(admin: ComponentName): Boolean
```

Called by a profile owner of a managed profile to determine whether or not Bluetooth devices cannot access enterprise contacts.

The calling device admin must be a profile owner. If it is not, a security exception will be thrown.

This API works on managed profile only.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner. |

### getCameraDisabled

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getCameraDisabled(admin: ComponentName?): Boolean
```

Determine whether or not the device's cameras have been disabled for this user, either by the calling admin, if specified, or all admins.

Starting with Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#CINNAMON_BUN:kotlin.Int`, this method also checks for external USB cameras that connect directly via the `https://developer.android.com/reference/kotlin/android/hardware/usb/UsbConstants.html#USB_CLASS_VIDEO:kotlin.Int` interface.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance, returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, where the caller must be the profile owner of an organization-owned managed profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to check whether any admins have disabled the camera |

### getCertInstallerPackage

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getCertInstallerPackage(admin: ComponentName): String?
```

**Deprecated:** *From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#O:kotlin.Int`. Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getDelegatePackages(android.content.ComponentName,%20kotlin.String)` with the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_INSTALL:kotlin.String` scope instead.*

Called by a profile owner or device owner to retrieve the certificate installer for the user, or `null` if none is set. If there are multiple delegates this function will return one of them.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` | The package name of the current delegated certificate installer, or `null` if none is set. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or a profile owner. |

### getContentProtectionPolicy

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getContentProtectionPolicy(admin: ComponentName?): Int
```

Returns the current content protection policy.

The returned policy will be the current resolved policy rather than the policy set by the calling admin.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#CONTENT_PROTECTION_NOT_CONTROLLED_BY_POLICY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#CONTENT_PROTECTION_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#CONTENT_PROTECTION_ENABLED:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not the device owner, a profile owner, or a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CONTENT_PROTECTION:kotlin.String`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setContentProtectionPolicy(android.content.ComponentName,%20kotlin.Int)`

### getCredentialManagerPolicy

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getCredentialManagerPolicy(): PackagePolicy?
```

Called by a device owner or profile owner of a managed profile to retrieve the credential manager policy.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy?` | the current credential manager policy if null then this policy has not been configured. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device owner or profile owner of a managed profile. |

### getCrossProfileCalendarPackages

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getCrossProfileCalendarPackages(admin: ComponentName): MutableSet<String!>?
```

**Deprecated:** *Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCrossProfilePackages(android.content.ComponentName,%20kotlin.collections.MutableSet)`.*

Gets a set of package names that are allowed to access cross-profile calendar APIs.

Called by a profile owner of a managed profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>?` | the set of names of packages that were previously allowed via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCrossProfileCalendarPackages(android.content.ComponentName,%20kotlin.collections.MutableSet)`, or an empty set if none have been allowed. This value may be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCrossProfileCalendarPackages(android.content.ComponentName,%20kotlin.collections.MutableSet)`

### getCrossProfileCallerIdDisabled

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getCrossProfileCallerIdDisabled(admin: ComponentName): Boolean
```

**Deprecated:** *starting with `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getManagedProfileCallerIdAccessPolicy()` instead*

Called by a profile owner of a managed profile to determine whether or not caller-Id information has been disabled.

The calling device admin must be a profile owner. If it is not, a security exception will be thrown.

Starting with `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, this will return true when `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedProfileCallerIdAccessPolicy(android.app.admin.PackagePolicy)` has been set with a non-null policy whose policy type is NOT `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy#PACKAGE_POLICY_BLOCKLIST:kotlin.Int`

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner. |

### getCrossProfileContactsSearchDisabled

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getCrossProfileContactsSearchDisabled(admin: ComponentName): Boolean
```

**Deprecated:** *From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getManagedProfileContactsAccessPolicy()`*

Called by a profile owner of a managed profile to determine whether or not contacts search has been disabled.

The calling device admin must be a profile owner. If it is not, a security exception will be thrown.

Starting with `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, this will return true when `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedProfileContactsAccessPolicy(android.app.admin.PackagePolicy)` has been set with a non-null policy whose policy type is NOT `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy#PACKAGE_POLICY_BLOCKLIST:kotlin.Int`

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner. |

### getCrossProfilePackages

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getCrossProfilePackages(admin: ComponentName): MutableSet<String!>
```

Returns the set of package names that the admin has previously set as allowed to request user consent for cross-profile communication, via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCrossProfilePackages(android.content.ComponentName,%20kotlin.collections.MutableSet)`.

Assumes that the caller is a profile owner and is the given `admin`.

Note that other apps not included in the returned set may be able to request user consent for cross-profile communication if they have been explicitly allowlisted by the OEM.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): the `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>` | the set of package names the admin has previously set as allowed to request user consent for cross-profile communication, via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCrossProfilePackages(android.content.ComponentName,%20kotlin.collections.MutableSet)` This value cannot be `null`. |

### getCrossProfileWidgetProviders

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getCrossProfileWidgetProviders(admin: ComponentName?): MutableList<String!>
```

Called by the profile owner of a managed profile or a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_PROFILE_INTERACTION:kotlin.String` to query providers from which packages are available in the parent profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>` | The allowlisted package list. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner and not a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_PROFILE_INTERACTION:kotlin.String`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addCrossProfileWidgetProvider(android.content.ComponentName,%20kotlin.String)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#removeCrossProfileWidgetProvider(android.content.ComponentName,%20kotlin.String)`

### getCurrentFailedPasswordAttempts

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getCurrentFailedPasswordAttempts(): Int
```

Retrieve the number of times the user has failed at entering a password since that last successful password entry.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve the number of failed password attempts for the parent user.

The calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_WATCH_LOGIN:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always empty and this method always returns 0.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The number of times user has entered an incorrect password since the last correct password entry. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the calling application does not own an active administrator that uses `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_WATCH_LOGIN:kotlin.Int` |

### getDelegatePackages

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getDelegatePackages(
    admin: ComponentName, 
    delegationScope: String
): MutableList<String!>?
```

Called by a profile owner or device owner to retrieve a list of delegate packages that were granted a delegation scope.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `delegationScope` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The scope whose delegates should be retrieved. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>?` | A list of package names of the current delegated packages for `delegationScope`. This value may be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or a profile owner. |

### getDelegatedScopes

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getDelegatedScopes(
    admin: ComponentName?, 
    delegatedPackage: String
): MutableList<String!>
```

Called by a profile owner or device owner to retrieve a list of the scopes given to a delegate package. Other apps can use this method to retrieve their own delegated scopes by passing `null` for `admin` and their own package name as `delegatedPackage`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if the caller is `delegatedPackage`. |
| `delegatedPackage` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The package name of the app whose scopes should be retrieved. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>` | A list containing the scopes given to `delegatedPackage`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or a profile owner. |

### getDeviceOwnerLockScreenInfo

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getDeviceOwnerLockScreenInfo(): CharSequence!
```

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!` | The device owner information. If it is not set returns `null`. |

### getDevicePolicyManagementRoleHolderPackage

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getDevicePolicyManagementRoleHolderPackage(): String?
```

Returns the package name of the device policy management role holder.

If the device policy management role holder is not configured for this device, returns `null`.

### getEndUserSessionMessage

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getEndUserSessionMessage(admin: ComponentName): CharSequence!
```

Returns the user session end message.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

### getEnrollmentSpecificId

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getEnrollmentSpecificId(): String
```

Returns an enrollment-specific identifier of this device, which is guaranteed to be the same value for the same device, enrolled into the same organization by the same managing app. This identifier is high-entropy, useful for uniquely identifying individual devices within the same organisation. It is available both in a work profile and on a fully-managed device. The identifier would be consistent even if the work profile is removed and enrolled again (to the same organization), or the device is factory reset and re-enrolled. Can only be called by the Profile Owner and Device Owner, and starting from Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#VANILLA_ICE_CREAM:kotlin.Int`, holders of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String`. If `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setOrganizationId(kotlin.String)` was not called, then the returned value will be an empty string.

Note about access to device identifiers: a device owner, a profile owner of an organization-owned device or the delegated certificate installer (holding the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_INSTALL:kotlin.String` delegation) on such a device can still obtain hardware identifiers by calling e.g. `https://developer.android.com/reference/kotlin/android/os/Build.html#getSerial()`, in addition to using this method. However, a profile owner on a personal (non organization-owned) device, or the delegated certificate installer on such a device, cannot obtain hardware identifiers anymore and must switch to using this method.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | A stable, enrollment-specific identifier. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not a profile owner, device owner or holding the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission |

### getFactoryResetProtectionPolicy

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getFactoryResetProtectionPolicy(admin: ComponentName?): FactoryResetProtectionPolicy?
```

Callable by device owner or profile owner of an organization-owned device, to retrieve the current factory reset protection (FRP) policy set previously by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setFactoryResetProtectionPolicy(android.content.ComponentName,%20android.app.admin.FactoryResetProtectionPolicy)`.

This method can also be called by the FRP management agent on device or with the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MASTER_CLEAR:kotlin.String`, in which case, it can pass `null` as the ComponentName.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with or `null` if the caller is not a device admin |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy?` | The current FRP policy object or `null` if no policy is set. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner, a profile owner of an organization-owned device or the FRP management agent. |
| `java.lang.UnsupportedOperationException` | if factory reset protection is not supported on the device. |

### getGlobalPrivateDnsHost

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getGlobalPrivateDnsHost(admin: ComponentName): String?
```

Returns the system-wide Private DNS host.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` | The hostname used for Private DNS queries, null if none is set. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not the device owner. |

### getGlobalPrivateDnsMode

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getGlobalPrivateDnsMode(admin: ComponentName): Int
```

Returns the system-wide Private DNS mode.

This may be called by the device owner. Starting from Android 18, it can also be called by the profile owner of an organization-owned device.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | one of `PRIVATE_DNS_MODE_OFF`, `PRIVATE_DNS_MODE_OPPORTUNISTIC`, `PRIVATE_DNS_MODE_PROVIDER_HOSTNAME` or `PRIVATE_DNS_MODE_UNKNOWN`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is neither the device owner nor a profile owner of an organization-owned device. |

### getInstalledCaCerts

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getInstalledCaCerts(admin: ComponentName?): MutableList<ByteArray!>
```

Returns all CA certificates that are currently trusted, excluding system CA certificates. If a user has installed any certificates by other means than device policy these will be included too.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if calling from a delegated certificate installer. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html!>` | a List of byte\[\] arrays, each encoding one user CA certificate. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not `null` and not a device or profile owner. |

### getKeepUninstalledPackages

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getKeepUninstalledPackages(admin: ComponentName?): MutableList<String!>?
```

Get the list of apps to keep around as APKs even if no user has currently installed it. This function can be called by a device owner or by a delegate given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_KEEP_UNINSTALLED_PACKAGES:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`.

Please note that packages returned in this method are not automatically pre-cached.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if the caller is a keep uninstalled packages delegate. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>?` | List of package names to keep cached. This value may be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_KEEP_UNINSTALLED_PACKAGES:kotlin.String`

### getKeyPairGrants

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getKeyPairGrants(alias: String): MutableMap<Int!, MutableSet<String!>!>
```

Called by a device or profile owner, or delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), to query which apps have access to a given KeyChain key.

Key are granted on a per-UID basis, so if several apps share the same UID, granting access to one of them automatically grants it to others. This method returns a map containing one entry per grantee UID. Entries have UIDs as keys and sets of corresponding package names as values. In particular, grantee packages that don't share UID with other packages are represented by entries having singleton sets as values.

| Parameters ||
|---|---|
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias of the key to grant access to. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html!, https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>!>` | apps that have access to a given key, arranged in a map from UID to sets of package names. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if `alias` doesn't correspond to an existing key. |
| `java.lang.SecurityException` | if the caller is not a device owner, a profile owner or delegated certificate chooser. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#grantKeyPairToApp(android.content.ComponentName,%20kotlin.String,%20kotlin.String)`

### getKeyPairGrants

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getKeyPairGrants(
    alias: String, 
    scope: Int
): MutableMap<Int!, MutableSet<String!>!>
```

Called by a device or profile owner, delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), or permission caller, to query which apps have access to a given KeyChain key in the specified scope.

| Parameters ||
|---|---|
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias of the key to query grants for. This value cannot be `null`. |
| `scope` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The scope of the key pair: `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int` |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html!, https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>!>` | apps that have access to a given key, arranged in a map from UID to sets of package names. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if `alias` doesn't correspond to an existing key or is empty. |
| `java.lang.IllegalStateException` | if `KEYPAIR_SCOPE_DEVICE` is requested by a non-affiliated user. |
| `java.lang.SecurityException` | if the caller is not a device owner, a profile owner, delegated certificate chooser, or permission caller. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#grantKeyPairToApp(kotlin.String,%20kotlin.String,%20kotlin.Int)`

### getKeyguardDisabledFeatures

Added in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getKeyguardDisabledFeatures(admin: ComponentName?): Int
```

Determine whether or not features have been disabled in keyguard either by the calling admin, if specified, or all admins that set restrictions on this user and its participating profiles. Restrictions on profiles that have a separate challenge are not taken into account.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve restrictions on the parent profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to check whether any admins have disabled features in keyguard. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | bitfield of flags. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setKeyguardDisabledFeatures(android.content.ComponentName,%20kotlin.Int)` for a list. |

### getLockTaskFeatures

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getLockTaskFeatures(admin: ComponentName?): Int
```

Gets which system features are enabled for LockTask mode.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, the returned policy will be the current resolved policy rather than the policy set by the calling admin.

**Warning:** Do not use this method in Android Automotive environments featuring android.content.pm.PackageManager#FEATURE_CAR_SPLITSCREEN_MULTITASKING. This automotive split-screen multi-tasking feature does not support Lock Task Mode. Consequently, if this method is called in such an environment, it will not work as expected, and the app will not remain locked as the single, exclusive application.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | bitfield of flags. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)` for a list. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_NONE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_SYSTEM_INFO:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_NOTIFICATIONS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_HOME:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_OVERVIEW:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_GLOBAL_ACTIONS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_KEYGUARD:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_BLOCK_ACTIVITY_START_IN_TASK:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not the device owner, the profile owner of an affiliated user or profile, or the profile owner when no device owner is set or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_LOCK_TASK:kotlin.String`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)`

### getLockTaskPackages

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getLockTaskPackages(admin: ComponentName?): Array<String!>
```

Returns the list of packages allowed to start the lock task mode.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, the returned policy will be the current resolved policy rather than the policy set by the calling admin.

**Warning:** Do not use this method in Android Automotive environments featuring android.content.pm.PackageManager#FEATURE_CAR_SPLITSCREEN_MULTITASKING. This automotive split-screen multi-tasking feature does not support Lock Task Mode. Consequently, if this method is called in such an environment, it will not work as expected, and the app will not remain locked as the single, exclusive application.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>` | This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not the device owner, the profile owner of an affiliated user or profile, or the profile owner when no device owner is set or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_LOCK_TASK:kotlin.String`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskPackages(android.content.ComponentName,%20kotlin.Array)`

### getLongSupportMessage

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getLongSupportMessage(admin: ComponentName): CharSequence?
```

Called by a device admin to get the long support message.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html?` | The message set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLongSupportMessage(android.content.ComponentName,%20kotlin.CharSequence)` or null if no message has been set. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not an active administrator. |

### getManagedProfileCallerIdAccessPolicy

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getManagedProfileCallerIdAccessPolicy(): PackagePolicy?
```

Called by a profile owner of a managed profile to retrieve the caller id policy.

The calling device admin must be a profile owner of a managed profile. If it is not, a `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#` will be thrown.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy?` | the current caller id policy. This value may be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a profile owner of a managed profile. |

### getManagedProfileContactsAccessPolicy

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getManagedProfileContactsAccessPolicy(): PackagePolicy?
```

Called by a profile owner of a managed profile to determine the current policy applied to managed profile contacts.

The calling device admin must be a profile owner of a managed profile. If it is not, a `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#` will be thrown.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy?` | the current contacts search policy. This value may be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a profile owner of a managed profile. |

### getManagedProfileMaximumTimeOff

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getManagedProfileMaximumTimeOff(admin: ComponentName): Long
```

Called by a profile owner of an organization-owned managed profile to get maximum time the profile is allowed to be turned off.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html` | Maximum time the profile is allowed to be off in milliseconds or 0 if not limited. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPersonalAppsSuspended(android.content.ComponentName,%20kotlin.Boolean)`

### getManagedSubscriptionsPolicy

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getManagedSubscriptionsPolicy(): ManagedSubscriptionsPolicy
```

Returns the current `https://developer.android.com/reference/kotlin/android/app/admin/ManagedSubscriptionsPolicy`. If the policy has not been set, it will return a default policy of Type `https://developer.android.com/reference/kotlin/android/app/admin/ManagedSubscriptionsPolicy#TYPE_ALL_PERSONAL_SUBSCRIPTIONS:kotlin.Int`.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/ManagedSubscriptionsPolicy` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedSubscriptionsPolicy(android.app.admin.ManagedSubscriptionsPolicy)`

### getMaximumFailedPasswordsForWipe

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getMaximumFailedPasswordsForWipe(admin: ComponentName?): Int
```

Retrieve the current maximum number of login attempts that are allowed before the device or profile is wiped, for a particular admin or all admins that set restrictions on this user and its participating profiles. Restrictions on profiles that have a separate challenge are not taken into account.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve the value for the parent profile.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always empty and this method returns a default value (0) indicating that the policy is not set.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to aggregate all admins. |

### getMaximumTimeToLock

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getMaximumTimeToLock(admin: ComponentName?): Long
```

Retrieve the current maximum time to unlock for a particular admin or all admins that set restrictions on this user and its participating profiles. Restrictions on profiles that have a separate challenge are not taken into account.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve restrictions on the parent profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to aggregate all admins. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html` | time in milliseconds for the given admin or the minimum value (strictest) of all admins if admin is null. Returns 0 if there are no restrictions. |

### getMeteredDataDisabledPackages

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getMeteredDataDisabledPackages(admin: ComponentName): MutableList<String!>
```

Called by a device or profile owner to retrieve the list of packages which are restricted by the admin from using metered data.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>` | the list of restricted package names. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### getMinimumRequiredWifiSecurityLevel

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getMinimumRequiredWifiSecurityLevel(): Int
```

Returns the current Wi-Fi minimum security level.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_OPEN:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_PERSONAL:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_PERSONAL_WPA:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_EAP:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_192:kotlin.Int` |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMinimumRequiredWifiSecurityLevel(kotlin.Int)`

### getMtePolicy

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getMtePolicy(): Int
```

Called by a device owner, profile owner of an organization-owned device to get the Memory Tagging Extension (MTE) policy [Learn more about MTE](https://source.android.com/docs/security/test/memory-safety/arm-mte)

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | the currently set MTE policy. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MTE_ENABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MTE_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MTE_NOT_CONTROLLED_BY_POLICY:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not permitted to set Mte policy |

### getNearbyAppStreamingPolicy

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getNearbyAppStreamingPolicy(): Int
```

Returns the current runtime nearby app streaming policy set by the device or profile owner.

The caller must be the target user's device owner/profile owner or hold the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#READ_NEARBY_STREAMING_POLICY:kotlin.String` permission.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_ENABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY:kotlin.Int` |

### getNearbyNotificationStreamingPolicy

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getNearbyNotificationStreamingPolicy(): Int
```

Returns the current runtime nearby notification streaming policy set by the device or profile owner.

The caller must be the target user's device owner/profile owner or hold the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#READ_NEARBY_STREAMING_POLICY:kotlin.String` permission.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_ENABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY:kotlin.Int` |

### getOrganizationColor

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getOrganizationColor(admin: ComponentName): Int
```

**Deprecated:** *From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int`, the organization color is never used as the background color of the confirm credentials screen.*

Called by a profile owner of a managed profile to retrieve the color used for customization. This color is used as background color of the confirm credentials screen for that user.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The 24bit (0xRRGGBB) representation of the color to be used. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner. |

### getOrganizationName

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getOrganizationName(admin: ComponentName?): CharSequence?
```

Called by the device owner (since API 26) or profile owner (since API 24) or holders of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_ORGANIZATION_IDENTITY:kotlin.String` to retrieve the name of the organization under management.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html?` | The organization name or `null` if none is set. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` if `admin` is not a device or profile owner or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_ORGANIZATION_IDENTITY:kotlin.String`. |

### getOverrideApns

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getOverrideApns(admin: ComponentName): MutableList<ApnSetting!>!
```

Called by device owner or managed profile owner to get all override APNs inserted by device owner or managed profile owner previously using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addOverrideApn(android.content.ComponentName,%20android.telephony.data.ApnSetting)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#!>!` | A list of override APNs inserted by device owner. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setOverrideApnsEnabled(android.content.ComponentName,%20kotlin.Boolean)`

### getParentProfileInstance

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getParentProfileInstance(admin: ComponentName?): DevicePolicyManager
```

Called by the profile owner of a managed profile or other apps in a managed profile to obtain a `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` whose calls act on the parent profile.

The following methods are supported for the parent instance, all other methods will throw a SecurityException when called on the parent instance:

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordQuality(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumLength(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumLength(android.content.ComponentName,%20kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumUpperCase(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumUpperCase(android.content.ComponentName,%20kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumLowerCase(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumLowerCase(android.content.ComponentName,%20kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumLetters(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumLetters(android.content.ComponentName,%20kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumNumeric(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumNumeric(android.content.ComponentName,%20kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumSymbols(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumSymbols(android.content.ComponentName,%20kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumNonLetter(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumNonLetter(android.content.ComponentName,%20kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordHistoryLength(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordHistoryLength(android.content.ComponentName,%20kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordExpirationTimeout(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordExpirationTimeout(android.content.ComponentName,%20kotlin.Long)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordExpiration(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMaximumLength(kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isActivePasswordSufficient()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCurrentFailedPasswordAttempts()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMaximumFailedPasswordsForWipe(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMaximumFailedPasswordsForWipe(android.content.ComponentName,%20kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getMaximumTimeToLock(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMaximumTimeToLock(android.content.ComponentName,%20kotlin.Long)`
- lockNow
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getKeyguardDisabledFeatures(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setKeyguardDisabledFeatures(android.content.ComponentName,%20kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getTrustAgentConfiguration(android.content.ComponentName,%20android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setTrustAgentConfiguration(android.content.ComponentName,%20android.content.ComponentName,%20android.os.PersistableBundle)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getRequiredStrongAuthTimeout(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredStrongAuthTimeout(android.content.ComponentName,%20kotlin.Long)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getAccountTypesWithManagementDisabled()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getRequiredPasswordComplexity()`

The following methods are supported for the parent instance but can only be called by the profile owner on an [organization owned](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#organization-owned) managed profile:

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCameraDisabled(android.content.ComponentName,%20kotlin.Boolean)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCameraDisabled(android.content.ComponentName)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAccountManagementDisabled(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermittedInputMethods(android.content.ComponentName,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPermittedInputMethods(android.content.ComponentName)`
- wipeData
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setNearbyAppStreamingPolicy(kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getNearbyAppStreamingPolicy()`

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with or `null` if the caller is not a profile owner. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` | a new instance of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` that acts on the parent profile. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the current user is not a managed profile. |

### getPasswordComplexity

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPasswordComplexity(): Int
```

Returns how complex the current user's screen lock is.

Note that when called from a profile which uses an unified challenge with its parent, the screen lock complexity of the parent will be returned.

Apps need the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#REQUEST_PASSWORD_COMPLEXITY:kotlin.String` permission to call this method. On Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int` and above, the calling application does not need this permission if it is a device owner or a profile owner.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve restrictions on the parent profile.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_NONE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_LOW:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_MEDIUM:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_HIGH:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the user is not unlocked. |
| `java.lang.SecurityException` | if the calling application does not have the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#REQUEST_PASSWORD_COMPLEXITY:kotlin.String`, and is not a device owner or a profile owner. |

### getPasswordExpiration

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPasswordExpiration(admin: ComponentName?): Long
```

Get the current password expiration time for a particular admin or all admins that set restrictions on this user and its participating profiles. Restrictions on profiles that have a separate challenge are not taken into account. If admin is `null`, then a composite of all expiration times is returned - which will be the minimum of all of them.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve the password expiration for the parent profile.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password expiration is always disabled and this method always returns 0.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to aggregate all admins. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html` | The password expiration time, in milliseconds since epoch. |

### getPasswordExpirationTimeout

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPasswordExpirationTimeout(admin: ComponentName?): Long
```

Get the password expiration timeout for the given admin. The expiration timeout is the recurring expiration timeout provided in the call to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordExpirationTimeout(android.content.ComponentName,%20kotlin.Long)` for the given admin or the aggregate of all participating policy administrators if `admin` is null. Admins that have set restrictions on profiles that have a separate challenge are not taken into account.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve restrictions on the parent profile.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password expiration is always disabled and this method always returns 0.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to aggregate all admins. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html` | The timeout for the given admin or the minimum of all timeouts |

### getPasswordHistoryLength

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPasswordHistoryLength(admin: ComponentName?): Int
```

Retrieve the current password history length for a particular admin or all admins that set restrictions on this user and its participating profiles. Restrictions on profiles that have a separate challenge are not taken into account.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve restrictions on the parent profile.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password history length is always 0.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to aggregate all admins. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The length of the password history |

### getPasswordMaximumLength

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPasswordMaximumLength(quality: Int): Int
```

Return the maximum password length that the device supports for a particular password quality.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always empty and this method always returns 0.

| Parameters ||
|---|---|
| `quality` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The quality being interrogated. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | Returns the maximum length that the user can enter. |

### getPasswordMinimumLength

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPasswordMinimumLength(admin: ComponentName?): Int
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Retrieve the current minimum password length for a particular admin or all admins that set restrictions on this user and its participating profiles. Restrictions on profiles that have a separate challenge are not taken into account.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve restrictions on the parent profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to aggregate all admins. |

### getPasswordMinimumLetters

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPasswordMinimumLetters(admin: ComponentName?): Int
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Retrieve the current number of letters required in the password for a particular admin or all admins that set restrictions on this user and its participating profiles. Restrictions on profiles that have a separate challenge are not taken into account. This is the same value as set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumLetters(android.content.ComponentName,%20kotlin.Int)` and only applies when the password quality is `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int`.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve restrictions on the parent profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to aggregate all admins. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The minimum number of letters required in the password. |

### getPasswordMinimumLowerCase

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPasswordMinimumLowerCase(admin: ComponentName?): Int
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Retrieve the current number of lower case letters required in the password for a particular admin or all admins that set restrictions on this user and its participating profiles. Restrictions on profiles that have a separate challenge are not taken into account. This is the same value as set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumLowerCase(android.content.ComponentName,%20kotlin.Int)` and only applies when the password quality is `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int`.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve restrictions on the parent profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to aggregate all admins. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The minimum number of lower case letters required in the password. |

### getPasswordMinimumNonLetter

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPasswordMinimumNonLetter(admin: ComponentName?): Int
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Retrieve the current number of non-letter characters required in the password for a particular admin or all admins that set restrictions on this user and its participating profiles. Restrictions on profiles that have a separate challenge are not taken into account. This is the same value as set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumNonLetter(android.content.ComponentName,%20kotlin.Int)` and only applies when the password quality is `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int`.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve restrictions on the parent profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to aggregate all admins. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The minimum number of letters required in the password. |

### getPasswordMinimumNumeric

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPasswordMinimumNumeric(admin: ComponentName?): Int
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Retrieve the current number of numerical digits required in the password for a particular admin or all admins that set restrictions on this user and its participating profiles. Restrictions on profiles that have a separate challenge are not taken into account. This is the same value as set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumNumeric(android.content.ComponentName,%20kotlin.Int)` and only applies when the password quality is `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int`.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve restrictions on the parent profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to aggregate all admins. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The minimum number of numerical digits required in the password. |

### getPasswordMinimumSymbols

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPasswordMinimumSymbols(admin: ComponentName?): Int
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Retrieve the current number of symbols required in the password for a particular admin or all admins that set restrictions on this user and its participating profiles. Restrictions on profiles that have a separate challenge are not taken into account. This is the same value as set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumSymbols(android.content.ComponentName,%20kotlin.Int)` and only applies when the password quality is `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int`.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve restrictions on the parent profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to aggregate all admins. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The minimum number of symbols required in the password. |

### getPasswordMinimumUpperCase

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPasswordMinimumUpperCase(admin: ComponentName?): Int
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Retrieve the current number of upper case letters required in the password for a particular admin or all admins that set restrictions on this user and its participating profiles. Restrictions on profiles that have a separate challenge are not taken into account. This is the same value as set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordMinimumUpperCase(android.content.ComponentName,%20kotlin.Int)` and only applies when the password quality is `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int`.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve restrictions on the parent profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to aggregate all admins. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The minimum number of upper case letters required in the password. |

### getPasswordQuality

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPasswordQuality(admin: ComponentName?): Int
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Retrieve the current minimum password quality for a particular admin or all admins that set restrictions on this user and its participating profiles. Restrictions on profiles that have a separate challenge are not taken into account.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve restrictions on the parent profile.

Note: on devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to aggregate all admins. |

### getPendingSystemUpdate

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPendingSystemUpdate(admin: ComponentName?): SystemUpdateInfo?
```

Get information about a pending system update. Can be called by device or profile owners, and starting from Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#VANILLA_ICE_CREAM:kotlin.Int`, holders of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_QUERY_SYSTEM_UPDATES:kotlin.String`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which profile or device owner this request is associated with. This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/SystemUpdateInfo?` | Information about a pending system update or `null` if no update pending. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device, profile owner or holders of `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_QUERY_SYSTEM_UPDATES:kotlin.String`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onSystemUpdatePending(android.content.Context,%20android.content.Intent,%20kotlin.Long)`

### getPermissionGrantState

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPermissionGrantState(
    admin: ComponentName?, 
    packageName: String, 
    permission: String
): Int
```

Returns the current grant state of a runtime permission for a specific application. This function can be called by a device owner, profile owner, or by a delegate given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PERMISSION_GRANT:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The application to check the grant state for. This value cannot be `null`. |
| `permission` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The permission to check for. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | the current grant state specified by device policy. If admins have not set a grant has not set a grant state, the return value is `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_DEFAULT:kotlin.Int`. This does not indicate whether or not the permission is currently granted for the package. <br /> If a grant state was set by the profile or device owner, then the return value will be one of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_DENIED:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_GRANTED:kotlin.Int`, which indicates if the permission is currently denied or granted. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_DEFAULT:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_GRANTED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_DENIED:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermissionGrantState(android.content.ComponentName,%20kotlin.String,%20kotlin.String,%20kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#checkPermission(kotlin.String,%20kotlin.String)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PERMISSION_GRANT:kotlin.String`

### getPermissionPolicy

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPermissionPolicy(admin: ComponentName!): Int
```

Returns the current runtime permission policy set by the device or profile owner. The default is `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_POLICY_PROMPT:kotlin.Int`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)!: Which profile or device owner this request is associated with. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | the current policy for future permission requests. |

### getPermittedAccessibilityServices

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPermittedAccessibilityServices(admin: ComponentName): MutableList<String!>?
```

Returns the list of permitted accessibility services set by this device or profile owner.

An empty list means no accessibility services except system services are allowed. `null` means all accessibility services are allowed.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>?` | List of accessibility service package names. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### getPermittedCrossProfileNotificationListeners

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPermittedCrossProfileNotificationListeners(admin: ComponentName): MutableList<String!>?
```

Returns the list of packages installed on the primary user that allowed to use a `https://developer.android.com/reference/kotlin/android/service/notification/NotificationListenerService.html#` to receive notifications from this managed profile, as set by the profile owner.

An empty list means no notification listener services except system ones are allowed. A `null` return value indicates that all notification listeners are allowed.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): This value cannot be `null`. |

### getPermittedInputMethods

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPermittedInputMethods(admin: ComponentName?): MutableList<String!>?
```

Returns the list of permitted input methods set by this device or profile owner.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance, returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, where the caller must be a profile owner of an organization-owned managed profile. If called on the parent instance, then the returned list of permitted input methods are those which are applied on the personal profile.

An empty list means no input methods except system input methods are allowed. Null means all input methods are allowed.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>?` | List of input method package names. This value may be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device, profile owner or if called on the parent profile and the `admin` is not a profile owner of an organization-owned managed profile. |

### getPersonalAppsSuspendedReasons

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPersonalAppsSuspendedReasons(admin: ComponentName): Int
```

Called by profile owner of an organization-owned managed profile to check whether personal apps are suspended.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | a bitmask of reasons for personal apps suspension or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERSONAL_APPS_NOT_SUSPENDED:kotlin.Int` if apps are not suspended. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERSONAL_APPS_NOT_SUSPENDED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERSONAL_APPS_SUSPENDED_EXPLICITLY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERSONAL_APPS_SUSPENDED_PROFILE_TIMEOUT:kotlin.Int` |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPersonalAppsSuspended(android.content.ComponentName,%20kotlin.Boolean)`

### getPolicy

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun <T : Any!> getPolicy(
    id: PolicyIdentifier<T>, 
    scope: Int
): T?
```

Gets the value of the given policy, as it was set by the caller.

Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getResolvedDeviceWidePolicy(android.app.admin.PolicyIdentifier)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getResolvedPerUserPolicy(android.app.admin.PolicyIdentifier)` to get the resolved policy value used on the device. Instead, this returns the value set by the caller.

| Parameters ||
|---|---|
| `<T>` | The type of the policy. |
| `id` | [PolicyIdentifier](https://developer.android.com/reference/kotlin/android/app/admin/PolicyIdentifier)\<T\>: The identifier of the policy to get. This value cannot be `null`. |
| `scope` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The scope with which the policy was set. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#POLICY_SCOPE_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#POLICY_SCOPE_DEVICE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#POLICY_SCOPE_PARENT_USER:kotlin.Int` |

| Return ||
|---|---|
| `T?` | The value of the policy, or null if the caller didn't set the policy for the given scope. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | If the caller does not have sufficient permissions to get the specified id. Check the documentation of individual identifiers for more details. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPolicy(android.app.admin.PolicyIdentifier,%20kotlin.Int,%20android.app.admin.DevicePolicyManager.setPolicy.T)`

### getPreferentialNetworkServiceConfigs

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getPreferentialNetworkServiceConfigs(): MutableList<PreferentialNetworkServiceConfig!>
```

Get preferential network configuration

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://developer.android.com/reference/kotlin/android/app/admin/PreferentialNetworkServiceConfig!>` | preferential network configuration. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not the profile owner or device owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/PreferentialNetworkServiceConfig`

### getRequiredPasswordComplexity

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getRequiredPasswordComplexity(): Int
```

Gets the password complexity requirement set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`, for the current user.

The difference between this method and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()` is that this method simply returns the value set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)` while `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordComplexity()` returns the complexity of the actual password.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to get restrictions on the parent profile.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_NONE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_LOW:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_MEDIUM:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_HIGH:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the calling application is not a device owner or a profile owner. |

### getRequiredStrongAuthTimeout

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getRequiredStrongAuthTimeout(admin: ComponentName?): Long
```

Determine for how long the user will be able to use secondary, non strong auth for authentication, since last strong method authentication (password, pin or pattern) was used. After the returned timeout the user is required to use strong authentication method.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve restrictions on the parent profile.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, 0 is returned to indicate that no timeout is configured.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to aggregate across all participating admins. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html` | The timeout in milliseconds or 0 if not configured for the provided admin. |

### getResolvedDeviceWidePolicy

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun <T : Any!> getResolvedDeviceWidePolicy(id: PolicyIdentifier<T>): T?
```

Returns the resolved value of the given device-wide policy. The resolved value is the value that is currently being enforced on the device after conflict resolution has been performed between all the policies set by all admins at all active scopes. The value can change when the current user changes or when users log in or out.

Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPolicy(android.app.admin.PolicyIdentifier,%20kotlin.Int)` to get the value set by the caller, which may differ.

Can only be applied on a `RESOURCE_DEVICE_WIDE` policy. Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getResolvedPerUserPolicy(android.app.admin.PolicyIdentifier)` for per-user policies.

Returns null when the policy is not set.

| Parameters ||
|---|---|
| `<T>` | The type of the policy. |
| `id` | [PolicyIdentifier](https://developer.android.com/reference/kotlin/android/app/admin/PolicyIdentifier)\<T\>: Which policy to retrieve. This value cannot be `null`. |

| Return ||
|---|---|
| `T?` | The resolved value of the policy. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if the policy is not a device-wide resource. |
| `java.lang.SecurityException` | If the caller does not have sufficient permissions to get the specified policy. The `QUERY_ADMIN_POLICY` permission can in most cases be used to replace the per-policy permission, but the cross-user permission is still checked. Check the documentation of individual identifiers for more details. |

### getResolvedPerUserPolicy

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun <T : Any!> getResolvedPerUserPolicy(id: PolicyIdentifier<T>): T?
```

Returns the resolved value of the given per-user policy. The resolved value is the value that is currently being enforced on the device for the context user after conflict resolution has been performed between all the policies set by all admins at all active scopes.

Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPolicy(android.app.admin.PolicyIdentifier,%20kotlin.Int)` to get the value set by the caller, which may differ.

Can only be applied on a `RESOURCE_PER_USER` policy. Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getResolvedDeviceWidePolicy(android.app.admin.PolicyIdentifier)` for device-wide policies.

Returns null when the policy is not set.

| Parameters ||
|---|---|
| `<T>` | The type of the policy. |
| `id` | [PolicyIdentifier](https://developer.android.com/reference/kotlin/android/app/admin/PolicyIdentifier)\<T\>: Which policy to retrieve. This value cannot be `null`. |

| Return ||
|---|---|
| `T?` | The resolved value of the policy. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if the policy is not a per-user resource. |
| `java.lang.SecurityException` | If the caller does not have sufficient permissions to get the specified policy. The `QUERY_ADMIN_POLICY` permission can in most cases be used to replace the per-policy permission, but the cross-user permission is still checked when querying a different user. Check the documentation of individual identifiers for more details. |

### getResources

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getResources(): DevicePolicyResourcesManager
```

Returns a `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyResourcesManager` containing the required APIs to set, reset, and get device policy related resources.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyResourcesManager` | This value cannot be `null`. |

### getScreenCaptureDisabled

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getScreenCaptureDisabled(admin: ComponentName?): Boolean
```

Determine whether or not screen capture has been disabled by the calling admin, if specified, or all admins.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance, returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, where the caller must be the profile owner of an organization-owned managed profile (the calling admin must be specified).

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check, or `null` to check whether any admins have disabled screen capture. |

### getSecondaryUsers

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getSecondaryUsers(admin: ComponentName): MutableList<UserHandle!>!
```

Called by a device owner to list all secondary users on the device. Managed profiles are not considered as secondary users.

Used for various user management APIs, including `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#switchUser(android.content.ComponentName,%20android.os.UserHandle)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#removeUser(android.content.ComponentName,%20android.os.UserHandle)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#stopUser(android.content.ComponentName,%20android.os.UserHandle)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://developer.android.com/reference/kotlin/android/os/UserHandle.html#!>!` | list of other `https://developer.android.com/reference/kotlin/android/os/UserHandle.html#`s on the device. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#removeUser(android.content.ComponentName,%20android.os.UserHandle)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#switchUser(android.content.ComponentName,%20android.os.UserHandle)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#startUserInBackground(android.content.ComponentName,%20android.os.UserHandle)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#stopUser(android.content.ComponentName,%20android.os.UserHandle)`

### getShortSupportMessage

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getShortSupportMessage(admin: ComponentName?): CharSequence!
```

Called by a device admin or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_SUPPORT_MESSAGE:kotlin.String` to get the short support message.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!` | The message set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setShortSupportMessage(android.content.ComponentName,%20kotlin.CharSequence)` or null if no message has been set. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not an active administrator and not a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_SUPPORT_MESSAGE:kotlin.String`.. |

### getStartUserSessionMessage

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getStartUserSessionMessage(admin: ComponentName): CharSequence!
```

Returns the user session start message.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

### getStorageEncryption

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getStorageEncryption(admin: ComponentName?): Boolean
```

**Deprecated:** *This method only returns the value set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStorageEncryption(android.content.ComponentName,%20kotlin.Boolean)`. It does not actually reflect the storage encryption status. Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()` for that. Called by an application that is administering the device to determine the requested setting for secure storage.*

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. If null, this will return the requested encryption setting as an aggregate of all active administrators. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | true if the admin(s) are requesting encryption, false if not. |

### getStorageEncryptionStatus

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getStorageEncryptionStatus(): Int
```

Called by an application that is administering the device to determine the current encryption status of the device.

Depending on the returned status code, the caller may proceed in different ways. If the result is `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_UNSUPPORTED:kotlin.Int`, the storage system does not support encryption. If the result is `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_INACTIVE:kotlin.Int`, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_START_ENCRYPTION:kotlin.String` to begin the process of encrypting or decrypting the storage. If the result is `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE_DEFAULT_KEY:kotlin.Int`, the storage system has enabled encryption but no password is set so further action may be required. If the result is `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVATING:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE_PER_USER:kotlin.Int`, no further action is required.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | current status of encryption. The value will be one of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_UNSUPPORTED:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_INACTIVE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVATING:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE_DEFAULT_KEY:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE:kotlin.Int`, or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE_PER_USER:kotlin.Int`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if called on a parent instance. |

### getSubscriptionIds

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getSubscriptionIds(): MutableSet<Int!>
```

Returns the subscription ids of all subscriptions which were downloaded by the calling admin.

This returns only the subscriptions which were downloaded by the calling admin via `https://developer.android.com/reference/kotlin/android/telephony/euicc/EuiccManager.html#downloadSubscription(android.telephony.euicc.DownloadableSubscription,%20kotlin.Boolean,%20android.app.PendingIntent)`. If a subscription is returned by this method then in it subject to management controls and cannot be removed by users.

Callable by device owners and profile owners.   
Requires `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS:kotlin.String`

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html!>` | ids of all managed subscriptions currently downloaded by an admin on the device. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not authorized to call this method. |

### getSystemUpdatePolicy

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getSystemUpdatePolicy(): SystemUpdatePolicy?
```

Retrieve a local system update policy set previously by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setSystemUpdatePolicy(android.content.ComponentName,%20android.app.admin.SystemUpdatePolicy)`.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/SystemUpdatePolicy?` | The current policy object, or `null` if no policy is set. |

### getTransferOwnershipBundle

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getTransferOwnershipBundle(): PersistableBundle?
```

Returns the data passed from the current administrator to the new administrator during an ownership transfer. This is the same `bundle` passed in `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#transferOwnership(android.content.ComponentName,%20android.content.ComponentName,%20android.os.PersistableBundle)`. The bundle is persisted until the profile owner or device owner is removed.

This is the same `bundle` received in the `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onTransferOwnershipComplete(android.content.Context,%20android.os.PersistableBundle)`. Use this method to retrieve it after the transfer as long as the new administrator is the active device or profile owner.

Returns `null` if no ownership transfer was started for the calling user.

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not a device or profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#transferOwnership(android.content.ComponentName,%20android.content.ComponentName,%20android.os.PersistableBundle)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onTransferOwnershipComplete(android.content.Context,%20android.os.PersistableBundle)`

### getTrustAgentConfiguration

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getTrustAgentConfiguration(
    admin: ComponentName?, 
    agent: ComponentName
): MutableList<PersistableBundle!>?
```

Gets configuration for the given trust agent based on aggregating all calls to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setTrustAgentConfiguration(android.content.ComponentName,%20android.content.ComponentName,%20android.os.PersistableBundle)` for all device admins.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to retrieve the configuration set on the parent profile.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, null is always returned.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. If null, this function returns a list of configurations for all admins that declare `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_TRUST_AGENTS:kotlin.Int`. If any admin declares `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_TRUST_AGENTS:kotlin.Int` but doesn't call `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setTrustAgentConfiguration(android.content.ComponentName,%20android.content.ComponentName,%20android.os.PersistableBundle)` for this `agent` or calls it with a null configuration, null is returned. |
| `agent` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which component to get enabled features for. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#!>?` | configuration for the given trust agent. |

### getUserControlDisabledPackages

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getUserControlDisabledPackages(admin: ComponentName?): MutableList<String!>
```

Returns the list of packages over which user control is disabled by a device or profile owner or holders of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_APPS_CONTROL:kotlin.String`.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, the returned policy will be the current resolved policy rather than the policy set by the calling admin.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>` | This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_APPS_CONTROL:kotlin.String`. |

### getUserRestrictions

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getUserRestrictions(admin: ComponentName): Bundle
```

Called by an admin to get user restrictions set by themselves with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addUserRestriction(android.content.ComponentName,%20kotlin.String)`.

The target user may have more restrictions set by the system or other admin. To get all the user restrictions currently set, use `https://developer.android.com/reference/kotlin/android/os/UserManager.html#getUserRestrictions()`.

The profile owner of an organization-owned managed profile may invoke this method on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance it obtained from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, for retrieving device-wide restrictions it previously set with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addUserRestriction(android.content.ComponentName,%20kotlin.String)`.

For callers targeting Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` or above, this API will return the local restrictions set on the calling user, or on the parent profile if called from the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance obtained from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`. To get global restrictions set by admin, call `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getUserRestrictionsGlobally()` instead.

Note that this is different that the returned restrictions for callers targeting pre Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, were this API returns all local/global restrictions set by the admin on the calling user using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addUserRestriction(android.content.ComponentName,%20kotlin.String)` or the parent user if called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance it obtained from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` | a `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` whose keys are the user restrictions, and the values a `boolean` indicating whether the restriction is set. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### getUserRestrictionsGlobally

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getUserRestrictionsGlobally(): Bundle
```

Called by a profile or device owner to get global user restrictions set with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addUserRestrictionGlobally(kotlin.String)`.

To get all the user restrictions currently set for a certain user, use `https://developer.android.com/reference/kotlin/android/os/UserManager.html#getUserRestrictions()`.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` | a `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` whose keys are the user restrictions, and the values a `boolean` indicating whether the restriction is set. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if caller is not targeting Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` or above. |
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### getWifiMacAddress

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getWifiMacAddress(admin: ComponentName?): String?
```

Gets the MAC address of the Wi-Fi device.

The caller must be a device owner, a profile owner on an organization-owned device, or hold the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_DEVICE_IDENTIFIERS:kotlin.String` permission. NOTE: The MAC address returned here should only be used for inventory management and is not likely to be the MAC address used by the device to connect to Wi-Fi networks: MAC addresses used for scanning and connecting to Wi-Fi networks are randomized by default. To get the randomized MAC address used, call `https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration.html#getRandomizedMacAddress()`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which admin this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` | the MAC address of the Wi-Fi device, or null when the information is not available. (For example, Wi-Fi hasn't been enabled, or the device doesn't support Wi-Fi.) The address will be in the `XX:XX:XX:XX:XX:XX` format. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not a device owner or a profile owner on an organization-owned device, and does not hold the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_DEVICE_IDENTIFIERS:kotlin.String` permission. |

### getWifiSsidPolicy

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getWifiSsidPolicy(): WifiSsidPolicy?
```

Returns the current Wi-Fi SSID policy. If the policy has not been set, it will return NULL.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/WifiSsidPolicy?` | This value may be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not a device owner or a profile owner on an organization-owned managed profile. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setWifiSsidPolicy(android.app.admin.WifiSsidPolicy)`

### grantKeyPairToApp

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun grantKeyPairToApp(
    admin: ComponentName?, 
    alias: String, 
    packageName: String
): Boolean
```

Called by a device or profile owner, or delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), to grant an application access to an already-installed (or generated) KeyChain key. This is useful (in combination with #installKeyPair or #generateKeyPair) to let an application call `https://developer.android.com/reference/kotlin/android/security/KeyChain.html#getPrivateKey(android.content.Context,%20kotlin.String)` without having to call android.security.KeyChain#choosePrivateKeyAlias first. The grantee app will receive the `https://developer.android.com/reference/kotlin/android/security/KeyChain.html#ACTION_KEY_ACCESS_CHANGED:kotlin.String` broadcast when access to a key is granted. Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` throws an `https://developer.android.com/reference/kotlin/java/lang/IllegalArgumentException.html#` if `alias` doesn't correspond to an existing key.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if calling from a delegated certificate chooser. |
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias of the key to grant access to. This value cannot be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The name of the (already installed) package to grant access to. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the grant was set successfully, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if `packageName` or `alias` are empty. |
| `java.lang.IllegalStateException` | if `packageName` is not a name of an installed package. |
| `java.lang.SecurityException` | if the caller is not a device owner, a profile owner or delegated certificate chooser. |

**See Also**

### grantKeyPairToApp

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun grantKeyPairToApp(
    alias: String, 
    packageName: String, 
    scope: Int
): Boolean
```

Called by a device or profile owner, delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), or permission caller, to grant an application access to an already-installed (or generated) KeyChain key in the specified scope. This is useful (in combination with #installKeyPair or #generateKeyPair) to let an application call `https://developer.android.com/reference/kotlin/android/security/KeyChain.html#getPrivateKey(android.content.Context,%20kotlin.String)` without having to call android.security.KeyChain#choosePrivateKeyAlias first.

| Parameters ||
|---|---|
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias of the key to grant access to. This value cannot be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The name of the (already installed) package to grant access to. This value cannot be `null`. |
| `scope` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The scope of the key pair: `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int` |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the grant was set successfully, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if `packageName` or `alias` are empty. |
| `java.lang.IllegalStateException` | if `KEYPAIR_SCOPE_DEVICE` is requested by a non-affiliated user, or if `packageName` is not a name of an installed package. |
| `java.lang.SecurityException` | if the caller is not a device owner, a profile owner, delegated certificate chooser, or permission caller. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#grantKeyPairToApp(android.content.ComponentName,%20kotlin.String,%20kotlin.String)`

### grantKeyPairToWifiAuth

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun grantKeyPairToWifiAuth(alias: String): Boolean
```

Called by a device or profile owner, or delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), to allow using a KeyChain key pair for authentication to Wifi networks. The key can then be used in configurations passed to `https://developer.android.com/reference/kotlin/android/net/wifi/WifiManager.html#addNetwork(android.net.wifi.WifiConfiguration)`. Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` throws an `https://developer.android.com/reference/kotlin/java/lang/IllegalArgumentException.html#` if `alias` doesn't correspond to an existing key.

| Parameters ||
|---|---|
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias of the key pair. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the operation was set successfully, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not a device owner, a profile owner or delegated certificate chooser. |

**See Also**

### grantKeyPairToWifiAuth

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun grantKeyPairToWifiAuth(
    alias: String, 
    scope: Int
): Boolean
```

Called by a device or profile owner, delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), or permission caller, to allow using a KeyChain key pair of the specified scope for authentication to Wifi networks. The key can then be used in configurations passed to `https://developer.android.com/reference/kotlin/android/net/wifi/WifiManager.html#addNetwork(android.net.wifi.WifiConfiguration)`.

| Parameters ||
|---|---|
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias of the key pair. This value cannot be `null`. |
| `scope` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The scope of the key pair: `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int` |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the operation was set successfully, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if `KEYPAIR_SCOPE_DEVICE` is requested by a non-affiliated user. |
| `java.lang.SecurityException` | if the caller is not a device owner, a profile owner, delegated certificate chooser, or permission caller. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#grantKeyPairToWifiAuth(kotlin.String)`

### hasCaCertInstalled

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun hasCaCertInstalled(
    admin: ComponentName?, 
    certBuffer: ByteArray!
): Boolean
```

Returns whether this certificate is installed as a trusted CA.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if calling from a delegated certificate installer. |
| `certBuffer` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!: encoded form of the certificate to look up. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not `null` and not a device or profile owner. |

### hasGrantedPolicy

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun hasGrantedPolicy(
    admin: ComponentName, 
    usesPolicy: Int
): Boolean
```

Returns true if an administrator has been granted a particular device policy. This can be used to check whether the administrator was activated under an earlier set of policies, but requires additional policies after an upgrade.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Must be an active administrator, or an exception will be thrown. This value cannot be `null`. |
| `usesPolicy` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Which uses-policy to check, as defined in `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not an active administrator. |

### hasKeyPair

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun hasKeyPair(alias: String): Boolean
```

This API can be called by the following to query whether a certificate and private key are installed under a given alias:

- Device owner
- Profile owner
- Delegated certificate installer
- Credential management app
- An app that holds the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission

If called by the credential management app, the alias must exist in the credential management app's `https://developer.android.com/reference/kotlin/android/security/AppUriAuthenticationPolicy.html#`.

<br />

| Parameters ||
|---|---|
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias under which the key pair is installed. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if a key pair with this alias exists, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not a device or profile owner, a delegated certificate installer, the credential management app and does not have the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_INSTALL:kotlin.String`

### hasKeyPair

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun hasKeyPair(
    alias: String, 
    scope: Int
): Boolean
```

This API can be called by the following to query whether a certificate and private key are installed under a given alias for the specified scope:

- Device owner
- Profile owner
- Delegated certificate installer
- Credential management app (user-specific keychain only)
- An app that holds the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission

<br />

This method extends #hasKeyPair(android.content.ComponentName,java.lang.String), adding the `scope` parameter to determine if the key pair exists in the user-specific or device-wide keychain. The calling application must hold the same permission requirements as the base method.

Key differences in this overload:

- Using `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`: The key pair will be searched in the device-wide keychain. The caller MUST be running in an affiliated user to manage device keys. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`. Credential management apps are not permitted to use this scope.
- Using `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int`: The key pair is searched in the calling user's own keychain. This mirrors the behavior of the base `hasKeyPair` method.

| Parameters ||
|---|---|
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias under which the key pair is installed. This value cannot be `null`. |
| `scope` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The scope of the key pair: `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int` |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if a key pair with this alias exists, `false` otherwise. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#hasKeyPair(kotlin.String)`

### hasLockdownAdminConfiguredNetworks

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun hasLockdownAdminConfiguredNetworks(admin: ComponentName?): Boolean
```

Called by a device owner or a profile owner of an organization-owned managed profile to determine whether the user is prevented from modifying networks configured by the admin.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: admin Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value may be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device owner or a profile owner of an organization-owned managed profile. |

### installCaCert

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun installCaCert(
    admin: ComponentName?, 
    certBuffer: ByteArray!
): Boolean
```

Installs the given certificate as a user CA.

Inserted user CAs aren't automatically trusted by apps in Android 7.0 (API level 24) and higher. App developers can change the default behavior for an app by adding a [Security Configuration File](https://developer.android.com/training/articles/security-config.html) to the app manifest file. The caller must be a profile or device owner on that user, or a delegate package given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_INSTALL:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`; otherwise a security exception will be thrown.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if calling from a delegated certificate installer. |
| `certBuffer` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!: encoded form of the certificate to install. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | false if the certBuffer cannot be parsed or installation is interrupted, true otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not `null` and not a device or profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_INSTALL:kotlin.String`

### installExistingPackage

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun installExistingPackage(
    admin: ComponentName, 
    packageName: String!
): Boolean
```

Install an existing package that has been installed in another user, or has been kept after removal via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setKeepUninstalledPackages(android.content.ComponentName,%20kotlin.collections.MutableList)`. This function can be called by a device owner, profile owner or a delegate given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_INSTALL_EXISTING_PACKAGE:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`. When called in a secondary user or managed profile, the user/profile must be affiliated with the device. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The package to be installed in the calling profile. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the app is installed; `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not the device owner, or the profile owner of an affiliated user or profile. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setKeepUninstalledPackages(android.content.ComponentName,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PACKAGE_ACCESS:kotlin.String`

### installKeyPair

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun installKeyPair(
    admin: ComponentName?, 
    privKey: PrivateKey, 
    cert: Certificate, 
    alias: String
): Boolean
```

This API can be called by the following to install a certificate and corresponding private key:

- Device owner
- Profile owner
- Delegated certificate installer
- Credential management app
- An app that holds the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission

All apps within the profile will be able to access the certificate and use the private key, given direct user approval.

<br />

From Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int`, the credential management app can call this API. However, this API sets the key pair as user selectable by default, which is not permitted when called by the credential management app. Instead, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installKeyPair(android.content.ComponentName,%20java.security.PrivateKey,%20kotlin.Array,%20kotlin.String,%20kotlin.Int)` should be called with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#INSTALLKEY_SET_USER_SELECTABLE:kotlin.Int` not set as a flag.

Access to the installed credentials will not be granted to the caller of this API without direct user approval. This is for security - should a certificate installer become compromised, certificates it had already installed will be protected.

If the installer must have access to the credentials, call `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installKeyPair(android.content.ComponentName,%20java.security.PrivateKey,%20kotlin.Array,%20kotlin.String,%20kotlin.Boolean)` instead.

Note: If the provided `alias` is of an existing alias, all former grants that apps have been given to access the key and certificates associated with this alias will be revoked.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if the caller is not a device admin. |
| `privKey` | [PrivateKey](https://developer.android.com/reference/kotlin/java/security/PrivateKey.html#): The private key to install. This value cannot be `null`. |
| `cert` | [Certificate](https://developer.android.com/reference/kotlin/java/security/cert/Certificate.html#): The certificate to install. This value cannot be `null`. |
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The private key alias under which to install the certificate. If a certificate with that alias already exists, it will be overwritten. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the keys were installed, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not `null` and not a device or profile owner, or `admin` is null and the calling application does not have the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_INSTALL:kotlin.String`

### installKeyPair

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun installKeyPair(
    admin: ComponentName?, 
    privKey: PrivateKey, 
    certs: Array<Certificate!>, 
    alias: String, 
    requestAccess: Boolean
): Boolean
```

This API can be called by the following to install a certificate chain and corresponding private key for the leaf certificate:

- Device owner
- Profile owner
- Delegated certificate installer
- Credential management app
- An app that holds the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission

All apps within the profile will be able to access the certificate chain and use the private key, given direct user approval.

<br />

From Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int`, the credential management app can call this API. However, this API sets the key pair as user selectable by default, which is not permitted when called by the credential management app. Instead, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installKeyPair(android.content.ComponentName,%20java.security.PrivateKey,%20kotlin.Array,%20kotlin.String,%20kotlin.Int)` should be called with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#INSTALLKEY_SET_USER_SELECTABLE:kotlin.Int` not set as a flag. Note, there can only be a credential management app on an unmanaged device.

The caller of this API may grant itself access to the certificate and private key immediately, without user approval. It is a best practice not to request this unless strictly necessary since it opens up additional security vulnerabilities.

Note: If the provided `alias` is of an existing alias, all former grants that apps have been given to access the key and certificates associated with this alias will be revoked.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if the caller is not a device admin. |
| `privKey` | [PrivateKey](https://developer.android.com/reference/kotlin/java/security/PrivateKey.html#): The private key to install. This value cannot be `null`. |
| `certs` | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[Certificate](https://developer.android.com/reference/kotlin/java/security/cert/Certificate.html#)!\>: The certificate chain to install. The chain should start with the leaf certificate and include the chain of trust in order. This will be returned by `https://developer.android.com/reference/kotlin/android/security/KeyChain.html#getCertificateChain(android.content.Context,%20kotlin.String)`. This value cannot be `null`. |
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The private key alias under which to install the certificate. If a certificate with that alias already exists, it will be overwritten. This value cannot be `null`. |
| `requestAccess` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): `true` to request that the calling app be granted access to the credentials immediately. Otherwise, access to the credentials will be gated by user approval. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the keys were installed, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not `null` and not a device or profile owner, or `admin` is null and the calling application does not have the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/security/KeyChain.html#getCertificateChain(android.content.Context,%20kotlin.String)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_INSTALL:kotlin.String`

### installKeyPair

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun installKeyPair(
    admin: ComponentName?, 
    privKey: PrivateKey, 
    certs: Array<Certificate!>, 
    alias: String, 
    flags: Int
): Boolean
```

This API can be called by the following to install a certificate chain and corresponding private key for the leaf certificate:

- Device owner
- Profile owner
- Delegated certificate installer
- Credential management app
- An app that holds the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission

All apps within the profile will be able to access the certificate chain and use the private key, given direct user approval (if the user is allowed to select the private key).

<br />

From Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int`, the credential management app can call this API. If called by the credential management app:

- The componentName must be `null`r
- The alias must exist in the credential management app's `https://developer.android.com/reference/kotlin/android/security/AppUriAuthenticationPolicy.html#`
- The key pair must not be user selectable

Note, there can only be a credential management app on an unmanaged device.

The caller of this API may grant itself access to the certificate and private key immediately, without user approval. It is a best practice not to request this unless strictly necessary since it opens up additional security vulnerabilities.

Include `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#INSTALLKEY_SET_USER_SELECTABLE:kotlin.Int` in the `flags` argument to allow the user to select the key from a dialog.

Note: If the provided `alias` is of an existing alias, all former grants that apps have been given to access the key and certificates associated with this alias will be revoked.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if the caller is not a device admin. |
| `privKey` | [PrivateKey](https://developer.android.com/reference/kotlin/java/security/PrivateKey.html#): The private key to install. This value cannot be `null`. |
| `certs` | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[Certificate](https://developer.android.com/reference/kotlin/java/security/cert/Certificate.html#)!\>: The certificate chain to install. The chain should start with the leaf certificate and include the chain of trust in order. This will be returned by `https://developer.android.com/reference/kotlin/android/security/KeyChain.html#getCertificateChain(android.content.Context,%20kotlin.String)`. This value cannot be `null`. |
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The private key alias under which to install the certificate. If a certificate with that alias already exists, it will be overwritten. This value cannot be `null`. |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Flags to request that the calling app be granted access to the credentials and set the key to be user-selectable. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#INSTALLKEY_SET_USER_SELECTABLE:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#INSTALLKEY_REQUEST_CREDENTIALS_ACCESS:kotlin.Int`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the keys were installed, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not `null` and not a device or profile owner, or `admin` is null but the calling application is not a delegated certificate installer, credential management app and does not have the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CERTIFICATES:kotlin.String` permission. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/security/KeyChain.html#getCertificateChain(android.content.Context,%20kotlin.String)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_INSTALL:kotlin.String`

### installSystemUpdate

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun installSystemUpdate(
    admin: ComponentName?, 
    updateFilePath: Uri, 
    executor: Executor, 
    callback: DevicePolicyManager.InstallSystemUpdateCallback
): Unit
```

Called by device owner or profile owner of an organization-owned managed profile to install a system update from the given file. The device will be rebooted in order to finish installing the update. Note that if the device is rebooted, this doesn't necessarily mean that the update has been applied successfully. The caller should additionally check the system version with `https://developer.android.com/reference/kotlin/android/os/Build.html#FINGERPRINT:kotlin.String` or `https://developer.android.com/reference/kotlin/android/os/Build.VERSION.html#`. If an error occurs during processing the OTA before the reboot, the caller will be notified by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager.InstallSystemUpdateCallback`. If device does not have sufficient battery level, the installation will fail with error `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager.InstallSystemUpdateCallback#UPDATE_ERROR_BATTERY_LOW:kotlin.Int`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` that this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `updateFilePath` | [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#): A Uri of the file that contains the update. The file should be readable by the calling app. This value cannot be `null`. |
| `executor` | [Executor](https://developer.android.com/reference/kotlin/java/util/concurrent/Executor.html#): The executor through which the callback should be invoked. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/kotlin/java/util/concurrent/Executor.html#`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/kotlin/android/content/Context.html#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/kotlin/java/util/concurrent/Executor.html#` that dispatches to an appropriate thread. |
| `callback` | [DevicePolicyManager.InstallSystemUpdateCallback](https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager.InstallSystemUpdateCallback): A callback object that will inform the caller when installing an update fails. This value cannot be `null`. |

### isActivePasswordSufficient

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isActivePasswordSufficient(): Boolean
```

Determines whether the calling user's current password meets policy requirements (e.g. quality, minimum length). The user must be unlocked to perform this check.

Policy requirements which affect this check can be set by admins of the user, but also by the admin of a managed profile associated with the calling user (when the managed profile doesn't have a separate work challenge). When a managed profile has a separate work challenge, its policy requirements only affect the managed profile.

Depending on the user, this method checks the policy requirement against one of the following passwords:

- For the primary user or secondary users: the personal keyguard password.
- For managed profiles: a work challenge if set, otherwise the parent user's personal keyguard password.

  In other words, it's always checking the requirement against the password that is protecting the calling user.

  Note that this method considers all policy requirements targeting the password in question. For example a profile owner might set a requirement on the parent profile i.e. personal keyguard but not on the profile itself. When the device has a weak personal keyguard password and no separate work challenge, calling this method will return `false` despite the profile owner not setting a policy on the profile itself. This is because the profile's current password is the personal keyguard password, and it does not meet all policy requirements.

  Device admins must request `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` before calling this method. Note, this policy type is deprecated for device admins in Android 9.0 (API level 28) or higher.

  This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to determine if the password set on the parent profile is sufficient.

  On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty - i.e. this method will always return false on such devices, provided any password requirements were set.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the password meets the policy requirements, `false` otherwise |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the user isn't unlocked |
| `java.lang.SecurityException` | if the calling application isn't an active admin that uses `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` |

### isActivePasswordSufficientForDeviceRequirement

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isActivePasswordSufficientForDeviceRequirement(): Boolean
```

Called by profile owner of a managed profile to determine whether the current device password meets policy requirements set explicitly device-wide.

This API is similar to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isActivePasswordSufficient()`, with two notable differences:

- this API always targets the device password. As a result it should always be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` instance.
- password policy requirement set on the managed profile is not taken into consideration by this API, even if the device currently does not have a separate work challenge set.

This API is designed to facilite progressive password enrollment flows when the DPC imposes both device and profile password policies. DPC applies profile password policy by calling `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)` on the regular `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance, while it applies device-wide policy by calling `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)` on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` instance. The DPC can utilize this check to guide the user to set a device password first taking into consideration the device-wide policy only, and then prompt the user to either upgrade it to be fully compliant, or enroll a separate work challenge to satisfy the profile password policy only.

The device user must be unlocked (@link `https://developer.android.com/reference/kotlin/android/os/UserManager.html#isUserUnlocked(android.os.UserHandle)`) to perform this check.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the device password meets explicit requirement set on it, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the user isn't unlocked |
| `java.lang.SecurityException` | if the calling application is not a profile owner of a managed profile, or if this API is not called on the parent DevicePolicyManager instance. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_DEVICE_PASSWORD_REQUIREMENT_ONLY:kotlin.String`

### isAdminActive

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isAdminActive(admin: ComponentName): Boolean
```

Return true if the given administrator component is currently active (enabled) in the system.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): The administrator component to check for. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if `admin` is currently enabled in the system, `false` otherwise |

### isAffiliatedUser

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isAffiliatedUser(): Boolean
```

Returns whether this user is affiliated with the device.

By definition, the user that the device owner runs on is always affiliated with the device. Any other user is considered affiliated with the device if the set specified by its profile owner via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)` intersects with the device owner's.
**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)`

### isAlwaysOnVpnLockdownEnabled

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isAlwaysOnVpnLockdownEnabled(admin: ComponentName): Boolean
```

Called by device or profile owner to query whether current always-on VPN is configured in lockdown mode. Returns `false` when no always-on configuration is set.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or a profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAlwaysOnVpnPackage(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)`

### isApplicationHidden

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isApplicationHidden(
    admin: ComponentName?, 
    packageName: String!
): Boolean
```

Determine if a package is hidden. This function can be called by a device owner, profile owner, or by a delegate given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PACKAGE_ACCESS:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance, returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, where the caller must be the profile owner of an organization-owned managed profile and the package must be a system package. If called on the parent instance, this will determine whether the package is hidden or unhidden in the personal profile.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, the returned policy will be the current resolved policy rather than the policy set by the calling admin.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if the caller is not a device admin. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The name of the package to retrieve the hidden status of. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | boolean `true` if the package is hidden, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if called on the parent profile and the package provided is not a system package. |
| `java.lang.SecurityException` | if `admin` is not a device or profile owner or if called on the parent profile and the `admin` is not a profile owner of an organization-owned managed profile. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PACKAGE_ACCESS:kotlin.String`

### isBackupServiceEnabled

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isBackupServiceEnabled(admin: ComponentName): Boolean
```

Return whether the backup service is enabled by the device owner or profile owner for the current user, as previously set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setBackupServiceEnabled(android.content.ComponentName,%20kotlin.Boolean)`.

Whether the backup functionality is actually enabled or not depends on settings from both the current user and the device owner, please see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setBackupServiceEnabled(android.content.ComponentName,%20kotlin.Boolean)` for details.

Backup service manages all backup and restore mechanisms on the device.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if backup service is enabled, `false` otherwise. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setBackupServiceEnabled(android.content.ComponentName,%20kotlin.Boolean)`

### isCallerApplicationRestrictionsManagingPackage

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isCallerApplicationRestrictionsManagingPackage(): Boolean
```

**Deprecated:** *From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#O:kotlin.Int`. Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getDelegatedScopes(android.content.ComponentName,%20kotlin.String)` instead.*

Called by any application to find out whether it has been granted permission via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setApplicationRestrictionsManagingPackage(android.content.ComponentName,%20kotlin.String)` to manage application restrictions for the calling user.

This is done by comparing the calling Linux uid with the uid of the package specified by that method.

### isCommonCriteriaModeEnabled

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isCommonCriteriaModeEnabled(admin: ComponentName?): Boolean
```

Returns whether Common Criteria mode is currently enabled. Device owner and profile owner of an organization-owned managed profile can query its own Common Criteria mode setting by calling this method with its admin `https://developer.android.com/reference/kotlin/android/content/ComponentName.html#`. Any caller can obtain the aggregated device-wide Common Criteria mode state by passing `null` as the `admin` argument.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if Common Criteria mode is enabled, `false` otherwise. |

### isComplianceAcknowledgementRequired

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isComplianceAcknowledgementRequired(): Boolean
```

Called by a profile owner of an organization-owned managed profile to query whether it needs to acknowledge device compliance to allow the user to turn the profile off if needed according to the maximum profile time off policy. Normally when acknowledgement is needed the DPC gets a `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onComplianceAcknowledgementRequired(android.content.Context,%20android.content.Intent)` callback. But if the callback was not delivered or handled for some reason, this method can be used to verify if acknowledgement is needed.

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the user isn't unlocked |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#acknowledgeDeviceCompliant()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedProfileMaximumTimeOff(android.content.ComponentName,%20kotlin.Long)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onComplianceAcknowledgementRequired(android.content.Context,%20android.content.Intent)`

### isDeviceFinanced

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isDeviceFinanced(): Boolean
```

Returns `true` if this device is marked as a financed device.

A financed device can be entered into lock task mode (see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskPackages(android.content.ComponentName,%20kotlin.Array)`) by the holder of the role `android.app.role.RoleManager#ROLE_FINANCED_DEVICE_KIOSK`. If this occurs, Device Owners and Profile Owners that have set lock task packages or features, or that attempt to set lock task packages or features, will receive a callback indicating that it could not be set. See `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` and `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)`.

To be informed of changes to this status you can subscribe to the broadcast `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_DEVICE_FINANCING_STATE_CHANGED:kotlin.String`.

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not a device owner, profile owner of an organization-owned managed profile, profile owner on the primary user or holder of one of the following roles: `android.app.role.RoleManager.ROLE_DEVICE_POLICY_MANAGEMENT`, `android.app.role.RoleManager.ROLE_SYSTEM_SUPERVISION`. |

### isDeviceIdAttestationSupported

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isDeviceIdAttestationSupported(): Boolean
```

Returns `true` if the device supports attestation of device identifiers in addition to key attestation. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#generateKeyPair(android.content.ComponentName,%20kotlin.String,%20android.security.keystore.KeyGenParameterSpec,%20kotlin.Int)`

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if Device ID attestation is supported. |

### isDeviceOwnerApp

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isDeviceOwnerApp(packageName: String!): Boolean
```

Used to determine if a particular package has been registered as a Device Owner app. A device owner app is a special device admin that cannot be deactivated by the user, once activated as a device admin. It also cannot be uninstalled. To check whether a particular package is currently registered as the device owner app, pass in the package name from `https://developer.android.com/reference/kotlin/android/content/Context.html#getPackageName()` to this method.

<br />

This is useful for device admin apps that want to check whether they are also registered as the device owner app. The exact mechanism by which a device admin app is registered as a device owner app is defined by the setup process.

| Parameters ||
|---|---|
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the package name of the app, to compare with the registered device owner app, if any. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | whether or not the package is registered as the device owner app. |

### isEphemeralUser

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isEphemeralUser(admin: ComponentName): Boolean
```

Checks if the profile owner is running in an ephemeral user.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | whether the profile owner is running in an ephemeral user. |

### isKeyPairGrantedToWifiAuth

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isKeyPairGrantedToWifiAuth(alias: String): Boolean
```

Called by a device or profile owner, or delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), to query whether a KeyChain key pair can be used for authentication to Wifi networks.

| Parameters ||
|---|---|
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias of the key pair. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the key pair can be used, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if `alias` does not correspond to an existing key |
| `java.lang.SecurityException` | if the caller is not a device owner, a profile owner or delegated certificate chooser. |

**See Also**

### isKeyPairGrantedToWifiAuth

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isKeyPairGrantedToWifiAuth(
    alias: String, 
    scope: Int
): Boolean
```

Called by a device or profile owner, delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), or permission caller, to query whether a KeyChain key pair of the specified scope can be used for authentication to Wifi networks.

| Parameters ||
|---|---|
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias of the key pair. This value cannot be `null`. |
| `scope` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The scope of the key pair: `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int` |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the key pair can be used, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if `KEYPAIR_SCOPE_DEVICE` is requested by a non-affiliated user. |
| `java.lang.SecurityException` | if the caller is not a device owner, a profile owner, delegated certificate chooser, or permission caller. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#grantKeyPairToWifiAuth(kotlin.String,%20kotlin.Int)`

### isLockTaskPermitted

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isLockTaskPermitted(pkg: String!): Boolean
```

This function lets the caller know whether the given component is allowed to start the lock task mode.

| Parameters ||
|---|---|
| `pkg` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The package to check |

### isLogoutEnabled

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isLogoutEnabled(): Boolean
```

Returns whether logout is enabled by a device owner.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if logout is enabled by device owner, `false` otherwise. |

### isManagedProfile

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isManagedProfile(admin: ComponentName): Boolean
```

Return if this user is a managed profile of another user. An admin can become the profile owner of a managed profile with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE:kotlin.String` and of a managed user with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#createAndManageUser(android.content.ComponentName,%20kotlin.String,%20android.content.ComponentName,%20android.os.PersistableBundle,%20kotlin.Int)`

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which profile owner this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | if this user is a managed profile of another user. |

### isMasterVolumeMuted

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isMasterVolumeMuted(admin: ComponentName): Boolean
```

Called by profile or device owners to check whether the global volume mute is on or off.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if global volume is muted, `false` if it's not. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### isMtePolicyEnforced

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open static fun isMtePolicyEnforced(): Boolean
```

Get the current MTE state of the device. [Learn more about MTE](https://source.android.com/docs/security/test/memory-safety/arm-mte)

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | whether MTE is currently enabled on the device. |

### isNetworkLoggingEnabled

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isNetworkLoggingEnabled(admin: ComponentName?): Boolean
```

Return whether network logging is enabled by a device owner or profile owner of a managed profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Can only be `null` if the caller is a delegated app with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_NETWORK_LOGGING:kotlin.String` or has MANAGE_USERS permission. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if network logging is enabled by device owner or profile owner, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner or profile owner and caller has no MANAGE_USERS permission |

### isOrganizationOwnedDeviceWithManagedProfile

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isOrganizationOwnedDeviceWithManagedProfile(): Boolean
```

Apps can use this method to find out if the device was provisioned as organization-owend device with a managed profile. This, together with checking whether the device has a device owner (by calling `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isDeviceOwnerApp(kotlin.String)`), could be used to learn whether the device is owned by an organization or an individual: If this method returns true OR `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isDeviceOwnerApp(kotlin.String)` returns true (for any package), then the device is owned by an organization. Otherwise, it's owned by an individual.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the device was provisioned as organization-owned device, `false` otherwise. |

### isOutgoingEsimTransferAllowed

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isOutgoingEsimTransferAllowed(subscriptionId: Int): Boolean
```

Returns whether an outgoing eSIM transfer is allowed for a specific subscription.

An eSIM transfer is disallowed if the subscription is a managed subscription and the transfer is disallowed by policy. For non-managed subscriptions or physical SIMs (pSIMs), this method will always return `true`.

| Parameters ||
|---|---|
| `subscriptionId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The ID of the subscription to check. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the eSIM transfer is allowed, or if the subscription is not managed or is a pSIM. Returns `false` if the subscription is a managed eSIM and the transfer is disallowed by policy. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if the provided `subscriptionId` is unknown. |
| `java.lang.SecurityException` | if the caller has neither MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS nor WRITE_EMBEDDED_SUBSCRIPTIONS and is not a device owner or a profile owner. |

### isOverrideApnEnabled

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isOverrideApnEnabled(admin: ComponentName): Boolean
```

Called by device owner to check if override APNs are currently enabled.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if override APNs are currently enabled, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setOverrideApnsEnabled(android.content.ComponentName,%20kotlin.Boolean)`

### isPackageSuspended

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isPackageSuspended(
    admin: ComponentName?, 
    packageName: String!
): Boolean
```

Determine if a package is suspended. This function can be called by a device owner, profile owner, or by a delegate given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PACKAGE_ACCESS:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)` or by holders of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_PACKAGE_STATE:kotlin.String`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The name of the package to retrieve the suspended status of. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the package is suspended or `false` if the package is not suspended, could not be found or an error occurred. |

| Exceptions ||
|---|---|
| `android.content.pm.PackageManager.NameNotFoundException` | if the package could not be found. |
| `java.lang.SecurityException` | if `admin` is not a device or profile owner or has not been granted the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_PACKAGE_STATE:kotlin.String`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PACKAGE_ACCESS:kotlin.String`

### isPreferentialNetworkServiceEnabled

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isPreferentialNetworkServiceEnabled(): Boolean
```

Indicates whether preferential network service is enabled.

Before Android version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int`: This method can be called by the profile owner of a managed profile.

Starting from Android version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int`: This method can be called by the profile owner of a managed profile or device owner.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | whether preferential network service is enabled. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not the profile owner or device owner. |

### isProfileOwnerApp

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isProfileOwnerApp(packageName: String!): Boolean
```

Used to determine if a particular package is registered as the profile owner for the user. A profile owner is a special device admin that has additional privileges within the profile.

| Parameters ||
|---|---|
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The package name of the app to compare with the registered profile owner. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | Whether or not the package is registered as the profile owner. |

### isProvisioningAllowed

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isProvisioningAllowed(action: String): Boolean
```

Returns whether it is possible for the caller to initiate provisioning of a managed profile or device, setting itself as the device or profile owner.

| Parameters ||
|---|---|
| `action` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): One of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_DEVICE:kotlin.String`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE:kotlin.String`, #ACTION_PROVISION_MULTIUSER_MANAGED_USER. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | whether provisioning a managed profile or device is possible. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if the supplied action is not valid. |

### isResetPasswordTokenActive

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isResetPasswordTokenActive(admin: ComponentName?): Boolean
```

Called by a profile, device owner or a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_RESET_PASSWORD:kotlin.String` to check if the current reset password token is active.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, false is always returned.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | true if the token is active, false otherwise. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if no token has been set. |
| `java.lang.SecurityException` | if admin is not a device or profile owner and not a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_RESET_PASSWORD:kotlin.String` |

### isSafeOperation

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isSafeOperation(reason: Int): Boolean
```

Checks if it's safe to run operations that can be affected by the given `reason`.

**Note:** notice that the operation safety state might change between the time this method returns and the operation's method is called, so calls to the latter could still throw a `https://developer.android.com/reference/kotlin/android/app/admin/UnsafeStateException` even when this method returns `true`.

| Parameters ||
|---|---|
| `reason` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): currently, only supported reason is `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#OPERATION_SAFETY_REASON_DRIVING_DISTRACTION:kotlin.Int`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#OPERATION_SAFETY_REASON_DRIVING_DISTRACTION:kotlin.Int` |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | whether it's safe to run operations that can be affected by the given `reason`. |

### isSecurityLoggingEnabled

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isSecurityLoggingEnabled(admin: ComponentName?): Boolean
```

Return whether security logging is enabled or not by the admin.

Can only be called by the device owner or a profile owner of an organization-owned managed profile, otherwise a `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#` will be thrown.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which device admin this request is associated with. Null if the caller is not a device admin. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if security logging is enabled, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not allowed to control security logging. |

### isStatusBarDisabled

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isStatusBarDisabled(): Boolean
```

Returns whether the status bar is disabled/enabled, see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setStatusBarDisabled(android.content.ComponentName,%20kotlin.Boolean)`.

Callable by device owner or profile owner of secondary users that is affiliated with the device owner.

This policy has no effect in LockTask mode. The behavior of the status bar in LockTask mode can be configured with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)`.

This policy also does not have any effect while on the lock screen, where the status bar will not be disabled.

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not the device owner, or a profile owner of secondary user that is affiliated with the device. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getSecondaryUsers(android.content.ComponentName)`

### isUninstallBlocked

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isUninstallBlocked(
    admin: ComponentName?, 
    packageName: String!
): Boolean
```

Check whether the user has been blocked by device policy from uninstalling a package. Requires the caller to be the profile owner if checking a specific admin's policy.

**Note:** Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#LOLLIPOP_MR1:kotlin.Int`, the behavior of this API is changed such that passing `null` as the `admin` parameter will return if any admin has blocked the uninstallation. Before L MR1, passing `null` will cause a NullPointerException to be raised.

**Note:** If your app targets Android 11 (API level 30) or higher, this method returns a filtered result. Learn more about how to [manage package visibility](https://developer.android.com/reference/kotlin/training/basics/intents/package-visibility).

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, the returned policy will be the current resolved policy rather than the policy set by the calling admin.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component whose blocking policy will be checked, or `null` to check whether any admin has blocked the uninstallation. Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` admin will be ignored and assumed `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: package to check. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | true if uninstallation is blocked and the given package is visible to you, false otherwise if uninstallation isn't blocked or the given package isn't visible to you. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### isUniqueDeviceAttestationSupported

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isUniqueDeviceAttestationSupported(): Boolean
```

Returns `true` if the StrongBox Keymaster implementation on the device was provisioned with an individual attestation certificate and can sign attestation records using it (as attestation using an individual attestation certificate is a feature only Keymaster implementations with StrongBox security level can implement). For use prior to calling `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#generateKeyPair(android.content.ComponentName,%20kotlin.String,%20android.security.keystore.KeyGenParameterSpec,%20kotlin.Int)`.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if individual attestation is supported. |

### isUsbDataSignalingEnabled

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isUsbDataSignalingEnabled(): Boolean
```

Returns whether USB data signaling is currently enabled.

When called by a device owner or profile owner of an organization-owned managed profile, this API returns whether USB data signaling is currently enabled by that admin. When called by any other app, returns whether USB data signaling is currently enabled on the device.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if USB data signaling is enabled, `false` otherwise. |

### isUsingUnifiedPassword

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun isUsingUnifiedPassword(admin: ComponentName): Boolean
```

When called by a profile owner of a managed profile returns true if the profile uses unified challenge with its parent user. **Note**: This method is not concerned with password quality and will return false if the profile has empty password as a separate challenge.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner of a managed profile. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_UNIFIED_PASSWORD:kotlin.String`

### listForegroundAffiliatedUsers

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun listForegroundAffiliatedUsers(): MutableList<UserHandle!>
```

Gets the list of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()` users running on foreground.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://developer.android.com/reference/kotlin/android/os/UserHandle.html#!>` | list of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()` users running on foreground. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the calling application is not a device owner |

### lockNow

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun lockNow(): Unit
```

Make the device lock immediately, as if the lock screen timeout has expired at the point of this call.

This method secures the device in response to an urgent situation, such as a lost or stolen device. After this method is called, the device must be unlocked using strong authentication (PIN, pattern, or password). This API is intended for use only by device admins.

From version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` onwards, the caller must either have the LOCK_DEVICE permission or the device must have the device admin feature; if neither is true, then the method will return without completing any action. Before version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int`, the device needed the device admin feature, regardless of the caller's permissions.

The calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_FORCE_LOCK:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

If there's no lock type set, this method forces the device to go to sleep but doesn't lock the device. Device admins who find the device in this state can lock an otherwise-insecure device by first calling `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPassword(kotlin.String,%20kotlin.Int)` to set the password and then lock the device.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to lock the parent profile.

NOTE: on `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_AUTOMOTIVE:kotlin.String`, this method doesn't turn off the screen as it would be a driving safety distraction.

Equivalent to calling `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#lockNow(kotlin.Int)` with no flags.

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the calling application does not own an active administrator that uses `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_FORCE_LOCK:kotlin.Int` |

### lockNow

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun lockNow(flags: Int): Unit
```

Make the device lock immediately, as if the lock screen timeout has expired at the point of this call.

This method secures the device in response to an urgent situation, such as a lost or stolen device. After this method is called, the device must be unlocked using strong authentication (PIN, pattern, or password). This API is intended for use only by device admins.

From version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` onwards, the caller must either have the LOCK_DEVICE permission or the device must have the device admin feature; if neither is true, then the method will return without completing any action. Before version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int`, the device needed the device admin feature, regardless of the caller's permissions.

A calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_FORCE_LOCK:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

If there's no lock type set, this method forces the device to go to sleep but doesn't lock the device. Device admins who find the device in this state can lock an otherwise-insecure device by first calling `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPassword(kotlin.String,%20kotlin.Int)` to set the password and then lock the device.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to lock the parent profile as well as the managed profile.

NOTE: In order to lock the parent profile and evict the encryption key of the managed profile, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#lockNow()` must be called twice: First, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#lockNow()` should be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, then `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#lockNow(kotlin.Int)` should be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance associated with the managed profile, with the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY:kotlin.Int` flag. Calling the method twice in this order ensures that all users are locked and does not stop the device admin on the managed profile from issuing a second call to lock its own profile.

NOTE: on `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_AUTOMOTIVE:kotlin.String`, this method doesn't turn off the screen as it would be a driving safety distraction.

| Parameters ||
|---|---|
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): May be 0 or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY:kotlin.Int`. Value is either `0` or - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY:kotlin.Int` flag is passed when locking the parent profile. |
| `java.lang.SecurityException` | if the calling application does not own an active administrator that uses `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_FORCE_LOCK:kotlin.Int` and the does not hold the LOCK_DEVICE permission, or the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY:kotlin.Int` flag is passed by an application that is not a profile owner of a managed profile. |
| `java.lang.UnsupportedOperationException` | if the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY:kotlin.Int` flag is passed when `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()` does not return `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE_PER_USER:kotlin.Int`. |

### logoutUser

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun logoutUser(admin: ComponentName): Int
```

Called by a profile owner of secondary user that is affiliated with the device to stop the calling user and switch back to primary user (when the user was `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#switchUser(android.content.ComponentName,%20android.os.UserHandle)` switched to) or stop the user (when it was `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#startUserInBackground(android.content.ComponentName,%20android.os.UserHandle)`.

Notice that on devices running with `https://developer.android.com/reference/kotlin/android/os/UserManager.html#isHeadlessSystemUserMode()`, there is no primary user, so it switches back to the user that was in the foreground before the first call to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#switchUser(android.content.ComponentName,%20android.os.UserHandle)` (or fails with `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_UNKNOWN:kotlin.Int` if that method was not called prior to this call).

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | one of the following result codes: `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_UNKNOWN:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_SUCCESS:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_MANAGED_PROFILE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_CURRENT_USER:kotlin.Int` Value is one of the following: - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_SUCCESS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_UNKNOWN:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_MANAGED_PROFILE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_MAX_RUNNING_USERS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_CURRENT_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_LOW_STORAGE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_MAX_USERS:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner affiliated with the device. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getSecondaryUsers(android.content.ComponentName)`

### reboot

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun reboot(admin: ComponentName): Unit
```

Called by device owner or holders of the permission android.Manifest.permission#MANAGE_DEVICE_POLICY_REBOOT to reboot the device. If there is an ongoing call on the device, throws an `https://developer.android.com/reference/kotlin/java/lang/IllegalStateException.html#`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which device owner this request is associated with. Can be null if the caller holds the permission. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if device has an ongoing call. |
| `java.lang.SecurityException` | if `admin` is not a device owner and the caller does not hold the permission. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#CALL_STATE_IDLE:kotlin.Int`

### removeActiveAdmin

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun removeActiveAdmin(admin: ComponentName): Unit
```

Remove a current administration component. This can only be called by the application that owns the administration component; if you try to remove someone else's component, a security exception will be thrown.

Note that the operation is not synchronous and the admin might still be active (as indicated by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getActiveAdmins()`) by the time this method returns.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): The administration compononent to remove. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not in the owner application of `admin`. |

### removeCrossProfileWidgetProvider

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun removeCrossProfileWidgetProvider(
    admin: ComponentName?, 
    packageName: String!
): Boolean
```

**Deprecated:** *While this API still works to mutate the current allowlist, please consider switching to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCrossProfileWidgetProviders(kotlin.collections.MutableSet)` for better performance.*

Called by the profile owner of a managed profile or a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_PROFILE_INTERACTION:kotlin.String` to disable widget providers from a given package to be available in the parent profile. For this method to take effect the package should have been added via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addCrossProfileWidgetProvider(android.content.ComponentName,%20kotlin.String)`.

**Note:** By default no widget provider package is allowlisted.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The package from which widget providers are no longer allowlisted. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | Whether the package was removed. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner and not a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_PROFILE_INTERACTION:kotlin.String`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addCrossProfileWidgetProvider(android.content.ComponentName,%20kotlin.String)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCrossProfileWidgetProviders(android.content.ComponentName)`

### removeKeyPair

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun removeKeyPair(
    admin: ComponentName?, 
    alias: String
): Boolean
```

This API can be called by the following to remove a certificate and private key pair installed under a given alias:

- Device owner
- Profile owner
- Delegated certificate installer
- Credential management app

<br />

From Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int`, the credential management app can call this API. If called by the credential management app, the componentName must be `null`. Note, there can only be a credential management app on an unmanaged device.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if the caller is not a device admin. |
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The private key alias under which the certificate is installed. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the private key alias no longer exists, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not `null` and not a device or profile owner, or `admin` is null but the calling application is not a delegated certificate installer or credential management app. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_INSTALL:kotlin.String`

### removeKeyPair

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun removeKeyPair(
    alias: String, 
    scope: Int
): Boolean
```

This API can be called by the following to remove a certificate and private key pair installed under a given alias, specifying whether it resides in user-specific or device-wide keychain:

- Device owner
- Profile owner
- Delegated certificate installer
- Credential management app (user-specific keychain only)

<br />

This method extends `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#removeKeyPair(android.content.ComponentName,%20kotlin.String)`, adding the `scope` parameter to determine if the key pair should be removed from user-specific or device-wide keychain. The calling application must hold the same permission requirements as the base method.

Key differences in this overload:

- Using `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`: The key pair will be removed from the device-wide keychain. The caller MUST be running in an affiliated user to manage device keys. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`. Credential management apps are not permitted to use this scope.
- Using `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int`: The key pair is removed from the calling user's own keychain. This mirrors the behavior of the base `removeKeyPair` method.

| Parameters ||
|---|---|
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The private key alias under which the certificate is installed. This value cannot be `null`. |
| `scope` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The scope of the key pair: `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int` |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the private key alias no longer exists, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not authorized. |

### removeOverrideApn

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun removeOverrideApn(
    admin: ComponentName, 
    apnId: Int
): Boolean
```

Called by device owner or managed profile owner to remove an override APN.

This method may returns `false` if there is no override APN with the given `apnId`.

Before Android version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int`: Only device owners can remove APNs.

Starting from Android version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int`: Both device owners and managed profile owners can remove enterprise APNs (`https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#TYPE_ENTERPRISE:kotlin.Int`), while only device owners can remove other type of APNs.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `apnId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the `id` of the override APN to remove |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the required override APN is successfully removed, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | If request is for enterprise APN `admin` is either device owner or profile owner and in all other types of APN if `admin` is not a device owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setOverrideApnsEnabled(android.content.ComponentName,%20kotlin.Boolean)`

### removeUser

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun removeUser(
    admin: ComponentName, 
    userHandle: UserHandle
): Boolean
```

Called by a device owner to remove a user/profile and all associated data. The primary user can not be removed.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `userHandle` | [UserHandle](https://developer.android.com/reference/kotlin/android/os/UserHandle.html#): the user to remove. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the user was removed, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

### requestBugreport

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun requestBugreport(admin: ComponentName): Boolean
```

Called by a device owner to request a bugreport.

If the device contains secondary users or profiles, they must be affiliated with the device. Otherwise a `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#` will be thrown. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the bugreport collection started successfully, or `false` if it wasn't triggered because a previous bugreport operation is still active (either the bugreport is still running or waiting for the user to share or decline) |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner, or there is at least one profile or secondary user that is not affiliated with the device. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`

### resetPassword

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun resetPassword(
    password: String!, 
    flags: Int
): Boolean
```

**Deprecated:** *Please use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPasswordWithToken(android.content.ComponentName,%20kotlin.String,%20kotlin.ByteArray,%20kotlin.Int)` instead.*

Force a new password for device unlock (the password needed to access the entire device) or the work profile challenge on the current user. This takes effect immediately.

Before `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int`, this API is available to device admin, profile owner and device owner. Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int`, legacy device admin (who is not also profile owner or device owner) can only call this API to set a new password if there is currently no password set. Profile owner and device owner can continue to force change an existing password as long as the target user is unlocked, although device owner will not be able to call this API at all if there is also a managed profile on the device.

Between `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#O:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#P:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int`, profile owner and devices owner targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#O:kotlin.Int` or above who attempt to call this API will receive `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#`; they are encouraged to migrate to the new `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPasswordWithToken(android.content.ComponentName,%20kotlin.String,%20kotlin.ByteArray,%20kotlin.Int)` API instead. Profile owner and device owner targeting older SDK levels are not affected: they continue to experience the existing behaviour described in the previous paragraph.

*Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int`, this API is no longer supported in most cases.* Device owner and profile owner calling this API will receive `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#` if they target SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#O:kotlin.Int` or above, or they will receive a silent failure (API returning `false`) if they target lower SDK level. For legacy device admins, this API throws `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#` if they target SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int` or above, and returns `false` otherwise. Only privileged apps holding RESET_PASSWORD permission which are part of the system factory image can still call this API to set a new password if there is currently no password set. In this case, if the device already has a password, this API will throw `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#`.

The given password must be sufficient for the current password quality and length constraints as returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordQuality(android.content.ComponentName)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumLength(android.content.ComponentName)`; if it does not meet these constraints, then it will be rejected and false returned. Note that the password may be a stronger quality (containing alphanumeric characters when the requested quality is only numeric), in which case the currently active quality will be increased to match.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, this methods does nothing.

The calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_RESET_PASSWORD:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `password` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The new password for the user. Null or empty clears the password. |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): May be 0 or combination of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#RESET_PASSWORD_REQUIRE_ENTRY:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT:kotlin.Int`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | Returns true if the password was applied, or false if it is not acceptable for the current constraints. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the calling user is locked or has a managed profile. |
| `java.lang.SecurityException` | if the calling application does not own an active administrator that uses `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_RESET_PASSWORD:kotlin.Int` |

### resetPasswordWithToken

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun resetPasswordWithToken(
    admin: ComponentName?, 
    password: String!, 
    token: ByteArray!, 
    flags: Int
): Boolean
```

Called by device or profile owner to force set a new device unlock password or a managed profile challenge on current user. This takes effect immediately.

Unlike `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPassword(kotlin.String,%20kotlin.Int)`, this API can change the password even before the user or device is unlocked or decrypted. The supplied token must have been previously provisioned via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setResetPasswordToken(android.content.ComponentName,%20kotlin.ByteArray)`, and in active state `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isResetPasswordTokenActive(android.content.ComponentName)`.

The given password must be sufficient for the current password quality and length constraints as returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordQuality(android.content.ComponentName)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPasswordMinimumLength(android.content.ComponentName)`; if it does not meet these constraints, then it will be rejected and false returned. Note that the password may be a stronger quality, for example, a password containing alphanumeric characters when the requested quality is only numeric.

Calling with a `null` or empty password will clear any existing PIN, pattern or password if the current password constraints allow it.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, calling this methods has no effect - the password is always empty - and false is returned.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `password` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The new password for the user. `null` or empty clears the password. |
| `token` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!: the password reset token previously provisioned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setResetPasswordToken(android.content.ComponentName,%20kotlin.ByteArray)`. |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): May be 0 or combination of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#RESET_PASSWORD_REQUIRE_ENTRY:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT:kotlin.Int`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | Returns true if the password was applied, or false if it is not acceptable for the current constraints. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the provided token is not valid. |
| `java.lang.SecurityException` | if admin is not a device or profile owner. |

### retrieveNetworkLogs

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun retrieveNetworkLogs(
    admin: ComponentName?, 
    batchToken: Long
): MutableList<NetworkEvent!>?
```

Called by device owner, profile owner of a managed profile or delegated app with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_NETWORK_LOGGING:kotlin.String` to retrieve the most recent batch of network logging events.

When network logging is enabled by a profile owner, the network logs will only include work profile network activity, not activity on the personal profile. A device owner or profile owner has to provide a batchToken provided as part of `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onNetworkLogsAvailable(android.content.Context,%20android.content.Intent,%20kotlin.Long,%20kotlin.Int)` callback. If the token doesn't match the token of the most recent available batch of logs, `null` will be returned.

`https://developer.android.com/reference/kotlin/android/app/admin/NetworkEvent` can be one of `https://developer.android.com/reference/kotlin/android/app/admin/DnsEvent` or `https://developer.android.com/reference/kotlin/android/app/admin/ConnectEvent`.

The list of network events is sorted chronologically, and contains at most 1200 events.

Access to the logs is rate limited and this method will only return a new batch of logs after the device device owner has been notified via `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onNetworkLogsAvailable(android.content.Context,%20android.content.Intent,%20kotlin.Long,%20kotlin.Int)`.

If the caller is not a profile owner and a secondary user or profile is created, calling this method will throw a `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#` until all users become affiliated again. It will also no longer be possible to retrieve the network logs batch with the most recent batchToken provided by `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onNetworkLogsAvailable(android.content.Context,%20android.content.Intent,%20kotlin.Long,%20kotlin.Int)`. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if called by a delegated app. |
| `batchToken` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): A token of the batch to retrieve |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://developer.android.com/reference/kotlin/android/app/admin/NetworkEvent!>?` | A new batch of network logs which is a list of `https://developer.android.com/reference/kotlin/android/app/admin/NetworkEvent`. Returns `null` if the batch represented by batchToken is no longer available or if logging is disabled. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner, profile owner or if the `admin` is not a profile owner and there is at least one profile or secondary user that is not affiliated with the device. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onNetworkLogsAvailable(android.content.Context,%20android.content.Intent,%20kotlin.Long,%20kotlin.Int)`

### retrievePreRebootSecurityLogs

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun retrievePreRebootSecurityLogs(admin: ComponentName?): MutableList<SecurityLog.SecurityEvent!>?
```

Called by device owner or profile owner of an organization-owned managed profile to retrieve device logs from before the device's last reboot.

**This API is not supported on all devices. Calling this API on unsupported devices will result in `null` being returned. The device logs are retrieved from a RAM region which is not guaranteed to be corruption-free during power cycles, as a result be cautious about data corruption when parsing.**

When called by a device owner, if there is any other user or profile on the device, it must be affiliated with the device. Otherwise a `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#` will be thrown. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which device admin this request is associated with, or `null` if called by a delegated app. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://developer.android.com/reference/kotlin/android/app/admin/SecurityLog.SecurityEvent!>?` | Device logs from before the latest reboot of the system, or `null` if this API is not supported on the device. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not allowed to access security logging, or there is at least one profile or secondary user that is not affiliated with the device. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#retrieveSecurityLogs(android.content.ComponentName)`

### retrieveSecurityLogs

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun retrieveSecurityLogs(admin: ComponentName?): MutableList<SecurityLog.SecurityEvent!>?
```

Called by device owner or profile owner of an organization-owned managed profile to retrieve all new security logging entries since the last call to this API after device boots.

Access to the logs is rate limited and it will only return new logs after the admin has been notified via `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onSecurityLogsAvailable(android.content.Context,%20android.content.Intent)`.

When called by a device owner, if there is any other user or profile on the device, it must be affiliated with the device. Otherwise a `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#` will be thrown. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which device admin this request is associated with, or `null` if called by a delegated app. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://developer.android.com/reference/kotlin/android/app/admin/SecurityLog.SecurityEvent!>?` | the new batch of security logs which is a list of `https://developer.android.com/reference/kotlin/android/app/admin/SecurityLog.SecurityEvent`, or `null` if rate limitation is exceeded or if logging is currently disabled. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not allowed to access security logging, or there is at least one profile or secondary user that is not affiliated with the device. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onSecurityLogsAvailable(android.content.Context,%20android.content.Intent)`

### revokeKeyPairFromApp

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun revokeKeyPairFromApp(
    admin: ComponentName?, 
    alias: String, 
    packageName: String
): Boolean
```

Called by a device or profile owner, or delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), to revoke an application's grant to a KeyChain key pair. Calls by the application to `https://developer.android.com/reference/kotlin/android/security/KeyChain.html#getPrivateKey(android.content.Context,%20kotlin.String)` will fail after the grant is revoked. The grantee app will receive the `https://developer.android.com/reference/kotlin/android/security/KeyChain.html#ACTION_KEY_ACCESS_CHANGED:kotlin.String` broadcast when access to a key is revoked. Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` throws an `https://developer.android.com/reference/kotlin/java/lang/IllegalArgumentException.html#` if `alias` doesn't correspond to an existing key.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if calling from a delegated certificate chooser. |
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias of the key to revoke access from. This value cannot be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The name of the (already installed) package to revoke access from. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the grant was revoked successfully, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if `packageName` or `alias` are empty. |
| `java.lang.IllegalStateException` | if `packageName` is not a name of an installed package. |
| `java.lang.SecurityException` | if the caller is not a device owner, a profile owner or delegated certificate chooser. |

**See Also**

### revokeKeyPairFromApp

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun revokeKeyPairFromApp(
    alias: String, 
    packageName: String, 
    scope: Int
): Boolean
```

Called by a device or profile owner, delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), or permission caller, to revoke an application's grant to a KeyChain key pair for the specified scope.

| Parameters ||
|---|---|
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias of the key to revoke access from. This value cannot be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The name of the (already installed) package to revoke access from. This value cannot be `null`. |
| `scope` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The scope of the key pair: `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int` |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the grant was revoked successfully, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if `packageName` or `alias` are empty. |
| `java.lang.IllegalStateException` | if `KEYPAIR_SCOPE_DEVICE` is requested by a non-affiliated user, or if `packageName` is not a name of an installed package. |
| `java.lang.SecurityException` | if the caller is not a device owner, a profile owner, delegated certificate chooser, or permission caller. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#grantKeyPairToApp(kotlin.String,%20kotlin.String,%20kotlin.Int)`

### revokeKeyPairFromWifiAuth

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun revokeKeyPairFromWifiAuth(alias: String): Boolean
```

Called by a device or profile owner, or delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), to deny using a KeyChain key pair for authentication to Wifi networks. Configured networks using this key won't be able to authenticate. Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` throws an `https://developer.android.com/reference/kotlin/java/lang/IllegalArgumentException.html#` if `alias` doesn't correspond to an existing key.

| Parameters ||
|---|---|
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias of the key pair. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the operation was set successfully, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not a device owner, a profile owner or delegated certificate chooser. |

**See Also**

### revokeKeyPairFromWifiAuth

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun revokeKeyPairFromWifiAuth(
    alias: String, 
    scope: Int
): Boolean
```

Called by a device or profile owner, delegated certificate chooser (an app that has been delegated the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_SELECTION:kotlin.String` privilege), or permission caller, to deny using a KeyChain key pair of the specified scope for authentication to Wifi networks. Configured networks using this key won't be able to authenticate.

| Parameters ||
|---|---|
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias of the key pair. This value cannot be `null`. |
| `scope` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The scope of the key pair: `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int` |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the operation was set successfully, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if `KEYPAIR_SCOPE_DEVICE` is requested by a non-affiliated user. |
| `java.lang.SecurityException` | if the caller is not a device owner, a profile owner, delegated certificate chooser, or permission caller. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#grantKeyPairToWifiAuth(kotlin.String,%20kotlin.Int)`

### setAccountManagementDisabled

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setAccountManagementDisabled(
    admin: ComponentName?, 
    accountType: String!, 
    disabled: Boolean
): Unit
```

Called by a device owner or profile owner to disable account management for a specific type of account.

The calling device admin must be a device owner or profile owner. If it is not, a security exception will be thrown.

When account management is disabled for an account type, adding or removing an account of that type will not be possible.

From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int` the profile or device owner can still use `https://developer.android.com/reference/kotlin/android/accounts/AccountManager.html#` APIs to add or remove accounts when account management for a specific type is disabled.

This method may be called on the `DevicePolicyManager` instance returned from `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` by the profile owner on an organization-owned device, to restrict accounts that may not be managed on the primary profile.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, after the account management disabled policy has been set, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully set or not. This callback will contain:

- The policy identifier `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyIdentifiers#ACCOUNT_MANAGEMENT_DISABLED_POLICY:kotlin.String`
- The additional policy params bundle, which contains `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#EXTRA_ACCOUNT_TYPE:kotlin.String` the account type the policy applies to
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully set or the reason the policy failed to be set (e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `accountType` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: For which account management is disabled or enabled. |
| `disabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): The boolean indicating that account management will be disabled (true) or enabled (false). |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### setAffiliationIds

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setAffiliationIds(
    admin: ComponentName, 
    ids: MutableSet<String!>
): Unit
```

Indicates the entity that controls the device. Two users are affiliated if the set of ids set by the device owner and the admin of the secondary user.

A user that is affiliated with the device owner user is considered to be affiliated with the device.

**Note:** Features that depend on user affiliation (such as security logging or #bindDeviceAdminServiceAsUser) won't be available when a secondary user is created, until it becomes affiliated. Therefore it is recommended that the appropriate affiliation ids are set by its owner as soon as possible after the user is created.

Note: This method used to be available for affiliating device owner and profile owner. However, since Android 11, this combination is not possible. This method is now only useful for affiliating the primary user with managed secondary users.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which device owner, or owner of secondary user, this request is associated with. This value cannot be `null`. |
| `ids` | [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>: A set of opaque non-empty affiliation ids. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if `ids` is null or contains an empty string. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`

### setAlwaysOnVpnPackage

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setAlwaysOnVpnPackage(
    admin: ComponentName, 
    vpnPackage: String?, 
    lockdownEnabled: Boolean
): Unit
```

Called by a device or profile owner to configure an always-on VPN connection through a specific application for the current user. This connection is automatically granted and persisted after a reboot.

To support the always-on feature, an app must

- declare a `https://developer.android.com/reference/kotlin/android/net/VpnService.html#` in its manifest, guarded by `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#BIND_VPN_SERVICE:kotlin.String`;
- target `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int` or above; and
- *not* explicitly opt out of the feature through `https://developer.android.com/reference/kotlin/android/net/VpnService.html#SERVICE_META_DATA_SUPPORTS_ALWAYS_ON:kotlin.String`.

The call will fail if called with the package name of an unsupported VPN app.

Enabling lockdown via `lockdownEnabled` argument carries the risk that any failure of the VPN provider could break networking for all apps. This method clears any lockdown allowlist set by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAlwaysOnVpnPackage(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean,%20kotlin.collections.MutableSet)`.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int` calling this method with `vpnPackage` set to `null` only removes the existing configuration if it was previously created by this admin. To remove VPN configuration created by the user use `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_VPN:kotlin.String`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): This value cannot be `null`. |
| `vpnPackage` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: The package name for an installed VPN app on the device, or `null` to remove an existing always-on VPN configuration. |
| `lockdownEnabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): `true` to disallow networking when the VPN is not connected or `false` otherwise. This has no effect when clearing. |

| Exceptions ||
|---|---|
| `android.content.pm.PackageManager.NameNotFoundException` | if `vpnPackage` is not installed. |
| `java.lang.SecurityException` | if `admin` is not a device or a profile owner. |
| `java.lang.UnsupportedOperationException` | if `vpnPackage` exists but does not support being set as always-on, or if always-on VPN is not available. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAlwaysOnVpnPackage(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean,%20kotlin.collections.MutableSet)`

### setAlwaysOnVpnPackage

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setAlwaysOnVpnPackage(
    admin: ComponentName, 
    vpnPackage: String?, 
    lockdownEnabled: Boolean, 
    lockdownAllowlist: MutableSet<String!>?
): Unit
```

A version of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAlwaysOnVpnPackage(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)` that allows the admin to specify a set of apps that should be able to access the network directly when VPN is not connected. When VPN connects these apps switch over to VPN if allowed to use that VPN. System apps can always bypass VPN.

Note that the system doesn't update the allowlist when packages are installed or uninstalled, the admin app must call this method to keep the list up to date.

When `lockdownEnabled` is false `lockdownAllowlist` is ignored . When `lockdownEnabled` is `true` and `lockdownAllowlist` is `null` or empty, only system apps can bypass VPN.

Setting always-on VPN package to `null` or using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAlwaysOnVpnPackage(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)` clears lockdown allowlist.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): This value cannot be `null`. |
| `vpnPackage` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: package name for an installed VPN app on the device, or `null` to remove an existing always-on VPN configuration |
| `lockdownEnabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): `true` to disallow networking when the VPN is not connected or `false` otherwise. This has no effect when clearing. |
| `lockdownAllowlist` | [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>?: Packages that will be able to access the network directly when VPN is in lockdown mode but not connected. Has no effect when clearing. This value may be `null`. |

| Exceptions ||
|---|---|
| `android.content.pm.PackageManager.NameNotFoundException` | if `vpnPackage` or one of `lockdownAllowlist` is not installed. |
| `java.lang.SecurityException` | if `admin` is not a device or a profile owner. |
| `java.lang.UnsupportedOperationException` | if `vpnPackage` exists but does not support being set as always-on, or if always-on VPN is not available. |

### setAppFunctionsPolicy

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setAppFunctionsPolicy(policy: Int): Unit
```

Sets the `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionManager.html#` policy which controls app functions operations on the device. An app function is a piece of functionality that apps expose to the system for cross-app orchestration.

This function can only be called by a device owner, a profile owner or holders of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_APP_FUNCTIONS:kotlin.String`.

| Parameters ||
|---|---|
| `policy` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The app functions policy to set. One of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#APP_FUNCTIONS_NOT_CONTROLLED_BY_POLICY:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#APP_FUNCTIONS_DISABLED:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#APP_FUNCTIONS_DISABLED_CROSS_PROFILE:kotlin.Int` Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#APP_FUNCTIONS_NOT_CONTROLLED_BY_POLICY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#APP_FUNCTIONS_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#APP_FUNCTIONS_DISABLED_CROSS_PROFILE:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device owner, a profile owner or a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_APP_FUNCTIONS:kotlin.String`. |

### setApplicationHidden

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setApplicationHidden(
    admin: ComponentName?, 
    packageName: String!, 
    hidden: Boolean
): Boolean
```

Hide or unhide packages. When a package is hidden it is unavailable for use, but the data and actual package file remain. This function can be called by a device owner, profile owner, or by a delegate given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PACKAGE_ACCESS:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance, returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, where the caller must be the profile owner of an organization-owned managed profile and the package must be a system package. If called on the parent instance, then the package is hidden or unhidden in the personal profile.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, after the application hidden policy has been set, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully set or not. This callback will contain:

- The policy identifier `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyIdentifiers#APPLICATION_HIDDEN_POLICY:kotlin.String`
- The additional policy params bundle, which contains `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#EXTRA_PACKAGE_NAME:kotlin.String` the package name the policy applies to
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully set or the reason the policy failed to be set (e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if the caller is not a device admin. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The name of the package to hide or unhide. |
| `hidden` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): `true` if the package should be hidden, `false` if it should be unhidden. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | boolean Whether the hidden setting of the package was successfully updated. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if called on the parent profile and the package provided is not a system package. |
| `java.lang.SecurityException` | if `admin` is not a device or profile owner or if called on the parent profile and the `admin` is not a profile owner of an organization-owned managed profile. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PACKAGE_ACCESS:kotlin.String`

### setApplicationRestrictions

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setApplicationRestrictions(
    admin: ComponentName?, 
    packageName: String!, 
    settings: Bundle!
): Unit
```

Sets the application restrictions for a given target application running in the calling user.

The caller must be a profile or device owner on that user, or the package allowed to manage application restrictions via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)` with the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_APP_RESTRICTIONS:kotlin.String` scope; otherwise a security exception will be thrown.

The provided `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` consists of key-value pairs, where the types of values may be:

- `boolean`
- `int`
- `String` or `String[]`
- From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int`, `Bundle` or `Bundle[]`

If the restrictions are not available yet, but may be applied in the near future, the caller can notify the target application of that by adding `https://developer.android.com/reference/kotlin/android/os/UserManager.html#KEY_RESTRICTIONS_PENDING:kotlin.String` to the settings parameter.

The application restrictions are only made visible to the target application via `https://developer.android.com/reference/kotlin/android/os/UserManager.html#getApplicationRestrictions(kotlin.String)`, in addition to the profile or device owner, and the application restrictions managing package via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getApplicationRestrictions(android.content.ComponentName,%20kotlin.String)`.

Starting from Android Version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, multiple admins can set app restrictions for the same application, the target application can get the list of app restrictions set by each admin via `https://developer.android.com/reference/kotlin/android/content/RestrictionsManager.html#getApplicationRestrictionsPerAdmin()`.

Starting from Android Version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#VANILLA_ICE_CREAM:kotlin.Int`, the device policy management role holder can also set app restrictions on any applications in the calling user, as well as the parent user of an organization-owned managed profile via the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`. App restrictions set by the device policy management role holder are returned by `https://developer.android.com/reference/kotlin/android/os/UserManager.html#getApplicationRestrictions(kotlin.String)` but the target application should use `https://developer.android.com/reference/kotlin/android/content/RestrictionsManager.html#getApplicationRestrictionsPerAdmin()` to retrieve them, alongside any app restrictions the profile or device owner might have set.

NOTE: The method performs disk I/O and shouldn't be called on the main thread.   
This method may take several seconds to complete, so it should only be called from a worker thread.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if called by the application restrictions managing package. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The name of the package to update restricted settings for. |
| `settings` | [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!: A `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` to be parsed by the receiving application, conveying a new set of active restrictions. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the maximum number of packages with active application restrictions across all admins for the user has been reached. |
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_APP_RESTRICTIONS:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/os/UserManager.html#KEY_RESTRICTIONS_PENDING:kotlin.String`

### setApplicationRestrictionsManagingPackage

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setApplicationRestrictionsManagingPackage(
    admin: ComponentName, 
    packageName: String?
): Unit
```

**Deprecated:** *From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#O:kotlin.Int`. Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)` with the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_APP_RESTRICTIONS:kotlin.String` scope instead.*

Called by a profile owner or device owner to grant permission to a package to manage application restrictions for the calling user via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setApplicationRestrictions(android.content.ComponentName,%20kotlin.String,%20android.os.Bundle)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getApplicationRestrictions(android.content.ComponentName,%20kotlin.String)`.

This permission is persistent until it is later cleared by calling this method with a `null` value or uninstalling the managing package.

The supplied application restriction managing package must be installed when calling this API, otherwise an `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.NameNotFoundException.html#` will be thrown.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: The package name which will be given access to application restrictions APIs. If `null` is given the current package will be cleared. |

| Exceptions ||
|---|---|
| `android.content.pm.PackageManager.NameNotFoundException` | if `packageName` is not found |
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### setAutoTimeEnabled

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setAutoTimeEnabled(
    admin: ComponentName?, 
    enabled: Boolean
): Unit
```

Called by a device owner, a profile owner for the primary user or a profile owner of an organization-owned managed profile to turn auto time on and off.

Callers are recommended to use `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DATE_TIME:kotlin.String` to prevent the user from changing this setting, that way no user will be able set the date and time zone.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `enabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): Whether time should be obtained automatically from the network or not. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device owner, a profile owner for the primary user, or a profile owner of an organization-owned managed profile. |

### setAutoTimePolicy

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setAutoTimePolicy(policy: Int): Unit
```

Called by a device owner, a profile owner for the primary user or a profile owner of an organization-owned managed profile to turn auto time on and off i.e. Whether time should be obtained automatically from the network or not.

Callers are recommended to use `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DATE_TIME:kotlin.String` to prevent the user from changing this setting, that way no user will be able set the date and time zone.

| Parameters ||
|---|---|
| `policy` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The desired state among `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ENABLED:kotlin.Int` to enable, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_DISABLED:kotlin.Int` to disable and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_NOT_CONTROLLED_BY_POLICY:kotlin.Int` to unset the policy. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_NOT_CONTROLLED_BY_POLICY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ENABLED:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device owner, a profile owner for the primary user, or a profile owner of an organization-owned managed profile, or if the caller does not hold the required permission. |

### setAutoTimeRequired

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setAutoTimeRequired(
    admin: ComponentName, 
    required: Boolean
): Unit
```

**Deprecated:** *From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int`. Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAutoTimeEnabled(android.content.ComponentName,%20kotlin.Boolean)` to turn auto time on or off and use `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DATE_TIME:kotlin.String` to prevent the user from changing this setting.*

Called by a device owner, or alternatively a profile owner from Android 8.0 (API level 26) or higher, to set whether auto time is required. If auto time is required, no user will be able set the date and time and network date and time will be used.

Note: If auto time is required the user can still manually set the time zone. Staring from Android 11, if auto time is required, the user cannot manually set the time zone.

The calling device admin must be a device owner, or alternatively a profile owner from Android 8.0 (API level 26) or higher. If it is not, a security exception will be thrown.

Staring from Android 11, this API switches to use `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DATE_TIME:kotlin.String` to enforce the auto time settings. Calling this API to enforce auto time will result in `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DATE_TIME:kotlin.String` being set, while calling this API to lift the requirement will result in `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DATE_TIME:kotlin.String` being cleared. From Android 11, this API can also no longer be called on a managed profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `required` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): Whether auto time is set required or not. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner, not a profile owner or if this API is called on a managed profile. |

### setAutoTimeZoneEnabled

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setAutoTimeZoneEnabled(
    admin: ComponentName?, 
    enabled: Boolean
): Unit
```

Called by a device owner, a profile owner for the primary user or a profile owner of an organization-owned managed profile to turn auto time zone on and off.

Callers are recommended to use `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DATE_TIME:kotlin.String` to prevent the user from changing this setting, that way no user will be able set the date and time zone.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with or Null if the caller is not a device admin. This value may be `null`. |
| `enabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): Whether time zone should be obtained automatically from the network or not. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device owner, a profile owner for the primary user, or a profile owner of an organization-owned managed profile. |

### setAutoTimeZonePolicy

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setAutoTimeZonePolicy(policy: Int): Unit
```

Called by a device owner, a profile owner for the primary user or a profile owner of an organization-owned managed profile to turn auto time zone on and off.

Callers are recommended to use `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DATE_TIME:kotlin.String` to prevent the user from changing this setting, that way no user will be able set the date and time zone.

| Parameters ||
|---|---|
| `policy` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The desired state among `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_ENABLED:kotlin.Int` to enable it, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_DISABLED:kotlin.Int` to disable it or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_NOT_CONTROLLED_BY_POLICY:kotlin.Int` to unset the policy. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_NOT_CONTROLLED_BY_POLICY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#AUTO_TIME_ZONE_ENABLED:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device owner, a profile owner for the primary user, or a profile owner of an organization-owned managed profile, or if the caller does not hold the required permission. |

### setBackupServiceEnabled

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setBackupServiceEnabled(
    admin: ComponentName, 
    enabled: Boolean
): Unit
```

Allows the device owner or profile owner to enable or disable the backup service.

Each user has its own backup service which manages the backup and restore mechanisms in that user. Disabling the backup service will prevent data from being backed up or restored.

Device owner calls this API to control backup services across all users on the device. Profile owner can use this API to enable or disable the profile's backup service. However, for a managed profile its backup functionality is only enabled if both the device owner and the profile owner have enabled the backup service.

By default, backup service is disabled on a device with device owner, and within a managed profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `enabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): `true` to enable the backup service, `false` to disable it. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner or a profile owner. |

### setBluetoothContactSharingDisabled

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setBluetoothContactSharingDisabled(
    admin: ComponentName, 
    disabled: Boolean
): Unit
```

Called by a profile owner of a managed profile to set whether bluetooth devices can access enterprise contacts.

The calling device admin must be a profile owner. If it is not, a security exception will be thrown.

This API works on managed profile only.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `disabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): If true, bluetooth devices cannot access enterprise contacts. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner. |

### setCameraDisabled

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setCameraDisabled(
    admin: ComponentName?, 
    disabled: Boolean
): Unit
```

Called by an application that is administering the device to disable all cameras on the device, for this user. After setting this, no applications running as this user will be able to access any cameras on the device.

Starting with Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#CINNAMON_BUN:kotlin.Int`, this method also blocks application access to external USB cameras that connect directly via the `https://developer.android.com/reference/kotlin/android/hardware/usb/UsbConstants.html#USB_CLASS_VIDEO:kotlin.Int` interface.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance, returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, where the caller must be the profile owner of an organization-owned managed profile.

If the caller is device owner, then the restriction will be applied to all users. If called on the parent instance, then the restriction will be applied on the personal profile.

The calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_DISABLE_CAMERA:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

**Note** , this policy type is deprecated for legacy device admins since `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int`. On Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int` devices, legacy device admins targeting SDK version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#P:kotlin.Int` or below can still call this API to disable camera, while legacy device admins targeting SDK version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int` will receive a SecurityException. Starting from Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int`, requests to disable camera from legacy device admins targeting SDK version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#P:kotlin.Int` or below will be silently ignored.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, after the camera disabled policy has been set, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully set or not. This callback will contain:

- The policy identifier: userRestriction_no_camera
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully set or the reason the policy failed to be set (e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with or null if the caller is not a device admin |
| `disabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): Whether or not the camera should be disabled. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not an active administrator or does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_DISABLE_CAMERA:kotlin.Int`. |

### setCertInstallerPackage

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setCertInstallerPackage(
    admin: ComponentName, 
    installerPackage: String?
): Unit
```

**Deprecated:** *From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#O:kotlin.Int`. Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)` with the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_INSTALL:kotlin.String` scope instead.*

Called by a profile owner or device owner to grant access to privileged certificate manipulation APIs to a third-party certificate installer app. Granted APIs include `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getInstalledCaCerts(android.content.ComponentName)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#hasCaCertInstalled(android.content.ComponentName,%20kotlin.ByteArray)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#installCaCert(android.content.ComponentName,%20kotlin.ByteArray)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#uninstallCaCert(android.content.ComponentName,%20kotlin.ByteArray)`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#uninstallAllUserCaCerts(android.content.ComponentName)` and #installKeyPair.

Delegated certificate installer is a per-user state. The delegated access is persistent until it is later cleared by calling this method with a null value or uninstalling the certificate installer.

**Note:** Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int`, if the caller application's target SDK version is `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int` or newer, the supplied certificate installer package must be installed when calling this API, otherwise an `https://developer.android.com/reference/kotlin/java/lang/IllegalArgumentException.html#` will be thrown.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `installerPackage` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: The package name of the certificate installer which will be given access. If `null` is given the current package will be cleared. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or a profile owner. |

### setCommonCriteriaModeEnabled

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setCommonCriteriaModeEnabled(
    admin: ComponentName?, 
    enabled: Boolean
): Unit
```

Called by device owner or profile owner of an organization-owned managed profile to toggle Common Criteria mode for the device. When the device is in Common Criteria mode, certain device functionalities are tuned to meet the higher security level required by Common Criteria certification. For example:

- Bluetooth long term key material is additionally integrity-protected with AES-GCM.
- WiFi configuration store is additionally integrity-protected with AES-GCM.

Common Criteria mode is disabled by default.

<br />

*Note:* if Common Critera mode is turned off after being enabled previously, all existing WiFi configurations will be lost.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `enabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): whether Common Criteria mode should be enabled or not. |

### setConfiguredNetworksLockdownState

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setConfiguredNetworksLockdownState(
    admin: ComponentName?, 
    lockdown: Boolean
): Unit
```

Called by a device owner or a profile owner of an organization-owned managed profile to control whether the user can change networks configured by the admin. When this lockdown is enabled, the user can still configure and connect to other Wi-Fi networks, or use other Wi-Fi capabilities such as tethering.

WiFi network configuration lockdown is controlled by a global settings `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN:kotlin.String` and calling this API effectively modifies the global settings. Previously device owners can also control this directly via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setGlobalSetting(android.content.ComponentName,%20kotlin.String,%20kotlin.String)` but they are recommended to switch to this API.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: admin Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `lockdown` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): Whether the admin configured networks should be unmodifiable by the user. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device owner or a profile owner of an organization-owned managed profile. |

### setContentProtectionPolicy

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setContentProtectionPolicy(
    admin: ComponentName?, 
    policy: Int
): Unit
```

Sets the content protection policy which controls scanning for deceptive apps.

This policy can be set by a device owner, a profile owner, or holders of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CONTENT_PROTECTION:kotlin.String`. Any policy set via this method will be cleared if the user becomes unaffiliated.

After the content protection policy has been set, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully set or not. This callback will contain:

- The policy identifier `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyIdentifiers#CONTENT_PROTECTION_POLICY:kotlin.String`
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully set or the reason the policy failed to be set (e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `policy` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The content protection policy to set. One of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#CONTENT_PROTECTION_NOT_CONTROLLED_BY_POLICY:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#CONTENT_PROTECTION_DISABLED:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#CONTENT_PROTECTION_ENABLED:kotlin.Int`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#CONTENT_PROTECTION_NOT_CONTROLLED_BY_POLICY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#CONTENT_PROTECTION_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#CONTENT_PROTECTION_ENABLED:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not the device owner, a profile owner, or a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_CONTENT_PROTECTION:kotlin.String`. |

### setCredentialManagerPolicy

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setCredentialManagerPolicy(policy: PackagePolicy?): Unit
```

Called by a device owner or profile owner of a managed profile to set the credential manager policy.

Affects APIs exposed by `https://developer.android.com/reference/kotlin/android/credentials/CredentialManager.html#`.

A `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy#PACKAGE_POLICY_ALLOWLIST:kotlin.Int` policy type will limit the credential providers that the user can use to the list of packages in the policy.

A `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy#PACKAGE_POLICY_ALLOWLIST_AND_SYSTEM:kotlin.Int` policy type allows access from the OEM default credential providers and the allowlist of credential providers.

A `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy#PACKAGE_POLICY_BLOCKLIST:kotlin.Int` policy type will block the credential providers listed in the policy from being used by the user.

| Parameters ||
|---|---|
| `policy` | [PackagePolicy](https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy)?: the policy to set, setting this value to `null` will allow all packages |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device owner or profile owner of a managed profile |

### setCrossProfileCalendarPackages

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setCrossProfileCalendarPackages(
    admin: ComponentName, 
    packageNames: MutableSet<String!>?
): Unit
```

**Deprecated:** *Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setCrossProfilePackages(android.content.ComponentName,%20kotlin.collections.MutableSet)`.*

Allows a set of packages to access cross-profile calendar APIs.

Called by a profile owner of a managed profile.

Calling with a `null` value for the set disables the restriction so that all packages are allowed to access cross-profile calendar APIs. Calling with an empty set disallows all packages from accessing cross-profile calendar APIs. If this method isn't called, no package is allowed to access cross-profile calendar APIs by default.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `packageNames` | [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>?: set of packages to be allowlisted. This value may be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCrossProfileCalendarPackages(android.content.ComponentName)`

### setCrossProfileCallerIdDisabled

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setCrossProfileCallerIdDisabled(
    admin: ComponentName, 
    disabled: Boolean
): Unit
```

**Deprecated:** *starting with `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedProfileCallerIdAccessPolicy(android.app.admin.PackagePolicy)` instead*

Called by a profile owner of a managed profile to set whether caller-Id information from the managed profile will be shown in the parent profile, for incoming calls.

The calling device admin must be a profile owner. If it is not, a security exception will be thrown.

Starting with `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, calling this function is similar to calling `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedProfileCallerIdAccessPolicy(android.app.admin.PackagePolicy)` with a `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy#PACKAGE_POLICY_BLOCKLIST:kotlin.Int` policy type when `disabled` is false or a `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy#PACKAGE_POLICY_ALLOWLIST:kotlin.Int` policy type when `disabled` is true.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `disabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): If true caller-Id information in the managed profile is not displayed. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner. |

### setCrossProfileContactsSearchDisabled

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setCrossProfileContactsSearchDisabled(
    admin: ComponentName, 
    disabled: Boolean
): Unit
```

**Deprecated:** *From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedProfileContactsAccessPolicy(android.app.admin.PackagePolicy)`*

Called by a profile owner of a managed profile to set whether contacts search from the managed profile will be shown in the parent profile, for incoming calls.

The calling device admin must be a profile owner. If it is not, a security exception will be thrown. Starting with `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, calling this function is similar to calling `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedProfileContactsAccessPolicy(android.app.admin.PackagePolicy)` with a `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy#PACKAGE_POLICY_BLOCKLIST:kotlin.Int` policy type when `disabled` is false or a `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy#PACKAGE_POLICY_ALLOWLIST:kotlin.Int` policy type when `disabled` is true.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `disabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): If true contacts search in the managed profile is not displayed. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner. |

### setCrossProfilePackages

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setCrossProfilePackages(
    admin: ComponentName, 
    packageNames: MutableSet<String!>
): Unit
```

Sets the set of admin-allowlisted package names that are allowed to request user consent for cross-profile communication.

Assumes that the caller is a profile owner and is the given `admin`.

Previous calls are overridden by each subsequent call to this method.

Note that other apps may be able to request user consent for cross-profile communication if they have been explicitly allowlisted by the OEM.

When previously-set cross-profile packages are missing from `packageNames`, the app-op for `INTERACT_ACROSS_PROFILES` will be reset for those packages. This will not occur for packages that are allowlisted by the OEM.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): the `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `packageNames` | [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>: the new cross-profile package names. This value cannot be `null`. |

### setCrossProfileWidgetProviders

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setCrossProfileWidgetProviders(packageNames: MutableSet<String!>): Unit
```

Called by the profile owner of a managed profile or a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_PROFILE_INTERACTION:kotlin.String` to enable widget providers from packages to be available in the parent profile. As a result the user will be able to add widgets from the allowlisted package running under the profile to a widget host which runs under the parent profile, for example the home screen. Note that a package may have zero or more provider components, where each component provides a different widget type.

**Note:** By default no widget provider package is allowlisted.

**Note:** This API updates the entire allowlist in one-go, overriding any previous allowlist. This is more efficient than using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addCrossProfileWidgetProvider(android.content.ComponentName,%20kotlin.String)` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#removeCrossProfileWidgetProvider(android.content.ComponentName,%20kotlin.String)` to update the allowlist one package a time, especially if the allowlist consists of many packages.

| Parameters ||
|---|---|
| `packageNames` | [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>: The packages from which widget providers are allowlisted. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner and not a holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_PROFILE_INTERACTION:kotlin.String`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getCrossProfileWidgetProviders(android.content.ComponentName)`

### setDefaultDialerApplication

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setDefaultDialerApplication(packageName: String): Unit
```

Must be called by a device owner or a profile owner of an organization-owned managed profile to set the default dialer application for the calling user.

When the profile owner of an organization-owned managed profile calls this method, it sets the default dialer application in the work profile. This is only meaningful when work profile telephony is enabled by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedSubscriptionsPolicy(android.app.admin.ManagedSubscriptionsPolicy)`.

If the device does not support telephony (`https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_TELEPHONY:kotlin.String`), calling this method will do nothing.

| Parameters ||
|---|---|
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The name of the package to set as the default dialer application. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if the package cannot be set as the default dialer, for example if the package is not installed or does not expose the expected activities or services that a dialer app is required to have. |
| `java.lang.SecurityException` | if `admin` is not a device or profile owner or a profile owner of an organization-owned managed profile. |

### setDefaultSmsApplication

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setDefaultSmsApplication(
    admin: ComponentName?, 
    packageName: String
): Unit
```

Must be called by a device owner or a profile owner of an organization-owned managed profile to set the default SMS application.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance, returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, where the caller must be the profile owner of an organization-owned managed profile and the package must be a pre-installed system package. If called on the parent instance, then the default SMS application is set on the personal profile.

Starting from Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, the profile owner of an organization-owned managed profile can also call this method directly (not on the parent profile instance) to set the default SMS application in the work profile. This is only meaningful when work profile telephony is enabled by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setManagedSubscriptionsPolicy(android.app.admin.ManagedSubscriptionsPolicy)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The name of the package to set as the default SMS application. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if called on the parent profile and the package provided is not a pre-installed system package. |
| `java.lang.IllegalStateException` | while trying to set default sms app on the profile and `https://developer.android.com/reference/kotlin/android/app/admin/ManagedSubscriptionsPolicy#TYPE_ALL_MANAGED_SUBSCRIPTIONS:kotlin.Int` policy is not set. |
| `java.lang.SecurityException` | if `admin` is not a device or profile owner or if called on the parent profile and the `admin` is not a profile owner of an organization-owned managed profile. |

### setDelegatedScopes

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setDelegatedScopes(
    admin: ComponentName, 
    delegatePackage: String, 
    scopes: MutableList<String!>
): Unit
```

Called by a profile owner or device owner to grant access to privileged APIs to another app. Granted APIs are determined by `scopes`, which is a list of the `DELEGATION_*` constants.

A broadcast with the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_APPLICATION_DELEGATION_SCOPES_CHANGED:kotlin.String` action will be sent to the `delegatePackage` with its new scopes in an `ArrayList<String>` extra under the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_DELEGATION_SCOPES:kotlin.String` key. The broadcast is sent with the `https://developer.android.com/reference/kotlin/android/content/Intent.html#FLAG_RECEIVER_REGISTERED_ONLY:kotlin.Int` flag.

Delegated scopes are a per-user state. The delegated access is persistent until it is later cleared by calling this method with an empty `scopes` list or uninstalling the `delegatePackage`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `delegatePackage` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The package name of the app which will be given access. This value cannot be `null`. |
| `scopes` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>: The groups of privileged APIs whose access should be granted to `delegatedPackage`. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or a profile owner. |

### setDeviceOwnerLockScreenInfo

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setDeviceOwnerLockScreenInfo(
    admin: ComponentName?, 
    info: CharSequence!
): Unit
```

Sets the device owner information to be shown on the lock screen.

Device owner information set using this method overrides any owner information manually set by the user and prevents the user from further changing it.

If the device owner information is `null` or empty then the device owner info is cleared and the user owner info is shown on the lock screen if it is set.

If the device owner information contains only whitespaces then the message on the lock screen will be blank and the user will not be allowed to change it.

If the device owner information needs to be localized, it is the responsibility of the `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` to listen to the `https://developer.android.com/reference/kotlin/android/content/Intent.html#ACTION_LOCALE_CHANGED:kotlin.String` broadcast and set a new version of this string accordingly.

May be called by the device owner or the profile owner of an organization-owned device.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The name of the admin component to check. Null if the caller is not a device admin. This value may be `null`. |
| `info` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!: Device owner information which will be displayed instead of the user owner info. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

### setEndUserSessionMessage

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setEndUserSessionMessage(
    admin: ComponentName, 
    endUserSessionMessage: CharSequence?
): Unit
```

Called by a device owner to specify the user session end message. This may be displayed during a user switch.

The message should be limited to a short statement or it may be truncated.

If the message needs to be localized, it is the responsibility of the `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` to listen to the `https://developer.android.com/reference/kotlin/android/content/Intent.html#ACTION_LOCALE_CHANGED:kotlin.String` broadcast and set a new version of this message accordingly.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `endUserSessionMessage` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)?: message for ending user session, or `null` to use system default message. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

### setFactoryResetProtectionPolicy

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setFactoryResetProtectionPolicy(
    admin: ComponentName?, 
    policy: FactoryResetProtectionPolicy?
): Unit
```

Callable by device owner or profile owner of an organization-owned device, to set a factory reset protection (FRP) policy. When a new policy is set, the system notifies the FRP management agent of a policy change by broadcasting `ACTION_RESET_PROTECTION_POLICY_CHANGED`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `policy` | [FactoryResetProtectionPolicy](https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy)?: the new FRP policy, or `null` to clear the current policy. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner or a profile owner of an organization-owned device. |
| `java.lang.UnsupportedOperationException` | if factory reset protection is not supported on the device. |

### setGlobalPrivateDnsModeOpportunistic

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setGlobalPrivateDnsModeOpportunistic(admin: ComponentName): Int
```

Sets the global Private DNS mode to opportunistic. May be called by the device owner. Starting from Android 18, it can also be called by the profile owner of an organization-owned device.

In this mode, the DNS subsystem will attempt a TLS handshake to the network-supplied resolver prior to attempting name resolution in cleartext.

Note: The device owner won't be able to set the global private DNS mode if there are unaffiliated secondary users or profiles on the device. It's recommended that affiliation ids are set for new users as soon as possible after provisioning via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `PRIVATE_DNS_SET_NO_ERROR` if the mode was set successfully, or `PRIVATE_DNS_SET_ERROR_FAILURE_SETTING` if it could not be set. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PRIVATE_DNS_SET_NO_ERROR:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PRIVATE_DNS_SET_ERROR_HOST_NOT_SERVING:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PRIVATE_DNS_SET_ERROR_FAILURE_SETTING:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is neither the device owner nor the profile owner of an organization-owned device. |

### setGlobalPrivateDnsModeSpecifiedHost

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setGlobalPrivateDnsModeSpecifiedHost(
    admin: ComponentName, 
    privateDnsHost: String
): Int
```

Sets the global Private DNS host to be used.

May only be called by the device owner.

Note that the method is blocking as it will perform a connectivity check to the resolver, to ensure it is valid. Because of that, the method should not be called on any thread that relates to user interaction, such as the UI thread.

In case a VPN is used in conjunction with Private DNS resolver, the Private DNS resolver must be reachable both from within and outside the VPN. Otherwise, the device may lose the ability to resolve hostnames as system traffic to the resolver may not go through the VPN.

Note: The device owner won't be able to set the global private DNS mode if there are unaffiliated secondary users or profiles on the device. It's recommended that affiliation ids are set for new users as soon as possible after provisioning via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)`.   
This method may take several seconds to complete, so it should only be called from a worker thread.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `privateDnsHost` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The hostname of a server that implements DNS over TLS (RFC7858). This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `PRIVATE_DNS_SET_NO_ERROR` if the mode was set successfully. Returns `PRIVATE_DNS_SET_ERROR_FAILURE_SETTING` if it could not be set. Returns `PRIVATE_DNS_SET_ERROR_HOST_NOT_SERVING` if the specified host does not implement RFC7858. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PRIVATE_DNS_SET_NO_ERROR:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PRIVATE_DNS_SET_ERROR_HOST_NOT_SERVING:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PRIVATE_DNS_SET_ERROR_FAILURE_SETTING:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if the `privateDnsHost` is not a valid hostname. |
| `java.lang.SecurityException` | if the caller is not the device owner. |

### setGlobalSetting

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setGlobalSetting(
    admin: ComponentName, 
    setting: String!, 
    value: String!
): Unit
```

This method is mostly deprecated. Most of the settings that still have an effect have dedicated setter methods or user restrictions. See individual settings for details.

Called by device owner to update `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#` settings. Validation that the value of the setting is in the correct form for the setting type should be performed by the caller.

The settings that can be updated with this method are:

- `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#ADB_ENABLED:kotlin.String` : use `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_DEBUGGING_FEATURES:kotlin.String` instead to restrict users from enabling debugging features and this setting to turn adb on.
- `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#USB_MASS_STORAGE_ENABLED:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#STAY_ON_WHILE_PLUGGED_IN:kotlin.String` This setting is only available from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int` onwards and can only be set if `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setMaximumTimeToLock(android.content.ComponentName,%20kotlin.Long)` is not used to set a timeout.
- `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN:kotlin.String`
This setting is only available from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int` onwards.

The following settings used to be supported, but can be controlled in other ways:

- `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#AUTO_TIME:kotlin.String` : Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAutoTimeEnabled(android.content.ComponentName,%20kotlin.Boolean)` and `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DATE_TIME:kotlin.String` instead.
- `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#AUTO_TIME_ZONE:kotlin.String` : Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAutoTimeZoneEnabled(android.content.ComponentName,%20kotlin.Boolean)` and `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CONFIG_DATE_TIME:kotlin.String` instead.
- `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#DATA_ROAMING:kotlin.String` : Use `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_DATA_ROAMING:kotlin.String` instead.

Changing the following settings has no effect as of `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int`:

- `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#BLUETOOTH_ON:kotlin.String`. Use `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothAdapter.html#enable()` and `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothAdapter.html#disable()` instead.
- `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#DEVELOPMENT_SETTINGS_ENABLED:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#MODE_RINGER:kotlin.String`. Use `https://developer.android.com/reference/kotlin/android/media/AudioManager.html#setRingerMode(kotlin.Int)` instead.
- `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#NETWORK_PREFERENCE:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#WIFI_ON:kotlin.String`. Use `https://developer.android.com/reference/kotlin/android/net/wifi/WifiManager.html#setWifiEnabled(kotlin.Boolean)` instead.
- `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#WIFI_SLEEP_POLICY:kotlin.String`. No longer has effect.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `setting` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The name of the setting to update. |
| `value` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The value to update the setting to. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

### setKeepUninstalledPackages

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setKeepUninstalledPackages(
    admin: ComponentName?, 
    packageNames: MutableList<String!>
): Unit
```

Set a list of apps to keep around as APKs even if no user has currently installed it. This function can be called by a device owner or by a delegate given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_KEEP_UNINSTALLED_PACKAGES:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`.

Please note that setting this policy does not imply that specified apps will be automatically pre-cached.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if the caller is a keep uninstalled packages delegate. |
| `packageNames` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>: List of package names to keep cached. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_KEEP_UNINSTALLED_PACKAGES:kotlin.String`

### setKeyPairCertificate

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setKeyPairCertificate(
    admin: ComponentName?, 
    alias: String, 
    certs: MutableList<Certificate!>, 
    isUserSelectable: Boolean
): Boolean
```

This API can be called by the following to associate certificates with a key pair that was generated using #generateKeyPair, and set whether the key is available for the user to choose in the certificate selection prompt:

- Device owner
- Profile owner
- Delegated certificate installer
- Credential management app

<br />

From Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int`, the credential management app can call this API. If called by the credential management app, the componentName must be `null`. Note, there can only be a credential management app on an unmanaged device.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if the caller is not a device admin. |
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The private key alias under which to install the certificate. The `alias` should denote an existing private key. If a certificate with that alias already exists, it will be overwritten. This value cannot be `null`. |
| `certs` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[Certificate](https://developer.android.com/reference/kotlin/java/security/cert/Certificate.html#)!\>: The certificate chain to install. The chain should start with the leaf certificate and include the chain of trust in order. This will be returned by `https://developer.android.com/reference/kotlin/android/security/KeyChain.html#getCertificateChain(android.content.Context,%20kotlin.String)`. This value cannot be `null`. |
| `isUserSelectable` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): `true` to indicate that a user can select this key via the certificate selection prompt, `false` to indicate that this key can only be granted access by implementing `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onChoosePrivateKeyAlias(android.content.Context,%20android.content.Intent,%20kotlin.Int,%20android.net.Uri,%20kotlin.String)`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the provided `alias` exists and the certificates has been successfully associated with it, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not `null` and not a device or profile owner, or `admin` is null but the calling application is not a delegated certificate installer or credential management app. |

### setKeyPairCertificate

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setKeyPairCertificate(
    alias: String, 
    certs: MutableList<Certificate!>, 
    isUserSelectable: Boolean, 
    scope: Int
): Boolean
```

Associates certificate chain with a specific scoped key.

This method extends `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setKeyPairCertificate(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList,%20kotlin.Boolean)`, adding the `scope` parameter to determine if the certificates should be associated with a key pair in user-specific or device-wide keychain.

Key differences in this overload:

- Using `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`: The certificates will be associated with a key pair in the device-wide keychain. The caller MUST be running in an affiliated user to manage device keys. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`. Credential management apps are not permitted to use this scope.
- Using `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int`: The certificates will be associated with a key pair in the calling user's own keychain.

| Parameters ||
|---|---|
| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The private key alias under which to install the certificate. This value cannot be `null`. |
| `certs` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[Certificate](https://developer.android.com/reference/kotlin/java/security/cert/Certificate.html#)!\>: The certificate chain to install. This value cannot be `null`. |
| `isUserSelectable` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): `true` to indicate that a user can select this key via the certificate selection prompt, `false` to indicate that this key can only be granted access by implementing `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onChoosePrivateKeyAlias(android.content.Context,%20android.content.Intent,%20kotlin.Int,%20android.net.Uri,%20kotlin.String)` or calling #grantKeyPairToApp and #grantKeyPairToWifiAuth. |
| `scope` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The scope of the key pair: `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/security/KeyChainManager.html#KEYPAIR_SCOPE_DEVICE:kotlin.Int` |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the certificates were associated successfully, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not authorized. |

### setKeyguardDisabled

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setKeyguardDisabled(
    admin: ComponentName, 
    disabled: Boolean
): Boolean
```

Called by a device owner or profile owner of secondary users that is affiliated with the device to disable the keyguard altogether.

Setting the keyguard to disabled has the same effect as choosing "None" as the screen lock type. However, this call has no effect if a password, pin or pattern is currently set. If a password, pin or pattern is set after the keyguard was disabled, the keyguard stops being disabled.

As of `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#P:kotlin.Int`, this call also dismisses the keyguard if it is currently shown.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `disabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): `true` disables the keyguard, `false` reenables it. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `false` if attempting to disable the keyguard while a lock password was in place. `true` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not the device owner, or a profile owner of secondary user that is affiliated with the device. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getSecondaryUsers(android.content.ComponentName)`

### setKeyguardDisabledFeatures

Added in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setKeyguardDisabledFeatures(
    admin: ComponentName?, 
    which: Int
): Unit
```

Called by an application that is administering the device to disable keyguard customizations, such as widgets. After setting this, keyguard features will be disabled according to the provided feature list.

A calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_DISABLE_KEYGUARD_FEATURES:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

Calling this from a managed profile before version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int` will throw a security exception. From version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int` the profile owner of a managed profile can set:

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_TRUST_AGENTS:kotlin.Int`, which affects the parent user, but only if there is no separate challenge set on the managed profile.
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_FINGERPRINT:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_FACE:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_IRIS:kotlin.Int` which affects the managed profile challenge if there is one, or the parent user otherwise.
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS:kotlin.Int` which affects notifications generated by applications in the managed profile.

From version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#VANILLA_ICE_CREAM:kotlin.Int`, the profile owner of a managed profile can also set `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_WIDGETS_ALL:kotlin.Int` which disables keyguard widgets for the managed profile.

From version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` the profile owner of an organization-owned managed profile can set:

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_SECURE_CAMERA:kotlin.Int` which affects the parent user when called on the parent profile.
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_SECURE_NOTIFICATIONS:kotlin.Int` which affects the parent user when called on the parent profile.

Starting from version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#VANILLA_ICE_CREAM:kotlin.Int` the profile owner of an organization-owned managed profile can set:

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_WIDGETS_ALL:kotlin.Int` which affects the parent user when called on the parent profile.

`https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_TRUST_AGENTS:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_FINGERPRINT:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_FACE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_IRIS:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_SECURE_CAMERA:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_SECURE_NOTIFICATIONS:kotlin.Int` can also be set on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set restrictions on the parent profile. `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_SECURE_CAMERA:kotlin.Int` can only be set on the parent profile instance if the calling device admin is the profile owner of an organization-owned managed profile.

Requests to disable other features on a managed profile will be ignored.

The admin can check which features have been disabled by calling `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getKeyguardDisabledFeatures(android.content.ComponentName)`

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `which` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The disabled features flag which can be either `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_FEATURES_NONE:kotlin.Int` (default), `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_FEATURES_ALL:kotlin.Int`, or a combination of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_WIDGETS_ALL:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_SECURE_CAMERA:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_SECURE_NOTIFICATIONS:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_TRUST_AGENTS:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_FINGERPRINT:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_FACE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_IRIS:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_SHORTCUTS_ALL:kotlin.Int`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not an active administrator or does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_DISABLE_KEYGUARD_FEATURES:kotlin.Int` |

### setLocationEnabled

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setLocationEnabled(
    admin: ComponentName, 
    locationEnabled: Boolean
): Unit
```

Called by device owners to set the user's global location setting.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `locationEnabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): whether location should be enabled or disabled. **Note:** on `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_AUTOMOTIVE:kotlin.String`, calls to disable will be ignored. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

### setLockTaskFeatures

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setLockTaskFeatures(
    admin: ComponentName?, 
    flags: Int
): Unit
```

Sets which system features are enabled when the device runs in lock task mode. This method doesn't affect the features when lock task mode is inactive. Any system features not included in `flags` are implicitly disabled when calling this method. By default, only `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_GLOBAL_ACTIONS:kotlin.Int` is enabled; all the other features are disabled. To disable the global actions dialog, call this method omitting `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_GLOBAL_ACTIONS:kotlin.Int`.

This method can only be called by the device owner, a profile owner of an affiliated user or profile, or the profile owner when no device owner is set or holders of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_LOCK_TASK:kotlin.String`. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`. Any features set using this method are cleared if the user becomes unaffiliated.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, after the lock task features policy has been set, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully set or not. This callback will contain:

- The policy identifier `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyIdentifiers#LOCK_TASK_POLICY:kotlin.String`
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully set or the reason the policy failed to be set (e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, lock task features and lock task packages are bundled as one policy. A failure to apply one will result in a failure to apply the other.

**Warning:** Do not use this method in Android Automotive environments featuring android.content.pm.PackageManager#FEATURE_CAR_SPLITSCREEN_MULTITASKING. This automotive split-screen multi-tasking feature does not support Lock Task Mode. Consequently, if this method is called in such an environment, it will not work as expected, and the app will not remain locked as the single, exclusive application.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The system features enabled during lock task mode. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_NONE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_SYSTEM_INFO:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_NOTIFICATIONS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_HOME:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_OVERVIEW:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_GLOBAL_ACTIONS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_KEYGUARD:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_BLOCK_ACTIVITY_START_IN_TASK:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not the device owner, the profile owner of an affiliated user or profile, or the profile owner when no device owner is set or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_LOCK_TASK:kotlin.String`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`

### setLockTaskPackages

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setLockTaskPackages(
    admin: ComponentName?, 
    packages: Array<String!>
): Unit
```

Sets which packages may enter lock task mode.

Any packages that share uid with an allowed package will also be allowed to activate lock task. From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int` removing packages from the lock task package list results in locked tasks belonging to those packages to be finished.

This function can only be called by the device owner, a profile owner of an affiliated user or profile, or the profile owner when no device owner is set or holders of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_LOCK_TASK:kotlin.String`. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`. Any package set via this method will be cleared if the user becomes unaffiliated.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, after the lock task policy has been set, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully set or not. This callback will contain:

- The policy identifier `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyIdentifiers#LOCK_TASK_POLICY:kotlin.String`
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully set or the reason the policy failed to be set (e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, lock task features and lock task packages are bundled as one policy. A failure to apply one will result in a failure to apply the other.

**Warning:** Do not use this method in Android Automotive environments featuring android.content.pm.PackageManager#FEATURE_CAR_SPLITSCREEN_MULTITASKING. This automotive split-screen multi-tasking feature does not support Lock Task Mode. Consequently, if this method is called in such an environment, it will not work as expected, and the app will not remain locked as the single, exclusive application.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `packages` | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>: The list of packages allowed to enter lock task mode. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not the device owner, the profile owner of an affiliated user or profile, or the profile owner when no device owner is set or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_LOCK_TASK:kotlin.String`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`
- `https://developer.android.com/reference/kotlin/android/app/Activity.html#startLockTask()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onLockTaskModeEntering(android.content.Context,%20android.content.Intent,%20kotlin.String)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onLockTaskModeExiting(android.content.Context,%20android.content.Intent)`
- `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_CREATE_WINDOWS:kotlin.String`

### setLogoutEnabled

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setLogoutEnabled(
    admin: ComponentName, 
    enabled: Boolean
): Unit
```

Called by a device owner to specify whether logout is enabled for all secondary users. The system may show a logout button that stops the user and switches back to the primary user.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `enabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): whether logout should be enabled or not. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

### setLongSupportMessage

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setLongSupportMessage(
    admin: ComponentName, 
    message: CharSequence?
): Unit
```

Called by a device admin to set the long support message. This will be displayed to the user in the device administrators settings screen. If the message is longer than 20000 characters it may be truncated.

If the long support message needs to be localized, it is the responsibility of the `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` to listen to the `https://developer.android.com/reference/kotlin/android/content/Intent.html#ACTION_LOCALE_CHANGED:kotlin.String` broadcast and set a new version of this string accordingly.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `message` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)?: Long message to be displayed to the user in settings or null to clear the existing message. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not an active administrator. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setShortSupportMessage(android.content.ComponentName,%20kotlin.CharSequence)`

### setManagedProfileCallerIdAccessPolicy

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setManagedProfileCallerIdAccessPolicy(policy: PackagePolicy?): Unit
```

Called by a profile owner of a managed profile to set the packages that are allowed to lookup contacts in the managed profile based on caller id information.

For example, the policy determines if a dialer app in the parent profile resolving an incoming call can search the caller id data, such as phone number, of managed contacts and return managed contacts that match.

The calling device admin must be a profile owner of a managed profile. If it is not, a `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#` will be thrown.

A `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy#PACKAGE_POLICY_ALLOWLIST_AND_SYSTEM:kotlin.Int` policy type allows access from the OEM default packages for the Sms, Dialer and Contact roles, in addition to the packages specified in `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy#getPackageNames()`

| Parameters ||
|---|---|
| `policy` | [PackagePolicy](https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy)?: the policy to set, setting this value to `null` will allow all packages |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a profile owner of a managed profile |

### setManagedProfileContactsAccessPolicy

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setManagedProfileContactsAccessPolicy(policy: PackagePolicy?): Unit
```

Called by a profile owner of a managed profile to set the packages that are allowed access to the managed profile contacts from the parent user.

For example, the system will enforce the provided policy and determine if contacts in the managed profile are shown when queried by an application in the parent user.

The calling device admin must be a profile owner of a managed profile. If it is not, a `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#` will be thrown.

A `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy#PACKAGE_POLICY_ALLOWLIST_AND_SYSTEM:kotlin.Int` policy type allows access from the OEM default packages for the Sms, Dialer and Contact roles, in addition to the packages specified in `https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy#getPackageNames()`

| Parameters ||
|---|---|
| `policy` | [PackagePolicy](https://developer.android.com/reference/kotlin/android/app/admin/PackagePolicy)?: the policy to set, setting this value to `null` will allow all packages |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a profile owner of a managed profile |

### setManagedProfileMaximumTimeOff

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setManagedProfileMaximumTimeOff(
    admin: ComponentName, 
    timeoutMillis: Long
): Unit
```

Called by a profile owner of an organization-owned managed profile to set maximum time the profile is allowed to be turned off. If the profile is turned off for longer, personal apps are suspended on the device.

When personal apps are suspended, an ongoing notification about that is shown to the user. When the user taps the notification, system invokes `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_CHECK_POLICY_COMPLIANCE:kotlin.String` in the profile owner package. Profile owner implementation that uses personal apps suspension must handle this intent.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `timeoutMillis` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): Maximum time the profile is allowed to be off in milliseconds or 0 if not limited. The minimum non-zero value corresponds to 72 hours. If an admin sets a smaller non-zero value, 72 hours will be set instead. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the profile owner doesn't have an activity that handles `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_CHECK_POLICY_COMPLIANCE:kotlin.String` |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPersonalAppsSuspended(android.content.ComponentName,%20kotlin.Boolean)`

### setManagedSubscriptionsPolicy

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setManagedSubscriptionsPolicy(policy: ManagedSubscriptionsPolicy?): Unit
```

Called by a profile owner of an organization-owned device to specify `https://developer.android.com/reference/kotlin/android/app/admin/ManagedSubscriptionsPolicy`

Managed subscriptions policy controls how SIMs would be associated with the managed profile. For example a policy of type `https://developer.android.com/reference/kotlin/android/app/admin/ManagedSubscriptionsPolicy#TYPE_ALL_MANAGED_SUBSCRIPTIONS:kotlin.Int` assigns all SIM-based subscriptions to the managed profile. In this case OEM default dialer and messages app are automatically installed in the managed profile and all incoming and outgoing calls and text messages are handled by them.

This API can only be called during device setup.

| Parameters ||
|---|---|
| `policy` | [ManagedSubscriptionsPolicy](https://developer.android.com/reference/kotlin/android/app/admin/ManagedSubscriptionsPolicy)?: `https://developer.android.com/reference/kotlin/android/app/admin/ManagedSubscriptionsPolicy` policy, passing null for this resets the policy to be the default. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if called after the device setup has been completed. |
| `java.lang.SecurityException` | if the caller is not a profile owner on an organization-owned managed profile. |
| `java.lang.UnsupportedOperationException` | if managed subscriptions policy is not explicitly enabled by the device policy management role holder during device setup. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/ManagedSubscriptionsPolicy`

### setMasterVolumeMuted

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setMasterVolumeMuted(
    admin: ComponentName, 
    on: Boolean
): Unit
```

Called by profile or device owners to set the global volume mute on or off. This has no effect when set on a managed profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `on` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): `true` to mute global volume, `false` to turn mute off. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### setMaximumFailedPasswordsForWipe

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setMaximumFailedPasswordsForWipe(
    admin: ComponentName?, 
    num: Int
): Unit
```

Setting this to a value greater than zero enables a policy that will perform a device or profile wipe after too many incorrect device-unlock passwords have been entered. This policy combines watching for failed passwords and wiping the device, and requires that calling Device Admins request both `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_WATCH_LOGIN:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_WIPE_DATA:kotlin.Int`}.

When this policy is set on the system or the main user, the device will be factory reset after too many incorrect password attempts. When set on any other user, only the corresponding user or profile will be wiped.

To implement any other policy (e.g. wiping data for a particular application only, erasing or revoking credentials, or reporting the failure to a server), you should implement `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onPasswordFailed(android.content.Context,%20android.content.Intent)` instead. Do not use this API, because if the maximum count is reached, the device or profile will be wiped immediately, and your callback will not be invoked.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set a value on the parent profile. This allows a profile wipe after too many incorrect device-unlock password have been entered on the parent profile even if each profile has a separate challenge.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always empty and this method has no effect - i.e. the policy is not set.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `num` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The number of failed password attempts at which point the device or profile will be wiped. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not null, and `admin` is not an active administrator or does not use both `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_WATCH_LOGIN:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_WIPE_DATA:kotlin.Int`, or if `admin` is null and the caller does not have permission to wipe the device. |

### setMaximumTimeToLock

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setMaximumTimeToLock(
    admin: ComponentName?, 
    timeMs: Long
): Unit
```

Called by an application that is administering the device to set the maximum time for user activity until the device will lock. This limits the length that the user can set. It takes effect immediately.

A calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_FORCE_LOCK:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set restrictions on the parent profile.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `timeMs` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The new desired maximum time to lock in milliseconds. A value of 0 means there is no restriction. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not an active administrator or it does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_FORCE_LOCK:kotlin.Int` |

### setMeteredDataDisabledPackages

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setMeteredDataDisabledPackages(
    admin: ComponentName, 
    packageNames: MutableList<String!>
): MutableList<String!>
```

Called by a device or profile owner to restrict packages from using metered data.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `packageNames` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>: the list of package names to be restricted. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>` | a list of package names which could not be restricted. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### setMinimumRequiredWifiSecurityLevel

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setMinimumRequiredWifiSecurityLevel(level: Int): Unit
```

Called by device owner or profile owner of an organization-owned managed profile to specify the minimum security level required for Wi-Fi networks. The device may not connect to networks that do not meet the minimum security level. If the current network does not meet the minimum security level set, it will be disconnected.

The security levels are explicitly ordered from least secure to most secure as follows:

1. `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_OPEN:kotlin.Int`
2. `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_PERSONAL:kotlin.Int`
3. `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_PERSONAL_WPA:kotlin.Int`
4. `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_EAP:kotlin.Int`
5. `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_192:kotlin.Int`

| Parameters ||
|---|---|
| `level` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): minimum security level. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_OPEN:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_PERSONAL:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_PERSONAL_WPA:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_EAP:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIFI_SECURITY_ENTERPRISE_192:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not permitted to set this policy |

### setMtePolicy

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setMtePolicy(policy: Int): Unit
```

Called by a device owner, profile owner of an organization-owned device, to set the Memory Tagging Extension (MTE) policy. MTE is a CPU extension that allows to protect against certain classes of security problems at a small runtime performance cost overhead.

The MTE policy can only be set to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MTE_DISABLED:kotlin.Int` if called by a device owner. Otherwise a `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#` will be thrown.

The device needs to be rebooted to apply changes to the MTE policy.

| Parameters ||
|---|---|
| `policy` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the MTE policy to be set. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MTE_ENABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MTE_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#MTE_NOT_CONTROLLED_BY_POLICY:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not permitted to set Mte policy |
| `java.lang.UnsupportedOperationException` | if the device does not support MTE |

### setNearbyAppStreamingPolicy

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setNearbyAppStreamingPolicy(policy: Int): Unit
```

Called by a device/profile owner to set nearby app streaming policy. App streaming is when the device starts an app on a virtual display and sends a video stream of the app to nearby devices.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance, returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, where the caller must be a profile owner of an organization-owned device. If called on the parent instance, the policy will be applied to the personal profile as well as any associated user profiles.

| Parameters ||
|---|---|
| `policy` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): One of the `NearbyStreamingPolicy` constants. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_ENABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device or profile owner. |

### setNearbyNotificationStreamingPolicy

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setNearbyNotificationStreamingPolicy(policy: Int): Unit
```

Called by a device/profile owner to set nearby notification streaming policy. Notification streaming is sending notification data from pre-installed apps to nearby devices.

| Parameters ||
|---|---|
| `policy` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): One of the `NearbyStreamingPolicy` constants. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_ENABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if caller is not a device or profile owner |

### setNetworkLoggingEnabled

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setNetworkLoggingEnabled(
    admin: ComponentName?, 
    enabled: Boolean
): Unit
```

Called by a device owner, profile owner of a managed profile or delegated app with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_NETWORK_LOGGING:kotlin.String` to control the network logging feature.

Supported for a device owner from Android 8 and a delegated app granted by a device owner from Android 10. Supported for a profile owner of a managed profile and a delegated app granted by a profile owner from Android 12. When network logging is enabled by a profile owner, the network logs will only include work profile network activity, not activity on the personal profile.

Network logs contain DNS lookup and connect() library call events. The following library functions are recorded while network logging is active:

- `getaddrinfo()`
- `gethostbyname()`
- `connect()`

Network logging is a low-overhead tool for forensics but it is not guaranteed to use full system call logging; event reporting is enabled by default for all processes but not strongly enforced. Events from applications using alternative implementations of libc, making direct kernel calls, or deliberately obfuscating traffic may not be recorded.

Some common network events may not be reported. For example:

- Applications may hardcode IP addresses to reduce the number of DNS lookups, or use an alternative system for name resolution, and so avoid calling `getaddrinfo()` or `gethostbyname`.
- Applications may use datagram sockets for performance reasons, for example for a game client. Calling `connect()` is unnecessary for this kind of socket, so it will not trigger a network event.

It is possible to directly intercept layer 3 traffic leaving the device using an always-on VPN service. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAlwaysOnVpnPackage(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)` and `https://developer.android.com/reference/kotlin/android/net/VpnService.html#` for details.

**Note:** The device owner won't be able to retrieve network logs if there are unaffiliated secondary users or profiles on the device, regardless of whether the feature is enabled. Logs will be discarded if the internal buffer fills up while waiting for all users to become affiliated. Therefore it's recommended that affiliation ids are set for new users as soon as possible after provisioning via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if called by a delegated app. |
| `enabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): whether network logging should be enabled or not. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner or profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#retrieveNetworkLogs(android.content.ComponentName,%20kotlin.Long)`

### setOrganizationColor

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setOrganizationColor(
    admin: ComponentName, 
    color: Int
): Unit
```

**Deprecated:** *From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int`, the organization color is never used as the background color of the confirm credentials screen.*

Called by a profile owner of a managed profile to set the color used for customization. This color is used as background color of the confirm credentials screen for that user. The default color is teal (#00796B).

The confirm credentials screen can be created using `https://developer.android.com/reference/kotlin/android/app/KeyguardManager.html#createConfirmDeviceCredentialIntent(kotlin.CharSequence,%20kotlin.CharSequence)`.

Starting from Android R, the organization color will no longer be used as the background color of the confirm credentials screen.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `color` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The 24bit (0xRRGGBB) representation of the color to be used. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner. |

### setOrganizationId

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setOrganizationId(enterpriseId: String): Unit
```

Sets the Enterprise ID for the work profile or managed device. This is a requirement for generating an enrollment-specific ID for the device, see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getEnrollmentSpecificId()`. It is recommended that the Enterprise ID is at least 6 characters long, and no more than 64 characters.

| Parameters ||
|---|---|
| `enterpriseId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): An identifier of the organization this work profile or device is enrolled into. This value cannot be `null`. |

### setOrganizationName

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setOrganizationName(
    admin: ComponentName?, 
    title: CharSequence?
): Unit
```

Called by the device owner (since API 26) or profile owner (since API 24) to set the name of the organization under management.

If the organization name needs to be localized, it is the responsibility of the caller to listen to the `https://developer.android.com/reference/kotlin/android/content/Intent.html#ACTION_LOCALE_CHANGED:kotlin.String` broadcast and set a new version of this string accordingly.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `title` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)?: The organization name or `null` to clear a previously set name. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### setOverrideApnsEnabled

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setOverrideApnsEnabled(
    admin: ComponentName, 
    enabled: Boolean
): Unit
```

Called by device owner to set if override APNs should be enabled.

Override APNs are separated from other APNs on the device, and can only be inserted or modified by the device owner. When enabled, only override APNs are in use, any other APNs are ignored.

Note: Enterprise APNs added by managed profile owners do not need to be enabled by this API. They are part of the preferential network service config and is controlled by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPreferentialNetworkServiceConfigs(kotlin.collections.MutableList)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `enabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): `true` if override APNs should be enabled, `false` otherwise |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

### setPackagesSuspended

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPackagesSuspended(
    admin: ComponentName?, 
    packageNames: Array<String!>, 
    suspended: Boolean
): Array<String!>
```

Called by device or profile owners to suspend packages for this user. This function can be called by a device owner, profile owner, or by a delegate given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PACKAGE_ACCESS:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`.

A suspended package will not be able to start activities. Its notifications will be hidden, it will not show up in recents, will not be able to show toasts or dialogs or ring the device.

The package must already be installed. If the package is uninstalled while suspended the package will no longer be suspended. The admin can block this by using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setUninstallBlocked(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)`.

Some apps cannot be suspended, such as device admins, the active launcher, the required package installer, the required package uninstaller, the required package verifier, the default dialer, and the permission controller.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `packageNames` | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>: The package names to suspend or unsuspend. This value cannot be `null`. |
| `suspended` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): If set to `true` than the packages will be suspended, if set to `false` the packages will be unsuspended. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>` | an array of package names for which the suspended status is not set as requested in this method. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PACKAGE_ACCESS:kotlin.String`

### setPasswordExpirationTimeout

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPasswordExpirationTimeout(
    admin: ComponentName?, 
    timeout: Long
): Unit
```

Called by a device admin to set the password expiration timeout. Calling this method will restart the countdown for password expiration for the given admin, as will changing the device password (for all admins).

The provided timeout is the time delta in ms and will be added to the current time. For example, to have the password expire 5 days from now, timeout would be 5 \* 86400 \* 1000 = 432000000 ms for timeout.

To disable password expiration, a value of 0 may be used for timeout.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password expiration is always disabled.

A calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_EXPIRE_PASSWORD:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

Note that setting the password will automatically reset the expiration time for all active admins. Active admins do not need to explicitly call this method in that case.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set restrictions on the parent profile.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `timeout` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The limit (in ms) that a password can remain in effect. A value of 0 means there is no restriction (unlimited). |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not an active administrator or `admin` does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_EXPIRE_PASSWORD:kotlin.Int` |

### setPasswordHistoryLength

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPasswordHistoryLength(
    admin: ComponentName, 
    length: Int
): Unit
```

Called by an application that is administering the device to set the length of the password history. After setting this, the user will not be able to enter a new password that is the same as any password in the history. Note that the current password will remain until the user has set a new one, so the change does not take place immediately. To prompt the user for a new password, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PASSWORD:kotlin.String` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD:kotlin.String` after setting this value.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password history length is always 0.

The calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set restrictions on the parent profile.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `length` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new desired length of password history. A value of 0 means there is no restriction. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not an active administrator or `admin` does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` |

### setPasswordMinimumLength

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPasswordMinimumLength(
    admin: ComponentName, 
    length: Int
): Unit
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Called by an application that is administering the device to set the minimum allowed password length. After setting this, the user will not be able to enter a new password that is not at least as restrictive as what has been set. Note that the current password will remain until the user has set a new one, so the change does not take place immediately. To prompt the user for a new password, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PASSWORD:kotlin.String` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD:kotlin.String` after setting this value. This constraint is only imposed if the administrator has also requested either `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_NUMERIC:kotlin.Int` , `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_NUMERIC_COMPLEX:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_ALPHABETIC:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_ALPHANUMERIC:kotlin.Int`, or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int` with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`. If an app targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and above enforces this constraint without settings password quality to one of these values first, this method will throw `https://developer.android.com/reference/kotlin/java/lang/IllegalStateException.html#`.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

The calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

Apps targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and below can call this method on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set restrictions on the parent profile.

Note: this method is ignored on {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `length` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new desired minimum password length. A value of 0 means there is no restriction. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the calling app is targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and above and didn't set a sufficient password quality requirement prior to calling this method. |
| `java.lang.SecurityException` | if `admin` is not an active administrator or `admin` does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` |

### setPasswordMinimumLetters

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPasswordMinimumLetters(
    admin: ComponentName, 
    length: Int
): Unit
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Called by an application that is administering the device to set the minimum number of letters required in the password. After setting this, the user will not be able to enter a new password that is not at least as restrictive as what has been set. Note that the current password will remain until the user has set a new one, so the change does not take place immediately. To prompt the user for a new password, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PASSWORD:kotlin.String` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD:kotlin.String` after setting this value. This constraint is only imposed if the administrator has also requested `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int` with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`. If an app targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and above enforces this constraint without settings password quality to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int` first, this method will throw `https://developer.android.com/reference/kotlin/java/lang/IllegalStateException.html#`. The default value is 1.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

The calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

Apps targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and below can call this method on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set restrictions on the parent profile.

Note: this method is ignored on {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `length` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new desired minimum number of letters required in the password. A value of 0 means there is no restriction. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the calling app is targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and above and didn't set a sufficient password quality requirement prior to calling this method. |
| `java.lang.SecurityException` | if `admin` is not an active administrator or `admin` does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` |

### setPasswordMinimumLowerCase

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPasswordMinimumLowerCase(
    admin: ComponentName, 
    length: Int
): Unit
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Called by an application that is administering the device to set the minimum number of lower case letters required in the password. After setting this, the user will not be able to enter a new password that is not at least as restrictive as what has been set. Note that the current password will remain until the user has set a new one, so the change does not take place immediately. To prompt the user for a new password, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PASSWORD:kotlin.String` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD:kotlin.String` after setting this value. This constraint is only imposed if the administrator has also requested `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int` with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`. If an app targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and above enforces this constraint without settings password quality to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int` first, this method will throw `https://developer.android.com/reference/kotlin/java/lang/IllegalStateException.html#`. The default value is 0.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

The calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

Apps targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and below can call this method on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set restrictions on the parent profile.

Note: this method is ignored on {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `length` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new desired minimum number of lower case letters required in the password. A value of 0 means there is no restriction. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the calling app is targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and above and didn't set a sufficient password quality requirement prior to calling this method. |
| `java.lang.SecurityException` | if `admin` is not an active administrator or `admin` does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` |

### setPasswordMinimumNonLetter

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPasswordMinimumNonLetter(
    admin: ComponentName, 
    length: Int
): Unit
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Called by an application that is administering the device to set the minimum number of non-letter characters (numerical digits or symbols) required in the password. After setting this, the user will not be able to enter a new password that is not at least as restrictive as what has been set. Note that the current password will remain until the user has set a new one, so the change does not take place immediately. To prompt the user for a new password, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PASSWORD:kotlin.String` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD:kotlin.String` after setting this value. This constraint is only imposed if the administrator has also requested `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int` with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`. If an app targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and above enforces this constraint without settings password quality to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int` first, this method will throw `https://developer.android.com/reference/kotlin/java/lang/IllegalStateException.html#`. The default value is 0.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

The calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

Apps targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and below can call this method on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set restrictions on the parent profile.

Note: this method is ignored on {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `length` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new desired minimum number of letters required in the password. A value of 0 means there is no restriction. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the calling app is targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and above and didn't set a sufficient password quality requirement prior to calling this method. |
| `java.lang.SecurityException` | if `admin` is not an active administrator or `admin` does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` |

### setPasswordMinimumNumeric

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPasswordMinimumNumeric(
    admin: ComponentName, 
    length: Int
): Unit
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Called by an application that is administering the device to set the minimum number of numerical digits required in the password. After setting this, the user will not be able to enter a new password that is not at least as restrictive as what has been set. Note that the current password will remain until the user has set a new one, so the change does not take place immediately. To prompt the user for a new password, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PASSWORD:kotlin.String` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD:kotlin.String` after setting this value. This constraint is only imposed if the administrator has also requested `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int` with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`. If an app targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and above enforces this constraint without settings password quality to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int` first, this method will throw `https://developer.android.com/reference/kotlin/java/lang/IllegalStateException.html#`. The default value is 1.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

The calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

Apps targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and below can call this method on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set restrictions on the parent profile.

Note: this method is ignored on {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `length` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new desired minimum number of numerical digits required in the password. A value of 0 means there is no restriction. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the calling app is targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and above and didn't set a sufficient password quality requirement prior to calling this method. |
| `java.lang.SecurityException` | if `admin` is not an active administrator or `admin` does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` |

### setPasswordMinimumSymbols

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPasswordMinimumSymbols(
    admin: ComponentName, 
    length: Int
): Unit
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Called by an application that is administering the device to set the minimum number of symbols required in the password. After setting this, the user will not be able to enter a new password that is not at least as restrictive as what has been set. Note that the current password will remain until the user has set a new one, so the change does not take place immediately. To prompt the user for a new password, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PASSWORD:kotlin.String` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD:kotlin.String` after setting this value. This constraint is only imposed if the administrator has also requested `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int` with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`. If an app targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and above enforces this constraint without settings password quality to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int` first, this method will throw `https://developer.android.com/reference/kotlin/java/lang/IllegalStateException.html#`. The default value is 1.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

The calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

Apps targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and below can call this method on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set restrictions on the parent profile.

Note: this method is ignored on {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `length` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new desired minimum number of symbols required in the password. A value of 0 means there is no restriction. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the calling app is targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and above and didn't set a sufficient password quality requirement prior to calling this method. |
| `java.lang.SecurityException` | if `admin` is not an active administrator or `admin` does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` |

### setPasswordMinimumUpperCase

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPasswordMinimumUpperCase(
    admin: ComponentName, 
    length: Int
): Unit
```

**Deprecated:** *see `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` for details.*

Called by an application that is administering the device to set the minimum number of upper case letters required in the password. After setting this, the user will not be able to enter a new password that is not at least as restrictive as what has been set. Note that the current password will remain until the user has set a new one, so the change does not take place immediately. To prompt the user for a new password, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PASSWORD:kotlin.String` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD:kotlin.String` after setting this value. This constraint is only imposed if the administrator has also requested `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int` with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)`. If an app targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and above enforces this constraint without settings password quality to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int` first, this method will throw `https://developer.android.com/reference/kotlin/java/lang/IllegalStateException.html#`. The default value is 0.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

The calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

Apps targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and below can call this method on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set restrictions on the parent profile.

Note: this method is ignored on {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `length` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new desired minimum number of upper case letters required in the password. A value of 0 means there is no restriction. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the calling app is targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and above and didn't set a sufficient password quality requirement prior to calling this method. |
| `java.lang.SecurityException` | if `admin` is not an active administrator or `admin` does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` |

### setPasswordQuality

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPasswordQuality(
    admin: ComponentName, 
    quality: Int
): Unit
```

**Deprecated:** *Prefer using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`, to require a password that satisfies a complexity level defined by the platform, rather than specifying custom password requirement. Setting custom, overly-complicated password requirements leads to passwords that are hard for users to remember and may not provide any security benefits given as Android uses hardware-backed throttling to thwart online and offline brute-forcing of the device's screen lock. Company-owned devices (fully-managed and organization-owned managed profile devices) are able to continue using this method, though it is recommended that `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)` should be used instead.*

Called by an application that is administering the device to set the password restrictions it is imposing. After setting this, the user will not be able to enter a new password that is not at least as restrictive as what has been set. Note that the current password will remain until the user has set a new one, so the change does not take place immediately. To prompt the user for a new password, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PASSWORD:kotlin.String` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD:kotlin.String` after calling this method.

Quality constants are ordered so that higher values are more restrictive; thus the highest requested quality constant (between the policy set here, the user's preference, and any other considerations) is the one that is in effect.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the password is always treated as empty.

The calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

Apps targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int` and below can call this method on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set restrictions on the parent profile. Apps targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int` and above, with the exception of a profile owner on an organization-owned device (as can be identified by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isOrganizationOwnedDeviceWithManagedProfile()`), will get a `IllegalArgumentException` when calling this method on the parent `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance.

**Note:** Specifying password requirements using this method clears the password complexity requirements set using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)`. If this method is called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, then password complexity requirements set on the primary `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` must be cleared first by calling `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(kotlin.Int)` with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_NONE:kotlin.Int` first.

Note: this method is ignored on {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `quality` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new desired quality. One of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_UNSPECIFIED:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_BIOMETRIC_WEAK:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_SOMETHING:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_NUMERIC:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_NUMERIC_COMPLEX:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_ALPHABETIC:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_ALPHANUMERIC:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_COMPLEX:kotlin.Int`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the caller is trying to set password quality on the parent `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance while password complexity was set on the primary `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance. |
| `java.lang.SecurityException` | if `admin` is not an active administrator, if `admin` does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD:kotlin.Int` or if the calling app is targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int` and above, and is calling the method the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`. |

### setPermissionGrantState

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPermissionGrantState(
    admin: ComponentName?, 
    packageName: String, 
    permission: String, 
    grantState: Int
): Boolean
```

Sets the grant state of a runtime permission for a specific application. The state can be in which a user can manage it through the UI, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_DENIED:kotlin.Int`, in which the permission is denied and the user cannot manage it through the UI, and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_GRANTED:kotlin.Int` in which the permission is granted and the user cannot manage it through the UI. This method can only be called by a profile owner, device owner, or a delegate given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PERMISSION_GRANT:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`

<br />

Note that user cannot manage other permissions in the affected group through the UI either and their granted state will be kept as the current value. Thus, it's recommended that you set the grant state of all the permissions in the affected group.

<br />

Setting the grant state to `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_DEFAULT:kotlin.Int` does not revoke the permission. It retains the previous grant, if any.

<br />

Device admins with a `targetSdkVersion` \< `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int` cannot grant and revoke permissions for applications built with a `targetSdkVersion` \< `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int`.

<br />

Admins with a `targetSdkVersion` ≥ `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int` can grant and revoke permissions of all apps. Similar to the user revoking a permission from a application built with a `targetSdkVersion` \< `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int` the app-op matching the permission is set to `https://developer.android.com/reference/kotlin/android/app/AppOpsManager.html#MODE_IGNORED:kotlin.Int`, but the permission stays granted.

NOTE: On devices running `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int` and above, control over the following, sensors-related, permissions is restricted:

- Manifest.permission.ACCESS_FINE_LOCATION
- Manifest.permission.ACCESS_BACKGROUND_LOCATION
- Manifest.permission.ACCESS_COARSE_LOCATION
- Manifest.permission.CAMERA
- Manifest.permission.RECORD_AUDIO
- Manifest.permission.RECORD_BACKGROUND_AUDIO
- Manifest.permission.ACTIVITY_RECOGNITION
- Manifest.permission.BODY_SENSORS

On devices running `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#BAKLAVA:kotlin.Int`, the `https://developer.android.com/reference/kotlin/android/health/connect/HealthPermissions.html#` are also included in the restricted list.

A profile owner may not grant these permissions (i.e. call this method with any of the permissions listed above and `grantState` of `PERMISSION_GRANT_STATE_GRANTED`), but may deny them.

A device owner, by default, may continue granting these permissions. However, for increased user control, the admin may opt out of controlling grants for these permissions by including `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#EXTRA_PROVISIONING_SENSORS_PERMISSION_GRANT_OPT_OUT:kotlin.String` in the provisioning parameters. In that case the device owner's control will be limited to denying these permissions.

When sensor-related permissions aren't grantable due to the above cases, calling this method to grant these permissions will silently fail, if device admins are built with `targetSdkVersion` \< `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#VANILLA_ICE_CREAM:kotlin.Int`. If they are built with `targetSdkVersion` \>= `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#VANILLA_ICE_CREAM:kotlin.Int`, this method will throw a `https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#`.

NOTE: On devices running `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int` and above, control over the following permissions are restricted for managed profile owners:

- Manifest.permission.READ_SMS

A managed profile owner may not grant these permissions (i.e. call this method with any of the permissions listed above and `grantState` of `PERMISSION_GRANT_STATE_GRANTED`), but may deny them.

Attempts by the admin to grant these permissions, when the admin is restricted from doing so, will be silently ignored (no exception will be thrown). Control over the following permissions are restricted for managed profile owners:

- Manifest.permission.READ_SMS

A managed profile owner may not grant these permissions (i.e. call this method with any of the permissions listed above and `grantState` of `PERMISSION_GRANT_STATE_GRANTED`), but may deny them.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The application to grant or revoke a permission to. This value cannot be `null`. |
| `permission` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The permission to grant or revoke. This value cannot be `null`. |
| `grantState` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The permission grant state which is one of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_DENIED:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_DEFAULT:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_GRANTED:kotlin.Int`,. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_DEFAULT:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_GRANTED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_DENIED:kotlin.Int` |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | whether the permission was successfully granted or revoked. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_DENIED:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_DEFAULT:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_GRANT_STATE_GRANTED:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PERMISSION_GRANT:kotlin.String`

### setPermissionPolicy

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPermissionPolicy(
    admin: ComponentName?, 
    policy: Int
): Unit
```

Set the default response for future runtime permission requests by applications. This function can be called by a device owner, profile owner, or by a delegate given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PERMISSION_GRANT:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`. The policy can allow for normal operation which prompts the user to grant a permission, or can allow automatic granting or denying of runtime permission requests by an application. This also applies to new permissions declared by app updates. When a permission is denied or granted this way, the effect is equivalent to setting the permission \* grant state via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermissionGrantState(android.content.ComponentName,%20kotlin.String,%20kotlin.String,%20kotlin.Int)`.

<br />

As this policy only acts on runtime permission requests, it only applies to applications built with a `targetSdkVersion` of `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int` or later.

NOTE: On devices running `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int` and above, an auto-grant policy will not apply to certain sensors-related permissions on some configurations. See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermissionGrantState(android.content.ComponentName,%20kotlin.String,%20kotlin.String,%20kotlin.Int)` for the list of permissions affected, and the behavior change for managed profiles and fully-managed devices.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which profile or device owner this request is associated with, or `null` if the caller is a set permission policy delegate. |
| `policy` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): One of the policy constants `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_POLICY_PROMPT:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_POLICY_AUTO_GRANT:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PERMISSION_POLICY_AUTO_DENY:kotlin.Int`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPermissionGrantState(android.content.ComponentName,%20kotlin.String,%20kotlin.String,%20kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_PERMISSION_GRANT:kotlin.String`

### setPermittedAccessibilityServices

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPermittedAccessibilityServices(
    admin: ComponentName, 
    packageNames: MutableList<String!>!
): Boolean
```

Called by a profile or device owner to set the permitted `https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.html#`. When set by a device owner or profile owner the restriction applies to all profiles of the user the device owner or profile owner is an admin for. By default, the user can use any accessibility service. When zero or more packages have been added, accessibility services that are not in the list and not part of the system can not be enabled by the user.

Calling with a `null` value for the list disables the restriction so that all services can be used, calling with an empty list only allows the built-in system services. Any non-system accessibility service that's currently enabled must be included in the list.

System accessibility services are always available to the user and this method can't disable them.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `packageNames` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>!: List of accessibility service package names. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the operation succeeded, or `false` if the list didn't contain every enabled non-system accessibility service. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### setPermittedCrossProfileNotificationListeners

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPermittedCrossProfileNotificationListeners(
    admin: ComponentName, 
    packageList: MutableList<String!>?
): Boolean
```

Called by a profile owner of a managed profile to set the packages that are allowed to use a `https://developer.android.com/reference/kotlin/android/service/notification/NotificationListenerService.html#` in the primary user to see notifications from the managed profile. By default all packages are permitted by this policy. When zero or more packages have been added, notification listeners installed on the primary user that are not in the list and are not part of the system won't receive events for managed profile notifications.

Calling with a `null` value for the list disables the restriction so that all notification listener services be used. Calling with an empty list disables all but the system's own notification listeners. System notification listener services are always available to the user.

If a device or profile owner want to stop notification listeners in their user from seeing that user's notifications they should prevent that service from running instead (e.g. via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setApplicationHidden(android.content.ComponentName,%20kotlin.String,%20kotlin.Boolean)`)

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `packageList` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>?: List of package names to allowlist. This value may be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | true if setting the restriction succeeded. It will fail if called outside a managed profile |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/service/notification/NotificationListenerService.html#`

### setPermittedInputMethods

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPermittedInputMethods(
    admin: ComponentName?, 
    packageNames: MutableList<String!>!
): Boolean
```

Called by a profile or device owner or holder of the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_INPUT_METHODS:kotlin.String` permission to set the permitted input methods services for this user. By default, the user can use any input method.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance, returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, where the caller must be a profile owner of an organization-owned device.

If called on the parent instance:

- The permitted input methods will be applied on the personal profile
- Can only permit all input methods (calling this method with a `null` package list) or only permit system input methods (calling this method with an empty package list). This is to prevent the caller from learning which packages are installed on the personal side

When zero or more packages have been added, input method that are not in the list and not part of the system can not be enabled by the user. This method will fail if it is called for a admin that is not for the foreground user or a profile of the foreground user. Any non-system input method service that's currently enabled must be included in the list.

Calling with a null value for the list disables the restriction so that all input methods can be used, calling with an empty list disables all but the system's own input methods.

System input methods are always available to the user - this method can't modify this.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `packageNames` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>!: List of input method package names. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the operation succeeded, or `false` if the list didn't contain every enabled non-system input method service. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if called on the parent profile, the `admin` is a profile owner of an organization-owned managed profile and the list of permitted input method package names is not null or empty. |
| `java.lang.SecurityException` | if `admin` is not a device or profile owner and does not hold the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_INPUT_METHODS:kotlin.String` permission, or if called on the parent profile and the `admin` is not a profile owner of an organization-owned managed profile. |

### setPersonalAppsSuspended

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPersonalAppsSuspended(
    admin: ComponentName, 
    suspended: Boolean
): Unit
```

Called by a profile owner of an organization-owned managed profile to suspend personal apps on the device. When personal apps are suspended the device can only be used for calls.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `suspended` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): Whether personal apps should be suspended. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the profile owner doesn't have an activity that handles `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_CHECK_POLICY_COMPLIANCE:kotlin.String` |

### setPolicy

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun <T : Any!> setPolicy(
    id: PolicyIdentifier<T>, 
    scope: Int, 
    value: T?
): Unit
```

Sets the given policy.

Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getPolicy(android.app.admin.PolicyIdentifier,%20kotlin.Int)` to read back the value.

Use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getResolvedDeviceWidePolicy(android.app.admin.PolicyIdentifier)` or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getResolvedPerUserPolicy(android.app.admin.PolicyIdentifier)` to get the resolved policy value used on the device. The returned value can differ from the value set by the caller. The resolved value is the value that is currently being enforced on the device after conflict resolution has been performed between all the policies set by all admins at all active scopes.

| Parameters ||
|---|---|
| `<T>` | The type of the policy. |
| `id` | [PolicyIdentifier](https://developer.android.com/reference/kotlin/android/app/admin/PolicyIdentifier)\<T\>: The identifier of the policy to set. See android.app.admin.policies for available policy identifiers. This value cannot be `null`. |
| `scope` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The scope the policy will apply to. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#POLICY_SCOPE_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#POLICY_SCOPE_DEVICE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#POLICY_SCOPE_PARENT_USER:kotlin.Int` |
| `value` | T?: The value of the policy. If value is set to null, the policy is cleared. Check the documentation of individual identifiers for more details. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | The passed value failed validation. Check the documentation of individual identifiers for more details. { @if (flag(android.app.admin.flags.Flags.FLAG_POLICY_STREAMLINING_MEMORY_TAGGING_EXTENSION)) { throws UnsupportedHardwareException if the policy is not supported on this device. }} |
| `java.lang.SecurityException` | If the caller does not have sufficient permissions to set the specified id. Check the documentation of individual identifiers for more details. |

### setPreferentialNetworkServiceConfigs

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPreferentialNetworkServiceConfigs(preferentialNetworkServiceConfigs: MutableList<PreferentialNetworkServiceConfig!>): Unit
```

Sets preferential network configurations. An example of a supported preferential network service is the Enterprise slice on 5G networks. For devices on 4G networks, the profile owner needs to additionally configure enterprise APN to set up data call for the preferential network service. These APNs can be added using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addOverrideApn(android.content.ComponentName,%20android.telephony.data.ApnSetting)`. By default, preferential network service is disabled on the work profile and fully managed devices, on supported carriers and devices. Admins can explicitly enable it with this API. If admin wants to have multiple enterprise slices, it can be configured by passing list of `https://developer.android.com/reference/kotlin/android/app/admin/PreferentialNetworkServiceConfig` objects.

| Parameters ||
|---|---|
| `preferentialNetworkServiceConfigs` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[PreferentialNetworkServiceConfig](https://developer.android.com/reference/kotlin/android/app/admin/PreferentialNetworkServiceConfig)!\>: list of preferential network configurations. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not the profile owner or device owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/PreferentialNetworkServiceConfig`

### setPreferentialNetworkServiceEnabled

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPreferentialNetworkServiceEnabled(enabled: Boolean): Unit
```

Sets whether preferential network service is enabled. For example, an organization can have a deal/agreement with a carrier that all of the work data from its employees' devices will be sent via a network service dedicated for enterprise use. An example of a supported preferential network service is the Enterprise slice on 5G networks. For devices on 4G networks, the profile owner needs to additionally configure enterprise APN to set up data call for the preferential network service. These APNs can be added using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addOverrideApn(android.content.ComponentName,%20android.telephony.data.ApnSetting)`. By default, preferential network service is disabled on the work profile and fully managed devices, on supported carriers and devices. Admins can explicitly enable it with this API.

This method enables preferential network service with a default configuration. To fine-tune the configuration, use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPreferentialNetworkServiceConfigs(kotlin.collections.MutableList)` instead.

Before Android version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int`: this method can be called by the profile owner of a managed profile.

Starting from Android version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int`: This method can be called by the profile owner of a managed profile or device owner.

| Parameters ||
|---|---|
| `enabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): whether preferential network service should be enabled. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not the profile owner or device owner. |

### setProfileEnabled

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setProfileEnabled(admin: ComponentName): Unit
```

Sets the enabled state of the profile. A profile should be enabled only once it is ready to be used. Only the profile owner can call this.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isProfileOwnerApp(kotlin.String)`

### setProfileName

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setProfileName(
    admin: ComponentName, 
    profileName: String!
): Unit
```

Sets the name of the profile. In the device owner case it sets the name of the user which it is called from. Only a profile owner or device owner can call this. If this is never called by the profile or device owner, the name will be set to default values.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associate with. This value cannot be `null`. |
| `profileName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The name of the profile. If the name is longer than 200 characters it will be truncated. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isProfileOwnerApp(kotlin.String)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isDeviceOwnerApp(kotlin.String)`

### setRecommendedGlobalProxy

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setRecommendedGlobalProxy(
    admin: ComponentName, 
    proxyInfo: ProxyInfo?
): Unit
```

Set a network-independent global HTTP proxy. This is not normally what you want for typical HTTP proxies - they are generally network dependent. However if you're doing something unusual like general internal filtering this may be useful. On a private network where the proxy is not accessible, you may break HTTP using this.

This method requires the caller to be the device owner.

This proxy is only a recommendation and it is possible that some apps will ignore it.

Note: The device owner won't be able to set a global HTTP proxy if there are unaffiliated secondary users or profiles on the device. It's recommended that affiliation ids are set for new users as soon as possible after provisioning via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `proxyInfo` | [ProxyInfo](https://developer.android.com/reference/kotlin/android/net/ProxyInfo.html#)?: The a `https://developer.android.com/reference/kotlin/android/net/ProxyInfo.html#` object defining the new global HTTP proxy. A `null` value will clear the global HTTP proxy. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not the device owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/net/ProxyInfo.html#`

### setRequiredPasswordComplexity

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setRequiredPasswordComplexity(passwordComplexity: Int): Unit
```

Sets a minimum password complexity requirement for the user's screen lock. The complexity level is one of the pre-defined levels, and the user is unable to set a password with a lower complexity level.

Note that when called on a profile which uses an unified challenge with its parent, the complexity would apply to the unified challenge.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set restrictions on the parent profile.

**Note:** Specifying password requirements using this method clears any password requirements set using the obsolete `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` and any of its associated methods. Additionally, if there are password requirements set using the obsolete `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` on the parent `DevicePolicyManager` instance, they must be cleared by calling `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_QUALITY_UNSPECIFIED:kotlin.Int` on that instance prior to setting complexity requirement for the managed profile. Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#VANILLA_ICE_CREAM:kotlin.Int`, after the password requirement has been set, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully set or not. This callback will contain:

- The policy identifier `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyIdentifiers#PASSWORD_COMPLEXITY_POLICY:kotlin.String`
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully set or the reason the policy failed to be set e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

| Parameters ||
|---|---|
| `passwordComplexity` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_NONE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_LOW:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_MEDIUM:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#PASSWORD_COMPLEXITY_HIGH:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if the complexity level is not one of the four above. |
| `java.lang.IllegalStateException` | if the caller is trying to set password complexity while there are password requirements specified using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setPasswordQuality(android.content.ComponentName,%20kotlin.Int)` on the parent `DevicePolicyManager` instance. |
| `java.lang.SecurityException` | if the calling application is not a device owner or a profile owner. |

### setRequiredStrongAuthTimeout

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setRequiredStrongAuthTimeout(
    admin: ComponentName?, 
    timeoutMs: Long
): Unit
```

Called by a device/profile owner to set the timeout after which unlocking with secondary, non strong auth (e.g. fingerprint, face, trust agents) times out, i.e. the user has to use a strong authentication method like password, pin or pattern.

This timeout is used internally to reset the timer to require strong auth again after specified timeout each time it has been successfully used.

Fingerprint can also be disabled altogether using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_FINGERPRINT:kotlin.Int`.

Trust agents can also be disabled altogether using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_TRUST_AGENTS:kotlin.Int`.

A calling device admin can verify the value it has set by calling `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getRequiredStrongAuthTimeout(android.content.ComponentName)` and passing in its instance.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set restrictions on the parent profile.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, calling this methods has no effect - i.e. the timeout is not set.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `timeoutMs` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The new timeout in milliseconds, after which the user will have to unlock with strong authentication method. A value of 0 means the admin is not participating in controlling the timeout. The minimum and maximum timeouts are platform-defined and are typically 1 hour and 72 hours, respectively. Though discouraged, the admin may choose to require strong auth at all times using `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_FINGERPRINT:kotlin.Int` and/or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_TRUST_AGENTS:kotlin.Int`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### setResetPasswordToken

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setResetPasswordToken(
    admin: ComponentName?, 
    token: ByteArray!
): Boolean
```

Called by a profile or device owner to provision a token which can later be used to reset the device lockscreen password (if called by device owner), or managed profile challenge (if called by profile owner), via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#resetPasswordWithToken(android.content.ComponentName,%20kotlin.String,%20kotlin.ByteArray,%20kotlin.Int)`.

If the user currently has a lockscreen password, the provisioned token will not be immediately usable; it only becomes active after the user performs a confirm credential operation, which can be triggered by `https://developer.android.com/reference/kotlin/android/app/KeyguardManager.html#createConfirmDeviceCredentialIntent(kotlin.CharSequence,%20kotlin.CharSequence)`. If the user has no lockscreen password, the token is activated immediately. In all cases, the active state of the current token can be checked by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isResetPasswordTokenActive(android.content.ComponentName)`. For security reasons, un-activated tokens are only stored in memory and will be lost once the device reboots. In this case a new token needs to be provisioned again.

Once provisioned and activated, the token will remain effective even if the user changes or clears the lockscreen password.

*This token is highly sensitive and should be treated at the same level as user credentials. In particular, NEVER store this token on device in plaintext. Do not store the plaintext token in device-encrypted storage if it will be needed to reset password on file-based encryption devices before user unlocks. Consider carefully how any password token will be stored on your server and who will need access to them. Tokens may be the subject of legal access requests.*

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, the reset token is not set and this method returns false.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `token` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!: a secure token a least 32-byte long, which must be generated by a cryptographically strong random number generator. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | true if the operation is successful, false otherwise. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if the supplied token is invalid. |
| `java.lang.SecurityException` | if admin is not a device or profile owner. |

### setRestrictionsProvider

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setRestrictionsProvider(
    admin: ComponentName, 
    provider: ComponentName?
): Unit
```

Designates a specific service component as the provider for making permission requests of a local or remote administrator of the user.

<br />

Only a device owner or profile owner can designate the restrictions provider.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `provider` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: The component name of the service that implements `https://developer.android.com/reference/kotlin/android/service/restrictions/RestrictionsReceiver.html#`. If this param is null, it removes the restrictions provider previously assigned. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### setScreenCaptureDisabled

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setScreenCaptureDisabled(
    admin: ComponentName?, 
    disabled: Boolean
): Unit
```

Called by a device/profile owner to set whether the screen capture is disabled. Disabling screen capture also prevents the content from being shown on display devices that do not have a secure video output. See `https://developer.android.com/reference/kotlin/android/view/Display.html#FLAG_SECURE:kotlin.Int` for more details about secure surfaces and secure displays.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance, returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`, where the calling device admin must be the profile owner of an organization-owned managed profile. If it is not, a security exception will be thrown.

If the caller is device owner or called on the parent instance by a profile owner of an organization-owned managed profile, then the restriction will be applied to all users.

From version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int` disabling screen capture also blocks assist requests for all activities of the relevant user.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `disabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): Whether screen capture is disabled or not. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not permitted to control screen capture policy. |

### setSecureSetting

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setSecureSetting(
    admin: ComponentName, 
    setting: String!, 
    value: String!
): Unit
```

This method is mostly deprecated. Most of the settings that still have an effect have dedicated setter methods (e.g. `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLocationEnabled(android.content.ComponentName,%20kotlin.Boolean)`) or user restrictions.

Called by profile or device owners to update `https://developer.android.com/reference/kotlin/android/provider/Settings.Secure.html#` settings. Validation that the value of the setting is in the correct form for the setting type should be performed by the caller.

The settings that can be updated by a profile or device owner with this method are:

- `https://developer.android.com/reference/kotlin/android/provider/Settings.Secure.html#DEFAULT_INPUT_METHOD:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/provider/Settings.Secure.html#SKIP_FIRST_USE_HINTS:kotlin.String`

A device owner can additionally update the following settings:

- `https://developer.android.com/reference/kotlin/android/provider/Settings.Secure.html#LOCATION_MODE:kotlin.String`, but see note below.

**Note: Starting from Android O, apps should no longer call this method with the setting `https://developer.android.com/reference/kotlin/android/provider/Settings.Secure.html#INSTALL_NON_MARKET_APPS:kotlin.String`, which is deprecated. Instead, device owners or profile owners should use the restriction `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_INSTALL_UNKNOWN_SOURCES:kotlin.String`. If any app targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#O:kotlin.Int` or higher calls this method with `https://developer.android.com/reference/kotlin/android/provider/Settings.Secure.html#INSTALL_NON_MARKET_APPS:kotlin.String`, an `https://developer.android.com/reference/kotlin/java/lang/UnsupportedOperationException.html#` is thrown. Starting from Android Q, the device and profile owner can also call `https://developer.android.com/reference/kotlin/android/os/UserManager.html#DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY:kotlin.String` to restrict unknown sources for all users.** **Note: Starting from Android R, apps should no longer call this method with the setting `https://developer.android.com/reference/kotlin/android/provider/Settings.Secure.html#LOCATION_MODE:kotlin.String`, which is deprecated. Instead, device owners should call `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLocationEnabled(android.content.ComponentName,%20kotlin.Boolean)`. This will be enforced for all apps targeting Android R or above.**

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `setting` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The name of the setting to update. |
| `value` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The value to update the setting to. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### setSecurityLoggingEnabled

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setSecurityLoggingEnabled(
    admin: ComponentName?, 
    enabled: Boolean
): Unit
```

Called by device owner or a profile owner of an organization-owned managed profile to control the security logging feature.

Security logs contain various information intended for security auditing purposes. When security logging is enabled by any app other than the device owner, certain security logs are not visible (for example personal app launch events) or they will be redacted (for example, details of the physical volume mount events). Please see `https://developer.android.com/reference/kotlin/android/app/admin/SecurityLog.SecurityEvent` for details.

**Note:** The device owner won't be able to retrieve security logs if there are unaffiliated secondary users or profiles on the device, regardless of whether the feature is enabled. Logs will be discarded if the internal buffer fills up while waiting for all users to become affiliated. Therefore it's recommended that affiliation ids are set for new users as soon as possible after provisioning via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)`. Non device owners are not subject to this restriction since all privacy-sensitive events happening outside the managed profile would have been redacted already. Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#VANILLA_ICE_CREAM:kotlin.Int`, after the security logging policy has been set, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully set or not. This callback will contain:

- The policy identifier `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyIdentifiers#SECURITY_LOGGING_POLICY:kotlin.String`
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully set or the reason the policy failed to be set e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which device admin this request is associated with, or `null` if called by a delegated app. |
| `enabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): whether security logging should be enabled or not. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not permitted to control security logging. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setAffiliationIds(android.content.ComponentName,%20kotlin.collections.MutableSet)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#retrieveSecurityLogs(android.content.ComponentName)`

### setShortSupportMessage

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setShortSupportMessage(
    admin: ComponentName?, 
    message: CharSequence?
): Unit
```

Called by a device admin to set the short support message. This will be displayed to the user in settings screens where functionality has been disabled by the admin. The message should be limited to a short statement such as "This setting is disabled by your administrator. Contact someone@example.com for support." If the message is longer than 200 characters it may be truncated.

If the short support message needs to be localized, it is the responsibility of the `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` to listen to the `https://developer.android.com/reference/kotlin/android/content/Intent.html#ACTION_LOCALE_CHANGED:kotlin.String` broadcast and set a new version of this string accordingly.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `message` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)?: Short message to be displayed to the user in settings or null to clear the existing message. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not an active administrator. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLongSupportMessage(android.content.ComponentName,%20kotlin.CharSequence)`

### setStartUserSessionMessage

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setStartUserSessionMessage(
    admin: ComponentName, 
    startUserSessionMessage: CharSequence?
): Unit
```

Called by a device owner to specify the user session start message. This may be displayed during a user switch.

The message should be limited to a short statement or it may be truncated.

If the message needs to be localized, it is the responsibility of the `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` to listen to the `https://developer.android.com/reference/kotlin/android/content/Intent.html#ACTION_LOCALE_CHANGED:kotlin.String` broadcast and set a new version of this message accordingly.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `startUserSessionMessage` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)?: message for starting user session, or `null` to use system default message. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

### setStatusBarDisabled

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setStatusBarDisabled(
    admin: ComponentName?, 
    disabled: Boolean
): Boolean
```

Called by device owner or profile owner of secondary users that is affiliated with the device to disable the status bar.

**Note:** This method has no effect for LockTask mode. The behavior of the status bar in LockTask mode can be configured with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setLockTaskFeatures(android.content.ComponentName,%20kotlin.Int)`. Calls to this method when the device is in LockTask mode will be registered, but will only take effect when the device leaves LockTask mode.

This policy does not have any effect while on the lock screen, where the status bar will not be disabled. Using LockTask instead of this method is recommended.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `disabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): `true` disables the status bar, `false` reenables it. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `false` if attempting to disable the status bar failed. `true` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not the device owner, or a profile owner of secondary user that is affiliated with the device. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#isAffiliatedUser()`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getSecondaryUsers(android.content.ComponentName)`

### setStorageEncryption

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setStorageEncryption(
    admin: ComponentName, 
    encrypt: Boolean
): Int
```

**Deprecated:** *This method does not actually modify the storage encryption of the device. It has never affected the encryption status of a device. Called by an application that is administering the device to request that the storage system be encrypted. Does nothing if the caller is on a secondary user or a managed profile.*

*When multiple device administrators attempt to control device encryption, the most secure, supported setting will always be used. If any device administrator requests device encryption, it will be enabled; Conversely, if a device administrator attempts to disable device encryption while another device administrator has enabled it, the call to disable will fail (most commonly returning `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE:kotlin.Int`).*
*This policy controls encryption of the secure (application data) storage area. Data written to other storage areas may or may not be encrypted, and this policy does not require or control the encryption of any other storage areas. There is one exception: If `https://developer.android.com/reference/kotlin/android/os/Environment.html#isExternalStorageEmulated()` is `true`, then the directory returned by `https://developer.android.com/reference/kotlin/android/os/Environment.html#getExternalStorageDirectory()` must be written to disk within the encrypted storage area.
Important Note: On some devices, it is possible to encrypt storage without requiring the user to create a device PIN or Password. In this case, the storage is encrypted, but the encryption key may not be fully secured. For maximum security, the administrator should also require (and check for) a pattern, PIN, or password.*

<br />

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `encrypt` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): true to request encryption, false to release any previous request |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | the new total request status (for all active admins), or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_UNSUPPORTED:kotlin.Int` if called for a non-system user. Will be one of `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_UNSUPPORTED:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_INACTIVE:kotlin.Int`, or `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE:kotlin.Int`. This is the value of the requests; use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getStorageEncryptionStatus()` to query the actual device state. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not an active administrator or does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_ENCRYPTED_STORAGE:kotlin.Int` |

### setSystemSetting

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setSystemSetting(
    admin: ComponentName, 
    setting: String, 
    value: String!
): Unit
```

Called by a device or profile owner to update `https://developer.android.com/reference/kotlin/android/provider/Settings.System.html#` settings. Validation that the value of the setting is in the correct form for the setting type should be performed by the caller.

The settings that can be updated by a device owner or profile owner of secondary user with this method are:

- `https://developer.android.com/reference/kotlin/android/provider/Settings.System.html#SCREEN_BRIGHTNESS:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/provider/Settings.System.html#SCREEN_BRIGHTNESS_MODE:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/provider/Settings.System.html#SCREEN_OFF_TIMEOUT:kotlin.String`

Starting from Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#VANILLA_ICE_CREAM:kotlin.Int`, a profile owner on an organization-owned device can call this method on the parent `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` to set system settings on the parent user.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `setting` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The name of the setting to update. This value cannot be `null`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/provider/Settings.System.html#SCREEN_BRIGHTNESS_MODE:kotlin.String` - `https://developer.android.com/reference/kotlin/android/provider/Settings.System.html#SCREEN_BRIGHTNESS:kotlin.String` - `https://developer.android.com/reference/kotlin/android/provider/Settings.System.html#SCREEN_OFF_TIMEOUT:kotlin.String` |
| `value` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The value to update the setting to. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/provider/Settings.System.html#SCREEN_OFF_TIMEOUT:kotlin.String`

### setSystemUpdatePolicy

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setSystemUpdatePolicy(
    admin: ComponentName, 
    policy: SystemUpdatePolicy!
): Unit
```

Called by device owners or profile owners of an organization-owned managed profile to set a local system update policy. When a new policy is set, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#ACTION_SYSTEM_UPDATE_POLICY_CHANGED:kotlin.String` is broadcast.

If the supplied system update policy has freeze periods set but the freeze periods do not meet 90-day maximum length or 60-day minimum separation requirement set out in `https://developer.android.com/reference/kotlin/android/app/admin/SystemUpdatePolicy#setFreezePeriods(kotlin.collections.MutableList)`, `https://developer.android.com/reference/kotlin/android/app/admin/SystemUpdatePolicy.ValidationFailedException` will the thrown. Note that the system keeps a record of freeze periods the device experienced previously, and combines them with the new freeze periods to be set when checking the maximum freeze length and minimum freeze separation constraints. As a result, freeze periods that passed validation during `https://developer.android.com/reference/kotlin/android/app/admin/SystemUpdatePolicy#setFreezePeriods(kotlin.collections.MutableList)` might fail the additional checks here due to the freeze period history. If this is causing issues during development, `adb shell dpm clear-freeze-period-record` can be used to clear the record.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. All components in the package can set system update policies and the most recent policy takes effect. This should be null if the caller is not a device admin. |
| `policy` | [SystemUpdatePolicy](https://developer.android.com/reference/kotlin/android/app/admin/SystemUpdatePolicy)!: the new policy, or `null` to clear the current policy. |

| Exceptions ||
|---|---|
| `android.app.admin.SystemUpdatePolicy.ValidationFailedException` | if the policy's freeze period does not meet the requirement. |
| `java.lang.IllegalArgumentException` | if the policy type or maintenance window is not valid. |
| `java.lang.SecurityException` | if `admin` is not a device owner or a profile owner of an organization-owned managed profile, or the caller is not permitted to set this policy |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/SystemUpdatePolicy`
- `https://developer.android.com/reference/kotlin/android/app/admin/SystemUpdatePolicy#setFreezePeriods(kotlin.collections.MutableList)`

### setTime

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setTime(
    admin: ComponentName?, 
    millis: Long
): Boolean
```

Called by a device owner or a profile owner of an organization-owned managed profile to set the system wall clock time. This only takes effect if called when `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#AUTO_TIME:kotlin.String` is 0, otherwise `false` will be returned.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `millis` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): time in milliseconds since the Epoch |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if set time succeeded, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner or a profile owner of an organization-owned managed profile. |

### setTimeZone

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setTimeZone(
    admin: ComponentName?, 
    timeZone: String!
): Boolean
```

Called by a device owner or a profile owner of an organization-owned managed profile to set the system's persistent default time zone. This only takes effect if called when `https://developer.android.com/reference/kotlin/android/provider/Settings.Global.html#AUTO_TIME_ZONE:kotlin.String` is 0, otherwise `false` will be returned.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `timeZone` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: one of the Olson ids from the list returned by java.util.TimeZone#getAvailableIDs |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if set timezone succeeded, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner or a profile owner of an organization-owned managed profile. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/AlarmManager.html#setTimeZone(kotlin.String)`

### setTrustAgentConfiguration

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setTrustAgentConfiguration(
    admin: ComponentName?, 
    target: ComponentName, 
    configuration: PersistableBundle!
): Unit
```

Sets a list of configuration features to enable for a trust agent component. This is meant to be used in conjunction with `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_TRUST_AGENTS:kotlin.Int`, which disables all trust agents but those enabled by this function call. If flag `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_TRUST_AGENTS:kotlin.Int` is not set, then this call has no effect.

For any specific trust agent, whether it is disabled or not depends on the aggregated state of each admin's `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_TRUST_AGENTS:kotlin.Int` setting and its trust agent configuration as set by this function call. In particular: if any admin sets `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_TRUST_AGENTS:kotlin.Int` and does not additionally set any trust agent configuration, the trust agent is disabled completely. Otherwise, the trust agent will receive the list of configurations from all admins who set `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#KEYGUARD_DISABLE_TRUST_AGENTS:kotlin.Int` and aggregate the configurations to determine its behavior. The exact meaning of aggregation is trust-agent-specific.

A calling device admin must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_DISABLE_KEYGUARD_FEATURES:kotlin.Int` to be able to call this method; if not, a security exception will be thrown.

This method can be called on the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#` instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)` in order to set the configuration for the parent profile.

On devices not supporting `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature, calling this method has no effect - no trust agent configuration will be set.   
Requires the `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#FEATURE_SECURE_LOCK_SCREEN:kotlin.String` feature which can be detected using `https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.html#hasSystemFeature(kotlin.String)`.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `target` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Component name of the agent to be configured. This value cannot be `null`. |
| `configuration` | [PersistableBundle](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#)!: Trust-agent-specific feature configuration bundle. Please consult documentation of the specific trust agent to determine the interpretation of this bundle. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not an active administrator or does not use `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_DISABLE_KEYGUARD_FEATURES:kotlin.Int` |

### setUninstallBlocked

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setUninstallBlocked(
    admin: ComponentName?, 
    packageName: String!, 
    uninstallBlocked: Boolean
): Unit
```

Change whether a user can uninstall a package. This function can be called by a device owner, profile owner, or by a delegate given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_BLOCK_UNINSTALL:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)` or holders of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_APPS_CONTROL:kotlin.String`.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, after the set uninstall blocked policy has been set, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully set or not. This callback will contain:

- The policy identifier `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyIdentifiers#PACKAGE_UNINSTALL_BLOCKED_POLICY:kotlin.String`
- The additional policy params bundle, which contains `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#EXTRA_PACKAGE_NAME:kotlin.String` the package name the policy applies to
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully set or the reason the policy failed to be set (e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: package to change. |
| `uninstallBlocked` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): true if the user shouldn't be able to uninstall the package. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_APPS_CONTROL:kotlin.String`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_BLOCK_UNINSTALL:kotlin.String`

### setUsbDataSignalingEnabled

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setUsbDataSignalingEnabled(enabled: Boolean): Unit
```

Called by a device owner or profile owner of an organization-owned managed profile to enable or disable USB data signaling for the device. When disabled, USB data connections (except from charging functions) are prohibited.

This API is not supported on all devices, the caller should call `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#canUsbDataSignalingBeDisabled()` to check whether enabling or disabling USB data signaling is supported on the device. Starting from Android 15, after the USB data signaling policy has been set, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully set or not. This callback will contain:

- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully set or the reason the policy failed to be set e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

| Parameters ||
|---|---|
| `enabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): whether USB data signaling should be enabled or not. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if disabling USB data signaling is not supported or if USB data signaling fails to be enabled/disabled. |
| `java.lang.SecurityException` | if the caller is not permitted to set this policy |

### setUserControlDisabledPackages

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setUserControlDisabledPackages(
    admin: ComponentName?, 
    packages: MutableList<String!>
): Unit
```

Called by a device owner or a profile owner or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_APPS_CONTROL:kotlin.String` to disable user control over apps. User will not be able to clear app data or force-stop packages. When called by a device owner, applies to all users on the device. Packages with user control disabled are exempted from App Standby Buckets.

Starting from `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int`, after the user control disabled packages policy has been set, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicySetResult(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin on whether the policy was successfully set or not. This callback will contain:

- The policy identifier `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyIdentifiers#USER_CONTROL_DISABLED_PACKAGES_POLICY:kotlin.String`
- The `https://developer.android.com/reference/kotlin/android/app/admin/TargetUser` that this policy relates to
- The `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult`, which will be `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_POLICY_SET:kotlin.Int` if the policy was successfully set or the reason the policy failed to be set (e.g. `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY:kotlin.Int`)

If there has been a change to the policy, `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateReceiver#onPolicyChanged(android.content.Context,%20kotlin.String,%20android.os.Bundle,%20android.app.admin.TargetUser,%20android.app.admin.PolicyUpdateResult)` will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the `https://developer.android.com/reference/kotlin/android/app/admin/PolicyUpdateResult` will contain the reason why the policy changed.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. Null if the caller is not a device admin. This value may be `null`. |
| `packages` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>: The package names for the apps. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner or a profile owner or holder of the permission `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_APPS_CONTROL:kotlin.String`. |

### setUserIcon

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setUserIcon(
    admin: ComponentName, 
    icon: Bitmap!
): Unit
```

Called by profile or device owners to set the user's photo.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `icon` | [Bitmap](https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#)!: the bitmap to set as the photo. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device or profile owner. |

### setWifiSsidPolicy

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setWifiSsidPolicy(policy: WifiSsidPolicy?): Unit
```

Called by device owner or profile owner of an organization-owned managed profile to specify the Wi-Fi SSID policy (`https://developer.android.com/reference/kotlin/android/app/admin/WifiSsidPolicy`). Wi-Fi SSID policy specifies the SSID restriction the network must satisfy in order to be eligible for a connection. Providing a null policy results in the deactivation of the SSID restriction

| Parameters ||
|---|---|
| `policy` | [WifiSsidPolicy](https://developer.android.com/reference/kotlin/android/app/admin/WifiSsidPolicy)?: Wi-Fi SSID policy. This value may be `null`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the caller is not permitted to manage wifi policy |

### startUserInBackground

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun startUserInBackground(
    admin: ComponentName, 
    userHandle: UserHandle
): Int
```

Called by a device owner to start the specified secondary user in background.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `userHandle` | [UserHandle](https://developer.android.com/reference/kotlin/android/os/UserHandle.html#): the user to be started in background. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | one of the following result codes: `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_UNKNOWN:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_SUCCESS:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_MANAGED_PROFILE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_MAX_RUNNING_USERS:kotlin.Int`,. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_SUCCESS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_UNKNOWN:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_MANAGED_PROFILE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_MAX_RUNNING_USERS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_CURRENT_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_LOW_STORAGE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_MAX_USERS:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getSecondaryUsers(android.content.ComponentName)`

### stopUser

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun stopUser(
    admin: ComponentName, 
    userHandle: UserHandle
): Int
```

Called by a device owner to stop the specified secondary user.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `userHandle` | [UserHandle](https://developer.android.com/reference/kotlin/android/os/UserHandle.html#): the user to be stopped. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | one of the following result codes: `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_UNKNOWN:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_SUCCESS:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_MANAGED_PROFILE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_CURRENT_USER:kotlin.Int` Value is one of the following: - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_SUCCESS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_UNKNOWN:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_MANAGED_PROFILE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_MAX_RUNNING_USERS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_CURRENT_USER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_LOW_STORAGE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/os/UserManager.html#USER_OPERATION_ERROR_MAX_USERS:kotlin.Int` |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getSecondaryUsers(android.content.ComponentName)`

### switchUser

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun switchUser(
    admin: ComponentName, 
    userHandle: UserHandle?
): Boolean
```

Called by a device owner to switch the specified secondary user to the foreground.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `userHandle` | [UserHandle](https://developer.android.com/reference/kotlin/android/os/UserHandle.html#)?: the user to switch to; null will switch to primary. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the switch was successful, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not a device owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/content/Intent.html#ACTION_USER_FOREGROUND:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getSecondaryUsers(android.content.ComponentName)`

### transferOwnership

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun transferOwnership(
    admin: ComponentName, 
    target: ComponentName, 
    bundle: PersistableBundle?
): Unit
```

Changes the current administrator to another one. All policies from the current administrator are migrated to the new administrator. The whole operation is atomic - the transfer is either complete or not done at all.

Depending on the current administrator (device owner, profile owner), you have the following expected behaviour:

- A device owner can only be transferred to a new device owner
- A profile owner can only be transferred to a new profile owner

Use the `bundle` parameter to pass data to the new administrator. The data will be received in the `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#onTransferOwnershipComplete(android.content.Context,%20android.os.PersistableBundle)` callback of the new administrator.

The transfer has failed if the original administrator is still the corresponding owner after calling this method.

The incoming target administrator must have the `<support-transfer-ownership />` tag inside the `<device-admin></device-admin>` tags in the xml file referenced by `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver#DEVICE_ADMIN_META_DATA:kotlin.String`. Otherwise an `https://developer.android.com/reference/kotlin/java/lang/IllegalArgumentException.html#` will be thrown.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `target` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` we want the new administrator to be. This value cannot be `null`. |
| `bundle` | [PersistableBundle](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#)?: data to be sent to the new administrator. This value may be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if `admin` or `target` is `null`, they are components in the same package or `target` is not an active admin. |
| `java.lang.SecurityException` | if `admin` is not a device owner nor a profile owner. |

### uninstallAllUserCaCerts

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun uninstallAllUserCaCerts(admin: ComponentName?): Unit
```

Uninstalls all custom trusted CA certificates from the profile. Certificates installed by means other than device policy will also be removed, except for system CA certificates.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if calling from a delegated certificate installer. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not `null` and not a device or profile owner. |

### uninstallCaCert

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun uninstallCaCert(
    admin: ComponentName?, 
    certBuffer: ByteArray!
): Unit
```

Uninstalls the given certificate from trusted user CAs, if present. The caller must be a profile or device owner on that user, or a delegate package given the `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_INSTALL:kotlin.String` scope via `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`; otherwise a security exception will be thrown.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)?: Which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with, or `null` if calling from a delegated certificate installer. |
| `certBuffer` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!: encoded form of the certificate to remove. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if `admin` is not `null` and not a device or profile owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setDelegatedScopes(android.content.ComponentName,%20kotlin.String,%20kotlin.collections.MutableList)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#DELEGATION_CERT_INSTALL:kotlin.String`

### updateOverrideApn

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun updateOverrideApn(
    admin: ComponentName, 
    apnId: Int, 
    apnSetting: ApnSetting
): Boolean
```

Called by device owner or managed profile owner to update an override APN.

This method may returns `false` if there is no override APN with the given `apnId`.

This method may also returns `false` if `apnSetting` conflicts with an existing override APN. Update the existing conflicted APN instead.

See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#addOverrideApn(android.content.ComponentName,%20android.telephony.data.ApnSetting)` for the definition of conflict.

Before Android version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int`: Only device owners can update APNs.

Starting from Android version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int`: Both device owners and managed profile owners can update enterprise APNs (`https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#TYPE_ENTERPRISE:kotlin.Int`), while only device owners can update other type of APNs.

| Parameters ||
|---|---|
| `admin` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#): which `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver` this request is associated with. This value cannot be `null`. |
| `apnId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the `id` of the override APN to update |
| `apnSetting` | [ApnSetting](https://developer.android.com/reference/kotlin/android/telephony/data/ApnSetting.html#): the override APN to update. This value cannot be `null`. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if the required override APN is successfully updated, `false` otherwise. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | If request is for enterprise APN `admin` is either device owner or profile owner and in all other types of APN if `admin` is not a device owner. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#setOverrideApnsEnabled(android.content.ComponentName,%20kotlin.Boolean)`

### wipeData

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun wipeData(flags: Int): Unit
```

See `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int,%20kotlin.CharSequence)`

| Parameters ||
|---|---|
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Bit mask of additional options: currently supported flags are `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_EXTERNAL_STORAGE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_RESET_PROTECTION_DATA:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_SILENTLY:kotlin.Int`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if called on last full-user or system-user and the calling app targets SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` or above. |
| `java.lang.SecurityException` | if the calling application does not own an active administrator that uses `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_WIPE_DATA:kotlin.Int` and is not granted the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MASTER_CLEAR:kotlin.String` or `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_WIPE_DATA:kotlin.String` permissions. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeDevice(kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int,%20kotlin.CharSequence)`

### wipeData

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun wipeData(
    flags: Int, 
    reason: CharSequence
): Unit
```

Ask that all user data be wiped.

If called as a secondary user or managed profile, the user itself and its associated user data will be wiped. In particular, If the caller is a profile owner of an organization-owned managed profile, calling this method will relinquish the device for personal use, removing the managed profile and all policies set by the profile owner. In this case, the flags `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_EXTERNAL_STORAGE:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_RESET_PROTECTION_DATA:kotlin.Int` are ignored.

Calling this method from the primary user will only work if the calling app is targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int` or below, in which case it will cause the device to reboot, erasing all device data - including all the secondary users and their data - while booting up. If an app targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` and above is calling this method from the primary user or last full user, `https://developer.android.com/reference/kotlin/java/lang/IllegalStateException.html#` will be thrown.
If an app wants to wipe the entire device irrespective of which user they are from, they should use `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeDevice(kotlin.Int)` instead.

| Parameters ||
|---|---|
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Bit mask of additional options: currently supported flags are `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_EXTERNAL_STORAGE:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_RESET_PROTECTION_DATA:kotlin.Int`. |
| `reason` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html): a string that contains the reason for wiping data, which can be presented to the user. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if the input reason string is null or empty, or if `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_SILENTLY:kotlin.Int` is set. |
| `java.lang.IllegalStateException` | if called on last full-user or system-user and the calling app targets SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` or above. |
| `java.lang.SecurityException` | if the calling application does not own an active administrator that uses `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_WIPE_DATA:kotlin.Int` and is not granted the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MASTER_CLEAR:kotlin.String` or `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_WIPE_DATA:kotlin.String` permissions. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeDevice(kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int)`

### wipeDevice

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun wipeDevice(flags: Int): Unit
```

Ask that the device be wiped and factory reset.

The calling Device Owner or Organization Owned Profile Owner must have requested `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_WIPE_DATA:kotlin.Int` to be able to call this method; if it has not, a security exception will be thrown.

For calling apps targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int` or below, if the calling app is running in a non-system user (e.g., a Profile Owner), this method falls back to a user wipe (only the calling user and its data are wiped, and the device is not factory reset). In this case, the flags `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_EXTERNAL_STORAGE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_RESET_PROTECTION_DATA:kotlin.Int`, and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_EUICC:kotlin.Int` are ignored. An organization-owned profile owner can still wipe the device by calling this method on the parent instance returned by `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#getParentProfileInstance(android.content.ComponentName)`.

For calling apps targeting SDK level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#UPSIDE_DOWN_CAKE:kotlin.Int` and above, this method explicitly requests a device wipe (factory reset). It will always attempt to factory reset the device, and all supported flags will be respected, regardless of which user the calling app is running in.

| Parameters ||
|---|---|
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Bit mask of additional options: currently supported flags are `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_EXTERNAL_STORAGE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_RESET_PROTECTION_DATA:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_EUICC:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#WIPE_SILENTLY:kotlin.Int`. |

| Exceptions ||
|---|---|
| `java.lang.SecurityException` | if the calling application does not own an active administrator that uses `https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminInfo#USES_POLICY_WIPE_DATA:kotlin.Int` and is not granted the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MASTER_CLEAR:kotlin.String` or both the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_WIPE_DATA:kotlin.String` and `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#MANAGE_DEVICE_POLICY_ACROSS_USERS:kotlin.String` permissions. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager#wipeData(kotlin.Int,%20kotlin.CharSequence)`