Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/drm/DrmManagerClient#nestedclasses) \| [Constants](https://developer.android.com/reference/android/drm/DrmManagerClient#constants) \| [Ctors](https://developer.android.com/reference/android/drm/DrmManagerClient#pubctors) \| [Methods](https://developer.android.com/reference/android/drm/DrmManagerClient#pubmethods) \| [Protected Methods](https://developer.android.com/reference/android/drm/DrmManagerClient#promethods) \| [Inherited Methods](https://developer.android.com/reference/android/drm/DrmManagerClient#inhmethods)

# DrmManagerClient

*** ** * ** ***

` public class DrmManagerClient `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/java/lang/AutoCloseable `

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

<br />

*** ** * ** ***

<br />

**This class was deprecated in API level 30.**   

Please use `https://developer.android.com/reference/android/media/MediaDrm`

The main programming interface for the DRM framework. An application must instantiate this class to access DRM agents through the DRM framework.

## Summary

| ### Nested classes ||
|---|---|
| ` interface` | `https://developer.android.com/reference/android/drm/DrmManagerClient.OnErrorListener` Interface definition for a callback that receives information about DRM framework errors. |
| ` interface` | `https://developer.android.com/reference/android/drm/DrmManagerClient.OnEventListener` Interface definition for a callback that receives information about DRM processing events. |
| ` interface` | `https://developer.android.com/reference/android/drm/DrmManagerClient.OnInfoListener` Interface definition for a callback that receives status messages and warnings during registration and rights acquisition. |

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/drm/DrmManagerClient#ERROR_NONE` Indicates that a request was successful or that no error occurred. |
| `int` | `https://developer.android.com/reference/android/drm/DrmManagerClient#ERROR_UNKNOWN` Indicates that an error occurred and the reason is not known. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/drm/DrmManagerClient#DrmManagerClient(android.content.Context)(https://developer.android.com/reference/android/content/Context context) ` Creates a `DrmManagerClient`. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/drm/DrmInfo` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#acquireDrmInfo(android.drm.DrmInfoRequest)(https://developer.android.com/reference/android/drm/DrmInfoRequest drmInfoRequest) ` Retrieves information for registering, unregistering, or acquiring rights. |
| ` int` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#acquireRights(android.drm.DrmInfoRequest)(https://developer.android.com/reference/android/drm/DrmInfoRequest drmInfoRequest) ` Processes a given `https://developer.android.com/reference/android/drm/DrmInfoRequest` and returns the rights information asynchronously. |
| ` boolean` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#canHandle(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String path, https://developer.android.com/reference/java/lang/String mimeType) ` Checks whether the given MIME type or path can be handled. |
| ` boolean` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#canHandle(android.net.Uri,%20java.lang.String)(https://developer.android.com/reference/android/net/Uri uri, https://developer.android.com/reference/java/lang/String mimeType) ` Checks whether the given MIME type or URI can be handled. |
| ` int` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#checkRightsStatus(java.lang.String)(https://developer.android.com/reference/java/lang/String path) ` Checks whether the given content has valid rights. |
| ` int` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#checkRightsStatus(android.net.Uri)(https://developer.android.com/reference/android/net/Uri uri) ` Check whether the given content has valid rights. |
| ` int` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#checkRightsStatus(java.lang.String,%20int)(https://developer.android.com/reference/java/lang/String path, int action) ` Checks whether the given rights-protected content has valid rights for the specified `https://developer.android.com/reference/android/drm/DrmStore.Action`. |
| ` int` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#checkRightsStatus(android.net.Uri,%20int)(https://developer.android.com/reference/android/net/Uri uri, int action) ` Checks whether the given rights-protected content has valid rights for the specified `https://developer.android.com/reference/android/drm/DrmStore.Action`. |
| ` void` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#close()() ` Releases resources associated with the current session of DrmManagerClient. |
| ` https://developer.android.com/reference/android/drm/DrmConvertedStatus` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#closeConvertSession(int)(int convertId) ` Informs the DRM plug-in (agent) that there is no more data to convert or that an error has occurred. |
| ` https://developer.android.com/reference/android/drm/DrmConvertedStatus` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#convertData(int,%20byte[])(int convertId, byte[] inputData) ` Converts the input data (content) that is part of a rights-protected file. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#getAvailableDrmEngines()() ` Retrieves information about all the DRM plug-ins (agents) that are registered with the DRM framework. |
| ` https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/android/drm/DrmSupportInfo>` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#getAvailableDrmSupportInfo()() ` Retrieves information about all the DRM plug-ins (agents) that are registered with the DRM framework. |
| ` https://developer.android.com/reference/android/content/ContentValues` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#getConstraints(java.lang.String,%20int)(https://developer.android.com/reference/java/lang/String path, int action) ` Retrieves constraint information for rights-protected content. |
| ` https://developer.android.com/reference/android/content/ContentValues` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#getConstraints(android.net.Uri,%20int)(https://developer.android.com/reference/android/net/Uri uri, int action) ` Retrieves constraint information for rights-protected content. |
| ` int` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#getDrmObjectType(android.net.Uri,%20java.lang.String)(https://developer.android.com/reference/android/net/Uri uri, https://developer.android.com/reference/java/lang/String mimeType) ` Retrieves the type of rights-protected object (for example, content object, rights object, and so on) using the specified URI or MIME type. |
| ` int` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#getDrmObjectType(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String path, https://developer.android.com/reference/java/lang/String mimeType) ` Retrieves the type of rights-protected object (for example, content object, rights object, and so on) using the specified path or MIME type. |
| ` https://developer.android.com/reference/android/content/ContentValues` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#getMetadata(java.lang.String)(https://developer.android.com/reference/java/lang/String path) ` Retrieves metadata information for rights-protected content. |
| ` https://developer.android.com/reference/android/content/ContentValues` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#getMetadata(android.net.Uri)(https://developer.android.com/reference/android/net/Uri uri) ` Retrieves metadata information for rights-protected content. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#getOriginalMimeType(android.net.Uri)(https://developer.android.com/reference/android/net/Uri uri) ` Retrieves the MIME type embedded in the original content. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#getOriginalMimeType(java.lang.String)(https://developer.android.com/reference/java/lang/String path) ` Retrieves the MIME type embedded in the original content. |
| ` int` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#openConvertSession(java.lang.String)(https://developer.android.com/reference/java/lang/String mimeType) ` Initiates a new conversion session. |
| ` int` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#processDrmInfo(android.drm.DrmInfo)(https://developer.android.com/reference/android/drm/DrmInfo drmInfo) ` Processes the given DRM information based on the information type. |
| ` void` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#release()() ` *This method was deprecated in API level 24. replaced by `https://developer.android.com/reference/android/drm/DrmManagerClient#close()`.* |
| ` int` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#removeAllRights()() ` Removes all the rights information of every DRM plug-in (agent) associated with the DRM framework. |
| ` int` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#removeRights(java.lang.String)(https://developer.android.com/reference/java/lang/String path) ` Removes the rights associated with the given rights-protected content. |
| ` int` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#removeRights(android.net.Uri)(https://developer.android.com/reference/android/net/Uri uri) ` Removes the rights associated with the given rights-protected content. |
| ` int` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#saveRights(android.drm.DrmRights,%20java.lang.String,%20java.lang.String)(https://developer.android.com/reference/android/drm/DrmRights drmRights, https://developer.android.com/reference/java/lang/String rightsPath, https://developer.android.com/reference/java/lang/String contentPath) ` Saves rights to a specified path and associates that path with the content path. |
| ` void` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#setOnErrorListener(android.drm.DrmManagerClient.OnErrorListener)(https://developer.android.com/reference/android/drm/DrmManagerClient.OnErrorListener errorListener) ` Registers an `https://developer.android.com/reference/android/drm/DrmManagerClient.OnErrorListener` callback, which is invoked when the DRM framework sends error information. |
| ` void` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#setOnEventListener(android.drm.DrmManagerClient.OnEventListener)(https://developer.android.com/reference/android/drm/DrmManagerClient.OnEventListener eventListener) ` Registers an `https://developer.android.com/reference/android/drm/DrmManagerClient.OnEventListener` callback, which is invoked when the DRM framework sends information about DRM processing. |
| ` void` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#setOnInfoListener(android.drm.DrmManagerClient.OnInfoListener)(https://developer.android.com/reference/android/drm/DrmManagerClient.OnInfoListener infoListener) ` Registers an `https://developer.android.com/reference/android/drm/DrmManagerClient.OnInfoListener` callback, which is invoked when the DRM framework sends status or warning information during registration or rights acquisition. |

| ### Protected methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/drm/DrmManagerClient#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` 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 https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` 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` ` 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` ` 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*.
From interface ` https://developer.android.com/reference/java/lang/AutoCloseable ` ` abstract void` ` https://developer.android.com/reference/java/lang/AutoCloseable#close()() `

Closes this resource, relinquishing any underlying resources.

## Constants

### ERROR_NONE

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

```
public static final int ERROR_NONE
```

Indicates that a request was successful or that no error occurred.

<br />

Constant Value: 0 (0x00000000)

### ERROR_UNKNOWN

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

```
public static final int ERROR_UNKNOWN
```

Indicates that an error occurred and the reason is not known.

<br />

Constant Value: -2000 (0xfffff830)

## Public constructors

### DrmManagerClient

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

```
public DrmManagerClient (Context context)
```

Creates a `DrmManagerClient`.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: Context of the caller. <br /> |

## Public methods

### acquireDrmInfo

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

```
public DrmInfo acquireDrmInfo (DrmInfoRequest drmInfoRequest)
```

Retrieves information for registering, unregistering, or acquiring rights.

<br />

| Parameters ||
|---|---|
| `drmInfoRequest` | `DrmInfoRequest`: The `https://developer.android.com/reference/android/drm/DrmInfoRequest` that specifies the type of DRM information being retrieved. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/drm/DrmInfo` | A `https://developer.android.com/reference/android/drm/DrmInfo` instance. <br /> |

### acquireRights

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

```
public int acquireRights (DrmInfoRequest drmInfoRequest)
```

Processes a given `https://developer.android.com/reference/android/drm/DrmInfoRequest` and returns the rights information asynchronously.

This is a utility method that consists of an `https://developer.android.com/reference/android/drm/DrmManagerClient#acquireDrmInfo(android.drm.DrmInfoRequest)` and a `https://developer.android.com/reference/android/drm/DrmManagerClient#processDrmInfo(android.drm.DrmInfo)` method call. This utility method can be used only if the selected DRM plug-in (agent) supports this sequence of calls. Some DRM agents, such as OMA, do not support this utility method, in which case an application must invoke `https://developer.android.com/reference/android/drm/DrmManagerClient#acquireDrmInfo(android.drm.DrmInfoRequest)` and `https://developer.android.com/reference/android/drm/DrmManagerClient#processDrmInfo(android.drm.DrmInfo)` separately.

<br />

| Parameters ||
|---|---|
| `drmInfoRequest` | `DrmInfoRequest`: The `https://developer.android.com/reference/android/drm/DrmInfoRequest` used to acquire the rights. <br /> |

| Returns ||
|---|---|
| `int` | ERROR_NONE for success; ERROR_UNKNOWN for failure. <br /> |

### canHandle

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

```
public boolean canHandle (String path, 
                String mimeType)
```

Checks whether the given MIME type or path can be handled.

<br />

| Parameters ||
|---|---|
| `path` | `String`: Path of the content to be handled. <br /> |
| `mimeType` | `String`: MIME type of the object to be handled. <br /> |

| Returns ||
|---|---|
| `boolean` | True if the given MIME type or path can be handled; false if they cannot be handled. <br /> |

### canHandle

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

```
public boolean canHandle (Uri uri, 
                String mimeType)
```

Checks whether the given MIME type or URI can be handled.

<br />

| Parameters ||
|---|---|
| `uri` | `Uri`: URI for the content to be handled. <br /> |
| `mimeType` | `String`: MIME type of the object to be handled <br /> |

| Returns ||
|---|---|
| `boolean` | True if the given MIME type or URI can be handled; false if they cannot be handled. <br /> |

### checkRightsStatus

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

```
public int checkRightsStatus (String path)
```

Checks whether the given content has valid rights.

<br />

| Parameters ||
|---|---|
| `path` | `String`: Path to the rights-protected content. <br /> |

| Returns ||
|---|---|
| `int` | An `int` representing the `https://developer.android.com/reference/android/drm/DrmStore.RightsStatus` of the content. <br /> |

### checkRightsStatus

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

```
public int checkRightsStatus (Uri uri)
```

Check whether the given content has valid rights.

<br />

| Parameters ||
|---|---|
| `uri` | `Uri`: URI of the rights-protected content. <br /> |

| Returns ||
|---|---|
| `int` | An `int` representing the `https://developer.android.com/reference/android/drm/DrmStore.RightsStatus` of the content. <br /> |

### checkRightsStatus

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

```
public int checkRightsStatus (String path, 
                int action)
```

Checks whether the given rights-protected content has valid rights for the specified `https://developer.android.com/reference/android/drm/DrmStore.Action`.

<br />

| Parameters ||
|---|---|
| `path` | `String`: Path to the rights-protected content. <br /> |
| `action` | `int`: The `https://developer.android.com/reference/android/drm/DrmStore.Action` to perform. <br /> |

| Returns ||
|---|---|
| `int` | An `int` representing the `https://developer.android.com/reference/android/drm/DrmStore.RightsStatus` of the content. <br /> |

### checkRightsStatus

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

```
public int checkRightsStatus (Uri uri, 
                int action)
```

Checks whether the given rights-protected content has valid rights for the specified `https://developer.android.com/reference/android/drm/DrmStore.Action`.

<br />

| Parameters ||
|---|---|
| `uri` | `Uri`: URI for the rights-protected content. <br /> |
| `action` | `int`: The `https://developer.android.com/reference/android/drm/DrmStore.Action` to perform. <br /> |

| Returns ||
|---|---|
| `int` | An `int` representing the `https://developer.android.com/reference/android/drm/DrmStore.RightsStatus` of the content. <br /> |

### close

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

```
public void close ()
```

Releases resources associated with the current session of DrmManagerClient. It is considered good practice to call this method when the `https://developer.android.com/reference/android/drm/DrmManagerClient` object is no longer needed in your application. After this method is called, `https://developer.android.com/reference/android/drm/DrmManagerClient` is no longer usable since it has lost all of its required resource. This method was added in API 24. In API versions 16 through 23, release() should be called instead. There is no need to do anything for API versions prior to 16.

<br />

### closeConvertSession

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

```
public DrmConvertedStatus closeConvertSession (int convertId)
```

Informs the DRM plug-in (agent) that there is no more data to convert or that an error has occurred. Upon successful conversion of the data, the DRM agent will provide an offset value indicating where the header and body signature should be added. Appending the signature is necessary to protect the integrity of the converted file.

<br />

| Parameters ||
|---|---|
| `convertId` | `int`: Handle for the conversion session. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/drm/DrmConvertedStatus` | A `https://developer.android.com/reference/android/drm/DrmConvertedStatus` object that contains the status of the data conversion, the converted data, and the offset for the header and body signature. <br /> |

### convertData

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

```
public DrmConvertedStatus convertData (int convertId, 
                byte[] inputData)
```

Converts the input data (content) that is part of a rights-protected file. The converted data and status is returned in a `https://developer.android.com/reference/android/drm/DrmConvertedStatus` object. This method should be called each time there is a new block of data received by the application.

<br />

| Parameters ||
|---|---|
| `convertId` | `int`: Handle for the conversion session. <br /> |
| `inputData` | `byte`: Input data that needs to be converted. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/drm/DrmConvertedStatus` | A `https://developer.android.com/reference/android/drm/DrmConvertedStatus` object that contains the status of the data conversion, the converted data, and offset for the header and body signature. An application can ignore the offset because it is only relevant to the `https://developer.android.com/reference/android/drm/DrmManagerClient#closeConvertSession(int)` method. <br /> |

### getAvailableDrmEngines

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

```
public String[] getAvailableDrmEngines ()
```

Retrieves information about all the DRM plug-ins (agents) that are registered with the DRM framework.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | A `String` array of DRM plug-in descriptions. <br /> |

### getAvailableDrmSupportInfo

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

```
public Collection<DrmSupportInfo> getAvailableDrmSupportInfo ()
```

Retrieves information about all the DRM plug-ins (agents) that are registered with the DRM framework.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/android/drm/DrmSupportInfo>` | List of all the DRM plug-ins (agents) that are registered with the DRM framework. This value cannot be `null`. <br /> |

### getConstraints

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

```
public ContentValues getConstraints (String path, 
                int action)
```

Retrieves constraint information for rights-protected content.

<br />

| Parameters ||
|---|---|
| `path` | `String`: Path to the content from which you are retrieving DRM constraints. <br /> |
| `action` | `int`: Action defined in `https://developer.android.com/reference/android/drm/DrmStore.Action`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/ContentValues` | A `https://developer.android.com/reference/android/content/ContentValues` instance that contains key-value pairs representing the constraints. Null in case of failure. The keys are defined in `https://developer.android.com/reference/android/drm/DrmStore.ConstraintsColumns`. <br /> |

### getConstraints

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

```
public ContentValues getConstraints (Uri uri, 
                int action)
```

Retrieves constraint information for rights-protected content.

<br />

| Parameters ||
|---|---|
| `uri` | `Uri`: URI for the content from which you are retrieving DRM constraints. <br /> |
| `action` | `int`: Action defined in `https://developer.android.com/reference/android/drm/DrmStore.Action`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/ContentValues` | A `https://developer.android.com/reference/android/content/ContentValues` instance that contains key-value pairs representing the constraints. Null in case of failure. <br /> |

### getDrmObjectType

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

```
public int getDrmObjectType (Uri uri, 
                String mimeType)
```

Retrieves the type of rights-protected object (for example, content object, rights object, and so on) using the specified URI or MIME type. At least one parameter must be specified to retrieve the DRM object type.

<br />

| Parameters ||
|---|---|
| `uri` | `Uri`: URI for the content or null. <br /> |
| `mimeType` | `String`: MIME type of the content or null. <br /> |

| Returns ||
|---|---|
| `int` | An `int` that corresponds to a `https://developer.android.com/reference/android/drm/DrmStore.DrmObjectType`. <br /> |

### getDrmObjectType

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

```
public int getDrmObjectType (String path, 
                String mimeType)
```

Retrieves the type of rights-protected object (for example, content object, rights object, and so on) using the specified path or MIME type. At least one parameter must be specified to retrieve the DRM object type.

<br />

| Parameters ||
|---|---|
| `path` | `String`: Path to the content or null. <br /> |
| `mimeType` | `String`: MIME type of the content or null. <br /> |

| Returns ||
|---|---|
| `int` | An `int` that corresponds to a `https://developer.android.com/reference/android/drm/DrmStore.DrmObjectType`. <br /> |

### getMetadata

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

```
public ContentValues getMetadata (String path)
```

Retrieves metadata information for rights-protected content.

<br />

| Parameters ||
|---|---|
| `path` | `String`: Path to the content from which you are retrieving metadata information. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/ContentValues` | A `https://developer.android.com/reference/android/content/ContentValues` instance that contains key-value pairs representing the metadata. Null in case of failure. <br /> |

### getMetadata

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

```
public ContentValues getMetadata (Uri uri)
```

Retrieves metadata information for rights-protected content.

<br />

| Parameters ||
|---|---|
| `uri` | `Uri`: URI for the content from which you are retrieving metadata information. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/ContentValues` | A `https://developer.android.com/reference/android/content/ContentValues` instance that contains key-value pairs representing the constraints. Null in case of failure. <br /> |

### getOriginalMimeType

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

```
public String getOriginalMimeType (Uri uri)
```

Retrieves the MIME type embedded in the original content.

<br />

| Parameters ||
|---|---|
| `uri` | `Uri`: URI of the rights-protected content. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | MIME type of the original content, such as `video/mpeg`. <br /> |

### getOriginalMimeType

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

```
public String getOriginalMimeType (String path)
```

Retrieves the MIME type embedded in the original content.

<br />

| Parameters ||
|---|---|
| `path` | `String`: Path to the rights-protected content. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The MIME type of the original content, such as `video/mpeg`. <br /> |

### openConvertSession

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

```
public int openConvertSession (String mimeType)
```

Initiates a new conversion session. An application must initiate a conversion session with this method each time it downloads a rights-protected file that needs to be converted.

This method applies only to forward-locking (copy protection) DRM schemes.

<br />

| Parameters ||
|---|---|
| `mimeType` | `String`: MIME type of the input data packet. <br /> |

| Returns ||
|---|---|
| `int` | A convert ID that is used used to maintain the conversion session. <br /> |

### processDrmInfo

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

```
public int processDrmInfo (DrmInfo drmInfo)
```

Processes the given DRM information based on the information type.

<br />

| Parameters ||
|---|---|
| `drmInfo` | `DrmInfo`: The `https://developer.android.com/reference/android/drm/DrmInfo` to be processed. <br /> |

| Returns ||
|---|---|
| `int` | ERROR_NONE for success; ERROR_UNKNOWN for failure. <br /> |

### release

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

```
public void release ()
```

<br />

**This method was deprecated in API level 24.**   

replaced by `https://developer.android.com/reference/android/drm/DrmManagerClient#close()`.

<br />

<br />

### removeAllRights

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

```
public int removeAllRights ()
```

Removes all the rights information of every DRM plug-in (agent) associated with the DRM framework.

<br />

| Returns ||
|---|---|
| `int` | ERROR_NONE for success; ERROR_UNKNOWN for failure. <br /> |

### removeRights

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

```
public int removeRights (String path)
```

Removes the rights associated with the given rights-protected content.

<br />

| Parameters ||
|---|---|
| `path` | `String`: Path to the rights-protected content. <br /> |

| Returns ||
|---|---|
| `int` | ERROR_NONE for success; ERROR_UNKNOWN for failure. <br /> |

### removeRights

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

```
public int removeRights (Uri uri)
```

Removes the rights associated with the given rights-protected content.

<br />

| Parameters ||
|---|---|
| `uri` | `Uri`: URI for the rights-protected content. <br /> |

| Returns ||
|---|---|
| `int` | ERROR_NONE for success; ERROR_UNKNOWN for failure. <br /> |

### saveRights

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

```
public int saveRights (DrmRights drmRights, 
                String rightsPath, 
                String contentPath)
```

Saves rights to a specified path and associates that path with the content path.

**Note:** For OMA or WM-DRM, `rightsPath` and `contentPath` can be null.

<br />

<br />

| Parameters ||
|---|---|
| `drmRights` | `DrmRights`: The `https://developer.android.com/reference/android/drm/DrmRights` to be saved. <br /> |
| `rightsPath` | `String`: File path where rights will be saved. <br /> |
| `contentPath` | `String`: File path where content is saved. <br /> |

| Returns ||
|---|---|
| `int` | ERROR_NONE for success; ERROR_UNKNOWN for failure. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | If the call failed to save rights information at the given `rightsPath`. |

### setOnErrorListener

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

```
public void setOnErrorListener (DrmManagerClient.OnErrorListener errorListener)
```

Registers an `https://developer.android.com/reference/android/drm/DrmManagerClient.OnErrorListener` callback, which is invoked when the DRM framework sends error information.

<br />

| Parameters ||
|---|---|
| `errorListener` | `DrmManagerClient.OnErrorListener`: Interface definition for the callback. <br /> |

### setOnEventListener

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

```
public void setOnEventListener (DrmManagerClient.OnEventListener eventListener)
```

Registers an `https://developer.android.com/reference/android/drm/DrmManagerClient.OnEventListener` callback, which is invoked when the DRM framework sends information about DRM processing.

<br />

| Parameters ||
|---|---|
| `eventListener` | `DrmManagerClient.OnEventListener`: Interface definition for the callback. <br /> |

### setOnInfoListener

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

```
public void setOnInfoListener (DrmManagerClient.OnInfoListener infoListener)
```

Registers an `https://developer.android.com/reference/android/drm/DrmManagerClient.OnInfoListener` callback, which is invoked when the DRM framework sends status or warning information during registration or rights acquisition.

<br />

| Parameters ||
|---|---|
| `infoListener` | `DrmManagerClient.OnInfoListener`: Interface definition for the callback. <br /> |

## Protected methods

### finalize

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

```
protected void finalize ()
```

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the `finalize` method to dispose of system resources or to perform other cleanup.

The general contract of `finalize` is that it is invoked if and when the Java virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The `finalize` method may take any action, including making this object available again to other threads; the usual purpose of `finalize`, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The `finalize` method of class `Object` performs no special action; it simply returns normally. Subclasses of `Object` may override this definition.

The Java programming language does not guarantee which thread will invoke the `finalize` method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the `finalize` method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The `finalize` method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the `finalize` method causes the finalization of this object to be halted, but is otherwise ignored.

<br />

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/Throwable` |   |