# RestrictionsManager

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Constants](https://developer.android.com/reference/android/content/RestrictionsManager#constants)\|[Methods](https://developer.android.com/reference/android/content/RestrictionsManager#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/content/RestrictionsManager#inhmethods)  

# RestrictionsManager

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/content/RestrictionsManager "View this page in Kotlin")\|Java

`
public


class
RestrictionsManager
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|-------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.content.RestrictionsManager |

<br />

*** ** * ** ***

Provides a mechanism for apps to query restrictions imposed by an entity that manages the user. Apps can also send permission requests to a local or remote device administrator to override default app-specific restrictions or any other operation that needs explicit authorization from the administrator.

Apps can expose a set of restrictions via an XML file specified in the manifest.

If the user has an active Restrictions Provider, dynamic requests can be made in addition to the statically imposed restrictions. Dynamic requests are app-specific and can be expressed via a predefined set of request types.

The RestrictionsManager forwards the dynamic requests to the active Restrictions Provider. The Restrictions Provider can respond back to requests by calling[notifyPermissionResponse(java.lang.String, android.os.PersistableBundle)](https://developer.android.com/reference/android/content/RestrictionsManager#notifyPermissionResponse(java.lang.String,%20android.os.PersistableBundle)), when a response is received from the administrator of the device or user. The response is relayed back to the application via a protected broadcast,[ACTION_PERMISSION_RESPONSE_RECEIVED](https://developer.android.com/reference/android/content/RestrictionsManager#ACTION_PERMISSION_RESPONSE_RECEIVED).

Static restrictions are specified by an XML file referenced by a meta-data attribute in the manifest. This enables applications as well as any web administration consoles to be able to read the list of available restrictions from the apk.

The syntax of the XML format is as follows:  

```
 <?xml version="1.0" encoding="utf-8"?>
 <restrictions xmlns:android="http://schemas.android.com/apk/res/android" >
     <restriction
         android:key="string"
         android:title="string resource"
         android:restrictionType=["bool" | "string" | "integer"
                                         | "choice" | "multi-select" | "hidden"
                                         | "bundle" | "bundle_array"]
         android:description="string resource"
         android:entries="string-array resource"
         android:entryValues="string-array resource"
         android:defaultValue="reference" >
             <restriction ... />
             ...
     </restriction>
     <restriction ... />
     ...
 </restrictions>
 
```

The attributes for each restriction depend on the restriction type.

<br />

- `key`,`title`and`restrictionType`are mandatory.
- `entries`and`entryValues`are required if`restrictionType
  `is`choice`or`multi-select`.
- `defaultValue`is optional and its type depends on the`restrictionType`
- `hidden`type must have a`defaultValue`and will not be shown to the administrator. It can be used to pass along data that cannot be modified, such as a version code.
- `description`is meant to describe the restriction in more detail to the administrator controlling the values, if the title is not sufficient.

Only restrictions of type`bundle`and`bundle_array`can have one or multiple nested restriction elements.

In your manifest's`application`section, add the meta-data tag to point to the restrictions XML file as shown below:  

```
 <application ... >
     <meta-data android:name="android.content.APP_RESTRICTIONS"
                   android:resource="@xml/app_restrictions" />
     ...
 </application>
 
```

<br />

**See also:**

- [RestrictionEntry](https://developer.android.com/reference/android/content/RestrictionEntry)
- [RestrictionsReceiver](https://developer.android.com/reference/android/service/restrictions/RestrictionsReceiver)
- [DevicePolicyManager.setRestrictionsProvider(ComponentName, ComponentName)](https://developer.android.com/reference/android/app/admin/DevicePolicyManager#setRestrictionsProvider(android.content.ComponentName,%20android.content.ComponentName))
- [DevicePolicyManager.setApplicationRestrictions(ComponentName, String, Bundle)](https://developer.android.com/reference/android/app/admin/DevicePolicyManager#setApplicationRestrictions(android.content.ComponentName,%20java.lang.String,%20android.os.Bundle))

## Summary

|                                                                                                                                                                                ### Constants                                                                                                                                                                                ||
|--------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | [ACTION_PERMISSION_RESPONSE_RECEIVED](https://developer.android.com/reference/android/content/RestrictionsManager#ACTION_PERMISSION_RESPONSE_RECEIVED) Broadcast intent delivered when a response is received for a permission request.                                                                 |
| [String](https://developer.android.com/reference/java/lang/String) | [ACTION_REQUEST_LOCAL_APPROVAL](https://developer.android.com/reference/android/content/RestrictionsManager#ACTION_REQUEST_LOCAL_APPROVAL) Activity intent that is optionally implemented by the Restrictions Provider package to challenge for an administrator PIN or password locally on the device. |
| [String](https://developer.android.com/reference/java/lang/String) | [ACTION_REQUEST_PERMISSION](https://developer.android.com/reference/android/content/RestrictionsManager#ACTION_REQUEST_PERMISSION) Broadcast intent sent to the Restrictions Provider to handle a permission request from an app.                                                                       |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_PACKAGE_NAME](https://developer.android.com/reference/android/content/RestrictionsManager#EXTRA_PACKAGE_NAME) The package name of the application making the request.                                                                                                                            |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_REQUEST_BUNDLE](https://developer.android.com/reference/android/content/RestrictionsManager#EXTRA_REQUEST_BUNDLE) The request bundle passed in the[ACTION_REQUEST_PERMISSION](https://developer.android.com/reference/android/content/RestrictionsManager#ACTION_REQUEST_PERMISSION)broadcast.   |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_REQUEST_ID](https://developer.android.com/reference/android/content/RestrictionsManager#EXTRA_REQUEST_ID) The request ID passed in the[ACTION_REQUEST_PERMISSION](https://developer.android.com/reference/android/content/RestrictionsManager#ACTION_REQUEST_PERMISSION)broadcast.               |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_REQUEST_TYPE](https://developer.android.com/reference/android/content/RestrictionsManager#EXTRA_REQUEST_TYPE) The request type passed in the[ACTION_REQUEST_PERMISSION](https://developer.android.com/reference/android/content/RestrictionsManager#ACTION_REQUEST_PERMISSION)broadcast.         |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_RESPONSE_BUNDLE](https://developer.android.com/reference/android/content/RestrictionsManager#EXTRA_RESPONSE_BUNDLE) Contains a response from the administrator for specific request.                                                                                                             |
| [String](https://developer.android.com/reference/java/lang/String) | [META_DATA_APP_RESTRICTIONS](https://developer.android.com/reference/android/content/RestrictionsManager#META_DATA_APP_RESTRICTIONS) Name of the meta-data entry in the manifest that points to the XML file containing the application's available restrictions.                                       |
| [String](https://developer.android.com/reference/java/lang/String) | [REQUEST_KEY_APPROVE_LABEL](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_APPROVE_LABEL) Key for request approval button label contained in the request bundle.                                                                                               |
| [String](https://developer.android.com/reference/java/lang/String) | [REQUEST_KEY_DATA](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_DATA) Key for request data contained in the request bundle.                                                                                                                                  |
| [String](https://developer.android.com/reference/java/lang/String) | [REQUEST_KEY_DENY_LABEL](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_DENY_LABEL) Key for request rejection button label contained in the request bundle.                                                                                                    |
| [String](https://developer.android.com/reference/java/lang/String) | [REQUEST_KEY_ICON](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_ICON) Key for request icon contained in the request bundle.                                                                                                                                  |
| [String](https://developer.android.com/reference/java/lang/String) | [REQUEST_KEY_ID](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_ID) Key for request ID contained in the request bundle.                                                                                                                                        |
| [String](https://developer.android.com/reference/java/lang/String) | [REQUEST_KEY_MESSAGE](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_MESSAGE) Key for request message contained in the request bundle.                                                                                                                         |
| [String](https://developer.android.com/reference/java/lang/String) | [REQUEST_KEY_NEW_REQUEST](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_NEW_REQUEST) Key for issuing a new request, contained in the request bundle.                                                                                                          |
| [String](https://developer.android.com/reference/java/lang/String) | [REQUEST_KEY_TITLE](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_TITLE) Key for request title contained in the request bundle.                                                                                                                               |
| [String](https://developer.android.com/reference/java/lang/String) | [REQUEST_TYPE_APPROVAL](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_TYPE_APPROVAL) Request type for a simple question, with a possible title and icon.                                                                                                          |
| [String](https://developer.android.com/reference/java/lang/String) | [RESPONSE_KEY_ERROR_CODE](https://developer.android.com/reference/android/content/RestrictionsManager#RESPONSE_KEY_ERROR_CODE) Key for the optional error code in the response bundle sent to the application.                                                                                          |
| [String](https://developer.android.com/reference/java/lang/String) | [RESPONSE_KEY_MESSAGE](https://developer.android.com/reference/android/content/RestrictionsManager#RESPONSE_KEY_MESSAGE) Key for the optional message in the response bundle sent to the application.                                                                                                   |
| [String](https://developer.android.com/reference/java/lang/String) | [RESPONSE_KEY_RESPONSE_TIMESTAMP](https://developer.android.com/reference/android/content/RestrictionsManager#RESPONSE_KEY_RESPONSE_TIMESTAMP) Key for the optional timestamp of when the administrator responded to the permission request.                                                            |
| [String](https://developer.android.com/reference/java/lang/String) | [RESPONSE_KEY_RESULT](https://developer.android.com/reference/android/content/RestrictionsManager#RESPONSE_KEY_RESULT) Key for the response result in the response bundle sent to the application, for a permission request.                                                                            |
| `int`                                                              | [RESULT_APPROVED](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_APPROVED) Response result value indicating that the request was approved.                                                                                                                          |
| `int`                                                              | [RESULT_DENIED](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_DENIED) Response result value indicating that the request was denied.                                                                                                                                |
| `int`                                                              | [RESULT_ERROR](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_ERROR) Response result value indicating an error condition.                                                                                                                                           |
| `int`                                                              | [RESULT_ERROR_BAD_REQUEST](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_ERROR_BAD_REQUEST) Error code indicating that there was a problem with the request.                                                                                                       |
| `int`                                                              | [RESULT_ERROR_INTERNAL](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_ERROR_INTERNAL) Error code indicating that there was an internal error.                                                                                                                      |
| `int`                                                              | [RESULT_ERROR_NETWORK](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_ERROR_NETWORK) Error code indicating that there was a problem with the network.                                                                                                               |
| `int`                                                              | [RESULT_NO_RESPONSE](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_NO_RESPONSE) Response result value indicating that the request has not received a response yet.                                                                                                 |
| `int`                                                              | [RESULT_UNKNOWN_REQUEST](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_UNKNOWN_REQUEST) Response result value indicating that the request is unknown, when it's not a new request.                                                                                 |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static `[Bundle](https://developer.android.com/reference/android/os/Bundle)                                                                                       | ` `[convertRestrictionsToBundle](https://developer.android.com/reference/android/content/RestrictionsManager#convertRestrictionsToBundle(java.util.List<android.content.RestrictionEntry>))`(`[List](https://developer.android.com/reference/java/util/List)`<`[RestrictionEntry](https://developer.android.com/reference/android/content/RestrictionEntry)`> entries) ` Converts a list of restrictions to the corresponding bundle, using the following mapping: |                                                                                                                   RestrictionEntry                                                                                                                    |                                                                         Bundle                                                                         | |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| | [RestrictionEntry.TYPE_BOOLEAN](https://developer.android.com/reference/android/content/RestrictionEntry#TYPE_BOOLEAN)                                                                                                                                | [Bundle.putBoolean](https://developer.android.com/reference/android/os/BaseBundle#putBoolean(java.lang.String,%20boolean))                             | | [RestrictionEntry.TYPE_CHOICE](https://developer.android.com/reference/android/content/RestrictionEntry#TYPE_CHOICE),[RestrictionEntry.TYPE_MULTI_SELECT](https://developer.android.com/reference/android/content/RestrictionEntry#TYPE_MULTI_SELECT) | [Bundle.putStringArray](https://developer.android.com/reference/android/os/BaseBundle#putStringArray(java.lang.String,%20java.lang.String[]))          | | [RestrictionEntry.TYPE_INTEGER](https://developer.android.com/reference/android/content/RestrictionEntry#TYPE_INTEGER)                                                                                                                                | [Bundle.putInt](https://developer.android.com/reference/android/os/BaseBundle#putInt(java.lang.String,%20int))                                         | | [RestrictionEntry.TYPE_STRING](https://developer.android.com/reference/android/content/RestrictionEntry#TYPE_STRING)                                                                                                                                  | [Bundle.putString](https://developer.android.com/reference/android/os/BaseBundle#putString(java.lang.String,%20java.lang.String))                      | | [RestrictionEntry.TYPE_BUNDLE](https://developer.android.com/reference/android/content/RestrictionEntry#TYPE_BUNDLE)                                                                                                                                  | [Bundle.putBundle](https://developer.android.com/reference/android/os/Bundle#putBundle(java.lang.String,%20android.os.Bundle))                         | | [RestrictionEntry.TYPE_BUNDLE_ARRAY](https://developer.android.com/reference/android/content/RestrictionEntry#TYPE_BUNDLE_ARRAY)                                                                                                                      | [Bundle.putParcelableArray](https://developer.android.com/reference/android/os/Bundle#putParcelableArray(java.lang.String,%20android.os.Parcelable[])) | <br /> |
| ` `[Intent](https://developer.android.com/reference/android/content/Intent)                                                                                         | ` `[createLocalApprovalIntent](https://developer.android.com/reference/android/content/RestrictionsManager#createLocalApprovalIntent())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` `[Bundle](https://developer.android.com/reference/android/os/Bundle)                                                                                              | ` `[getApplicationRestrictions](https://developer.android.com/reference/android/content/RestrictionsManager#getApplicationRestrictions())`() ` Returns any available set of application-specific restrictions applicable to this application.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[Bundle](https://developer.android.com/reference/android/os/Bundle)`>`                          | ` `[getApplicationRestrictionsPerAdmin](https://developer.android.com/reference/android/content/RestrictionsManager#getApplicationRestrictionsPerAdmin())`() ` Returns a[List](https://developer.android.com/reference/java/util/List)containing a[Bundle](https://developer.android.com/reference/android/os/Bundle)for each managing agent that has set restrictions for the current application, the bundle contains any application restrictions set for the current package.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[RestrictionEntry](https://developer.android.com/reference/android/content/RestrictionEntry)`>` | ` `[getManifestRestrictions](https://developer.android.com/reference/android/content/RestrictionsManager#getManifestRestrictions(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` packageName) ` Parse and return the list of restrictions defined in the manifest for the specified package, if any.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` boolean`                                                                                                                                                          | ` `[hasRestrictionsProvider](https://developer.android.com/reference/android/content/RestrictionsManager#hasRestrictionsProvider())`() ` Called by an application to check if there is an active Restrictions Provider.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` void`                                                                                                                                                             | ` `[notifyPermissionResponse](https://developer.android.com/reference/android/content/RestrictionsManager#notifyPermissionResponse(java.lang.String,%20android.os.PersistableBundle))`(`[String](https://developer.android.com/reference/java/lang/String)` packageName, `[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle)` response) ` Called by the Restrictions Provider to deliver a response to an application.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` void`                                                                                                                                                             | ` `[requestPermission](https://developer.android.com/reference/android/content/RestrictionsManager#requestPermission(java.lang.String,%20java.lang.String,%20android.os.PersistableBundle))`(`[String](https://developer.android.com/reference/java/lang/String)` requestType, `[String](https://developer.android.com/reference/java/lang/String)` requestId, `[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle)` request) ` Called by an application to request permission for an operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Constants

### ACTION_PERMISSION_RESPONSE_RECEIVED

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

```
public static final String ACTION_PERMISSION_RESPONSE_RECEIVED
```

Broadcast intent delivered when a response is received for a permission request. The application should not interrupt the user by coming to the foreground if it isn't currently in the foreground. It can either post a notification informing the user of the response or wait until the next time the user launches the app.

For instance, if the user requested permission to make an in-app purchase, the app can post a notification that the request had been approved or denied.

The broadcast Intent carries the following extra:[EXTRA_RESPONSE_BUNDLE](https://developer.android.com/reference/android/content/RestrictionsManager#EXTRA_RESPONSE_BUNDLE).

<br />

Constant Value: "android.content.action.PERMISSION_RESPONSE_RECEIVED"  

### ACTION_REQUEST_LOCAL_APPROVAL

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

```
public static final String ACTION_REQUEST_LOCAL_APPROVAL
```

Activity intent that is optionally implemented by the Restrictions Provider package to challenge for an administrator PIN or password locally on the device. Apps will call this intent using[Activity.startActivityForResult](https://developer.android.com/reference/android/app/Activity#startActivityForResult(android.content.Intent,%20int)). On a successful response,[Activity.onActivityResult](https://developer.android.com/reference/android/app/Activity#onActivityResult(int,%20int,%20android.content.Intent))will return a resultCode of[Activity.RESULT_OK](https://developer.android.com/reference/android/app/Activity#RESULT_OK).

The intent must contain[EXTRA_REQUEST_BUNDLE](https://developer.android.com/reference/android/content/RestrictionsManager#EXTRA_REQUEST_BUNDLE)as an extra and the bundle must contain at least[REQUEST_KEY_MESSAGE](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_MESSAGE)for the activity to display.

<br />

<br />

**See also:**

- [createLocalApprovalIntent()](https://developer.android.com/reference/android/content/RestrictionsManager#createLocalApprovalIntent())

Constant Value: "android.content.action.REQUEST_LOCAL_APPROVAL"  

### ACTION_REQUEST_PERMISSION

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

```
public static final String ACTION_REQUEST_PERMISSION
```

Broadcast intent sent to the Restrictions Provider to handle a permission request from an app. It will have the following extras:[EXTRA_PACKAGE_NAME](https://developer.android.com/reference/android/content/RestrictionsManager#EXTRA_PACKAGE_NAME),[EXTRA_REQUEST_TYPE](https://developer.android.com/reference/android/content/RestrictionsManager#EXTRA_REQUEST_TYPE),[EXTRA_REQUEST_ID](https://developer.android.com/reference/android/content/RestrictionsManager#EXTRA_REQUEST_ID)and[EXTRA_REQUEST_BUNDLE](https://developer.android.com/reference/android/content/RestrictionsManager#EXTRA_REQUEST_BUNDLE). The Restrictions Provider will handle the request and respond back to the RestrictionsManager, when a response is available, by calling[notifyPermissionResponse(String, PersistableBundle)](https://developer.android.com/reference/android/content/RestrictionsManager#notifyPermissionResponse(java.lang.String,%20android.os.PersistableBundle)).

The BroadcastReceiver must require the[Manifest.permission.BIND_DEVICE_ADMIN](https://developer.android.com/reference/android/Manifest.permission#BIND_DEVICE_ADMIN)permission to ensure that only the system can send the broadcast.

<br />

Constant Value: "android.content.action.REQUEST_PERMISSION"  

### EXTRA_PACKAGE_NAME

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

```
public static final String EXTRA_PACKAGE_NAME
```

The package name of the application making the request.

Type: String

<br />

Constant Value: "android.content.extra.PACKAGE_NAME"  

### EXTRA_REQUEST_BUNDLE

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

```
public static final String EXTRA_REQUEST_BUNDLE
```

The request bundle passed in the[ACTION_REQUEST_PERMISSION](https://developer.android.com/reference/android/content/RestrictionsManager#ACTION_REQUEST_PERMISSION)broadcast.

Type:[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle)

<br />

Constant Value: "android.content.extra.REQUEST_BUNDLE"  

### EXTRA_REQUEST_ID

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

```
public static final String EXTRA_REQUEST_ID
```

The request ID passed in the[ACTION_REQUEST_PERMISSION](https://developer.android.com/reference/android/content/RestrictionsManager#ACTION_REQUEST_PERMISSION)broadcast.

Type: String

<br />

Constant Value: "android.content.extra.REQUEST_ID"  

### EXTRA_REQUEST_TYPE

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

```
public static final String EXTRA_REQUEST_TYPE
```

The request type passed in the[ACTION_REQUEST_PERMISSION](https://developer.android.com/reference/android/content/RestrictionsManager#ACTION_REQUEST_PERMISSION)broadcast.

Type: String

<br />

Constant Value: "android.content.extra.REQUEST_TYPE"  

### EXTRA_RESPONSE_BUNDLE

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

```
public static final String EXTRA_RESPONSE_BUNDLE
```

Contains a response from the administrator for specific request. The bundle contains the following information, at least:

- [REQUEST_KEY_ID](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_ID): The request ID.
- [RESPONSE_KEY_RESULT](https://developer.android.com/reference/android/content/RestrictionsManager#RESPONSE_KEY_RESULT): The response result.

Type:[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle)

<br />

Constant Value: "android.content.extra.RESPONSE_BUNDLE"  

### META_DATA_APP_RESTRICTIONS

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

```
public static final String META_DATA_APP_RESTRICTIONS
```

Name of the meta-data entry in the manifest that points to the XML file containing the application's available restrictions.

<br />

**See also:**

- [getManifestRestrictions(String)](https://developer.android.com/reference/android/content/RestrictionsManager#getManifestRestrictions(java.lang.String))

Constant Value: "android.content.APP_RESTRICTIONS"  

### REQUEST_KEY_APPROVE_LABEL

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

```
public static final String REQUEST_KEY_APPROVE_LABEL
```

Key for request approval button label contained in the request bundle.

Optional, may be shown as a label on the positive button in a dialog or notification presented to the administrator who approves the request.

Type: String

<br />

Constant Value: "android.request.approve_label"  

### REQUEST_KEY_DATA

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

```
public static final String REQUEST_KEY_DATA
```

Key for request data contained in the request bundle.

Optional, typically used to identify the specific data that is being referred to, such as the unique identifier for a movie or book. This is not used for display purposes and is more like a cookie. This value is returned in the[EXTRA_RESPONSE_BUNDLE](https://developer.android.com/reference/android/content/RestrictionsManager#EXTRA_RESPONSE_BUNDLE).

Type: String

<br />

Constant Value: "android.request.data"  

### REQUEST_KEY_DENY_LABEL

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

```
public static final String REQUEST_KEY_DENY_LABEL
```

Key for request rejection button label contained in the request bundle.

Optional, may be shown as a label on the negative button in a dialog or notification presented to the administrator who approves the request.

Type: String

<br />

Constant Value: "android.request.deny_label"  

### REQUEST_KEY_ICON

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

```
public static final String REQUEST_KEY_ICON
```

Key for request icon contained in the request bundle.

Optional, shown alongside the request message presented to the administrator who approves the request. The content must be a compressed image such as a PNG or JPEG, as a byte array.

Type: byte\[\]

<br />

Constant Value: "android.request.icon"  

### REQUEST_KEY_ID

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

```
public static final String REQUEST_KEY_ID
```

Key for request ID contained in the request bundle.

App-generated request ID to identify the specific request when receiving a response. This value is returned in the[EXTRA_RESPONSE_BUNDLE](https://developer.android.com/reference/android/content/RestrictionsManager#EXTRA_RESPONSE_BUNDLE).

Type: String

<br />

Constant Value: "android.request.id"  

### REQUEST_KEY_MESSAGE

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

```
public static final String REQUEST_KEY_MESSAGE
```

Key for request message contained in the request bundle.

Required, shown as the actual message in a notification or dialog presented to the administrator who approves the request.

Type: String

<br />

Constant Value: "android.request.mesg"  

### REQUEST_KEY_NEW_REQUEST

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

```
public static final String REQUEST_KEY_NEW_REQUEST
```

Key for issuing a new request, contained in the request bundle. If this is set to true, the Restrictions Provider must make a new request. If it is false or not specified, then the Restrictions Provider can return a cached response that has the same requestId, if available. If there's no cached response, it will issue a new one to the administrator.

Type: boolean

<br />

Constant Value: "android.request.new_request"  

### REQUEST_KEY_TITLE

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

```
public static final String REQUEST_KEY_TITLE
```

Key for request title contained in the request bundle.

Optional, typically used as the title of any notification or dialog presented to the administrator who approves the request.

Type: String

<br />

Constant Value: "android.request.title"  

### REQUEST_TYPE_APPROVAL

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

```
public static final String REQUEST_TYPE_APPROVAL
```

Request type for a simple question, with a possible title and icon.

Required keys are:[REQUEST_KEY_MESSAGE](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_MESSAGE)

Optional keys are[REQUEST_KEY_DATA](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_DATA),[REQUEST_KEY_ICON](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_ICON),[REQUEST_KEY_TITLE](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_TITLE),[REQUEST_KEY_APPROVE_LABEL](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_APPROVE_LABEL)and[REQUEST_KEY_DENY_LABEL](https://developer.android.com/reference/android/content/RestrictionsManager#REQUEST_KEY_DENY_LABEL).

<br />

Constant Value: "android.request.type.approval"  

### RESPONSE_KEY_ERROR_CODE

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

```
public static final String RESPONSE_KEY_ERROR_CODE
```

Key for the optional error code in the response bundle sent to the application.

Type: int

Possible values:[RESULT_ERROR_BAD_REQUEST](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_ERROR_BAD_REQUEST),[RESULT_ERROR_NETWORK](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_ERROR_NETWORK)or[RESULT_ERROR_INTERNAL](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_ERROR_INTERNAL).

<br />

Constant Value: "android.response.errorcode"  

### RESPONSE_KEY_MESSAGE

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

```
public static final String RESPONSE_KEY_MESSAGE
```

Key for the optional message in the response bundle sent to the application.

Type: String

<br />

Constant Value: "android.response.msg"  

### RESPONSE_KEY_RESPONSE_TIMESTAMP

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

```
public static final String RESPONSE_KEY_RESPONSE_TIMESTAMP
```

Key for the optional timestamp of when the administrator responded to the permission request. It is an represented in milliseconds since January 1, 1970 00:00:00.0 UTC.

Type: long

<br />

Constant Value: "android.response.timestamp"  

### RESPONSE_KEY_RESULT

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

```
public static final String RESPONSE_KEY_RESULT
```

Key for the response result in the response bundle sent to the application, for a permission request. It indicates the status of the request. In some cases an additional message might be available in[RESPONSE_KEY_MESSAGE](https://developer.android.com/reference/android/content/RestrictionsManager#RESPONSE_KEY_MESSAGE), to be displayed to the user.

Type: int

Possible values:[RESULT_APPROVED](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_APPROVED),[RESULT_DENIED](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_DENIED),[RESULT_NO_RESPONSE](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_NO_RESPONSE),[RESULT_UNKNOWN_REQUEST](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_UNKNOWN_REQUEST)or[RESULT_ERROR](https://developer.android.com/reference/android/content/RestrictionsManager#RESULT_ERROR).

<br />

Constant Value: "android.response.result"  

### RESULT_APPROVED

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

```
public static final int RESULT_APPROVED
```

Response result value indicating that the request was approved.

<br />

Constant Value: 1 (0x00000001)  

### RESULT_DENIED

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

```
public static final int RESULT_DENIED
```

Response result value indicating that the request was denied.

<br />

Constant Value: 2 (0x00000002)  

### RESULT_ERROR

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

```
public static final int RESULT_ERROR
```

Response result value indicating an error condition. Additional error code might be available in the response bundle, for the key[RESPONSE_KEY_ERROR_CODE](https://developer.android.com/reference/android/content/RestrictionsManager#RESPONSE_KEY_ERROR_CODE). There might also be an associated error message in the response bundle, for the key[RESPONSE_KEY_MESSAGE](https://developer.android.com/reference/android/content/RestrictionsManager#RESPONSE_KEY_MESSAGE).

<br />

Constant Value: 5 (0x00000005)  

### RESULT_ERROR_BAD_REQUEST

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

```
public static final int RESULT_ERROR_BAD_REQUEST
```

Error code indicating that there was a problem with the request.

Stored in[RESPONSE_KEY_ERROR_CODE](https://developer.android.com/reference/android/content/RestrictionsManager#RESPONSE_KEY_ERROR_CODE)field in the response bundle.

<br />

Constant Value: 1 (0x00000001)  

### RESULT_ERROR_INTERNAL

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

```
public static final int RESULT_ERROR_INTERNAL
```

Error code indicating that there was an internal error.

Stored in[RESPONSE_KEY_ERROR_CODE](https://developer.android.com/reference/android/content/RestrictionsManager#RESPONSE_KEY_ERROR_CODE)field in the response bundle.

<br />

Constant Value: 3 (0x00000003)  

### RESULT_ERROR_NETWORK

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

```
public static final int RESULT_ERROR_NETWORK
```

Error code indicating that there was a problem with the network.

Stored in[RESPONSE_KEY_ERROR_CODE](https://developer.android.com/reference/android/content/RestrictionsManager#RESPONSE_KEY_ERROR_CODE)field in the response bundle.

<br />

Constant Value: 2 (0x00000002)  

### RESULT_NO_RESPONSE

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

```
public static final int RESULT_NO_RESPONSE
```

Response result value indicating that the request has not received a response yet.

<br />

Constant Value: 3 (0x00000003)  

### RESULT_UNKNOWN_REQUEST

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

```
public static final int RESULT_UNKNOWN_REQUEST
```

Response result value indicating that the request is unknown, when it's not a new request.

<br />

Constant Value: 4 (0x00000004)

## Public methods

### convertRestrictionsToBundle

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

```
public static Bundle convertRestrictionsToBundle (List<RestrictionEntry> entries)
```

Converts a list of restrictions to the corresponding bundle, using the following mapping:

|                                                                                                                   RestrictionEntry                                                                                                                    |                                                                         Bundle                                                                         |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
| [RestrictionEntry.TYPE_BOOLEAN](https://developer.android.com/reference/android/content/RestrictionEntry#TYPE_BOOLEAN)                                                                                                                                | [Bundle.putBoolean](https://developer.android.com/reference/android/os/BaseBundle#putBoolean(java.lang.String,%20boolean))                             |
| [RestrictionEntry.TYPE_CHOICE](https://developer.android.com/reference/android/content/RestrictionEntry#TYPE_CHOICE),[RestrictionEntry.TYPE_MULTI_SELECT](https://developer.android.com/reference/android/content/RestrictionEntry#TYPE_MULTI_SELECT) | [Bundle.putStringArray](https://developer.android.com/reference/android/os/BaseBundle#putStringArray(java.lang.String,%20java.lang.String[]))          |
| [RestrictionEntry.TYPE_INTEGER](https://developer.android.com/reference/android/content/RestrictionEntry#TYPE_INTEGER)                                                                                                                                | [Bundle.putInt](https://developer.android.com/reference/android/os/BaseBundle#putInt(java.lang.String,%20int))                                         |
| [RestrictionEntry.TYPE_STRING](https://developer.android.com/reference/android/content/RestrictionEntry#TYPE_STRING)                                                                                                                                  | [Bundle.putString](https://developer.android.com/reference/android/os/BaseBundle#putString(java.lang.String,%20java.lang.String))                      |
| [RestrictionEntry.TYPE_BUNDLE](https://developer.android.com/reference/android/content/RestrictionEntry#TYPE_BUNDLE)                                                                                                                                  | [Bundle.putBundle](https://developer.android.com/reference/android/os/Bundle#putBundle(java.lang.String,%20android.os.Bundle))                         |
| [RestrictionEntry.TYPE_BUNDLE_ARRAY](https://developer.android.com/reference/android/content/RestrictionEntry#TYPE_BUNDLE_ARRAY)                                                                                                                      | [Bundle.putParcelableArray](https://developer.android.com/reference/android/os/Bundle#putParcelableArray(java.lang.String,%20android.os.Parcelable[])) |

<br />

<br />

|                   Parameters                   ||
|-----------|-------------------------------------|
| `entries` | `List`: list of restrictions <br /> |

|                                   Returns                                   ||
|---------------------------------------------------------------------|--------|
| [Bundle](https://developer.android.com/reference/android/os/Bundle) | <br /> |

### createLocalApprovalIntent

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

```
public Intent createLocalApprovalIntent ()
```

<br />

<br />

|                                     Returns                                      ||
|--------------------------------------------------------------------------|--------|
| [Intent](https://developer.android.com/reference/android/content/Intent) | <br /> |

### getApplicationRestrictions

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

```
public Bundle getApplicationRestrictions ()
```

Returns any available set of application-specific restrictions applicable to this application.

<br />

|                                                                                                                                                                                                                                                                                                                                                                                       Returns                                                                                                                                                                                                                                                                                                                                                                                       ||
|---------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Bundle](https://developer.android.com/reference/android/os/Bundle) | the application restrictions as a Bundle. Returns null if there are no restrictions. Starting from Android version[Build.VERSION_CODES.UPSIDE_DOWN_CAKE](https://developer.android.com/reference/android/os/Build.VERSION_CODES#UPSIDE_DOWN_CAKE), it is possible for there to be multiple managing apps on the device with the ability to set restrictions, e.g. a Device Policy Controller (DPC) and a Supervision admin. This API will only return the restrictions set by the DPCs. To retrieve restrictions set by all managing apps, use[getApplicationRestrictionsPerAdmin()](https://developer.android.com/reference/android/content/RestrictionsManager#getApplicationRestrictionsPerAdmin())instead. |

**See also:**

- [DevicePolicyManager](https://developer.android.com/reference/android/app/admin/DevicePolicyManager)  

### getApplicationRestrictionsPerAdmin

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

```
public List<Bundle> getApplicationRestrictionsPerAdmin ()
```

Returns a[List](https://developer.android.com/reference/java/util/List)containing a[Bundle](https://developer.android.com/reference/android/os/Bundle)for each managing agent that has set restrictions for the current application, the bundle contains any application restrictions set for the current package. The order of the items in the list is not guaranteed to remain stable between multiple calls.

Starting from Android version[Build.VERSION_CODES.UPSIDE_DOWN_CAKE](https://developer.android.com/reference/android/os/Build.VERSION_CODES#UPSIDE_DOWN_CAKE), it is possible for there to be multiple managing apps on the device with the ability to set restrictions, e.g. an Enterprise Device Policy Controller (DPC) and a Supervision admin.

Each[Bundle](https://developer.android.com/reference/android/os/Bundle)consists of key-value pairs, as defined by the application, where the types of values may be:

- `boolean`
- `int`
- `String`or`String[]`
- From[Build.VERSION_CODES.M](https://developer.android.com/reference/android/os/Build.VERSION_CODES#M),`Bundle`or`Bundle[]`

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.

<br />

|                                                                                                                                                                                                                                            Returns                                                                                                                                                                                                                                            ||
|-----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[Bundle](https://developer.android.com/reference/android/os/Bundle)`>` | a[List](https://developer.android.com/reference/java/util/List)of[Bundle](https://developer.android.com/reference/android/os/Bundle)containing the restrictions set by admins for that package. Returns an empty[List](https://developer.android.com/reference/java/util/List)if there are no saved restrictions. This value cannot be`null`. <br /> |

**See also:**

- [UserManager.KEY_RESTRICTIONS_PENDING](https://developer.android.com/reference/android/os/UserManager#KEY_RESTRICTIONS_PENDING)
- [DevicePolicyManager](https://developer.android.com/reference/android/app/admin/DevicePolicyManager)  

### getManifestRestrictions

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

```
public List<RestrictionEntry> getManifestRestrictions (String packageName)
```

Parse and return the list of restrictions defined in the manifest for the specified package, if any.

<br />

|                                        Parameters                                         ||
|---------------|----------------------------------------------------------------------------|
| `packageName` | `String`: The application for which to fetch the restrictions list. <br /> |

|                                                                                                                                              Returns                                                                                                                                              ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[RestrictionEntry](https://developer.android.com/reference/android/content/RestrictionEntry)`>` | The list of RestrictionEntry objects created from the XML file specified in the manifest, or null if none was specified. <br /> |

### hasRestrictionsProvider

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

```
public boolean hasRestrictionsProvider ()
```

Called by an application to check if there is an active Restrictions Provider. If there isn't,[requestPermission(java.lang.String, java.lang.String, android.os.PersistableBundle)](https://developer.android.com/reference/android/content/RestrictionsManager#requestPermission(java.lang.String,%20java.lang.String,%20android.os.PersistableBundle))is not available.

<br />

|                               Returns                               ||
|-----------|----------------------------------------------------------|
| `boolean` | whether there is an active Restrictions Provider. <br /> |

### notifyPermissionResponse

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

```
public void notifyPermissionResponse (String packageName, 
                PersistableBundle response)
```

Called by the Restrictions Provider to deliver a response to an application.

<br />

|                                                               Parameters                                                                ||
|---------------|--------------------------------------------------------------------------------------------------------------------------|
| `packageName` | `String`: the application to deliver the response to. Cannot be null. <br />                                             |
| `response`    | `PersistableBundle`: the bundle containing the response status, request ID and other information. Cannot be null. <br /> |

|                                                                         Throws                                                                         ||
|--------------------------------------------------------------------------------------------------------|------------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if any of the required parameters are missing. |

### requestPermission

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

```
public void requestPermission (String requestType, 
                String requestId, 
                PersistableBundle request)
```

Called by an application to request permission for an operation. The contents of the request are passed in a Bundle that contains several pieces of data depending on the chosen request type.

<br />

|                                                                                                                                                                    Parameters                                                                                                                                                                    ||
|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `requestType` | `String`: The type of request. The type could be one of the predefined types specified here or a custom type that the specific Restrictions Provider might understand. For custom types, the type name should be namespaced to avoid collisions with predefined types and types specified by other Restrictions Providers. <br /> |
| `requestId`   | `String`: A unique id generated by the app that contains sufficient information to identify the parameters of the request when it receives the id in the response. <br />                                                                                                                                                         |
| `request`     | `PersistableBundle`: A PersistableBundle containing the data corresponding to the specified request type. The keys for the data in the bundle depend on the request type. <br />                                                                                                                                                  |

|                                                                         Throws                                                                         ||
|--------------------------------------------------------------------------------------------------------|------------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if any of the required parameters are missing. |