Added in API level 11
Deprecated in API level 30

DrmManagerClient

open class DrmManagerClient : AutoCloseable
kotlin.Any
   ↳ android.drm.DrmManagerClient

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
abstract

Interface definition for a callback that receives information about DRM framework errors.

abstract

Interface definition for a callback that receives information about DRM processing events.

abstract

Interface definition for a callback that receives status messages and warnings during registration and rights acquisition.

Constants
static Int

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

static Int

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

Public constructors

Creates a DrmManagerClient.

Public methods
open DrmInfo!
acquireDrmInfo(drmInfoRequest: DrmInfoRequest!)

Retrieves information for registering, unregistering, or acquiring rights.

open Int
acquireRights(drmInfoRequest: DrmInfoRequest!)

Processes a given DrmInfoRequest and returns the rights information asynchronously.

open Boolean
canHandle(path: String!, mimeType: String!)

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

open Boolean
canHandle(uri: Uri!, mimeType: String!)

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

open Int

Checks whether the given content has valid rights.

open Int

Check whether the given content has valid rights.

open Int
checkRightsStatus(path: String!, action: Int)

Checks whether the given rights-protected content has valid rights for the specified DrmStore.Action.

open Int
checkRightsStatus(uri: Uri!, action: Int)

Checks whether the given rights-protected content has valid rights for the specified DrmStore.Action.

open Unit

Releases resources associated with the current session of DrmManagerClient.

open DrmConvertedStatus!

Informs the DRM plug-in (agent) that there is no more data to convert or that an error has occurred.

open DrmConvertedStatus!
convertData(convertId: Int, inputData: ByteArray!)

Converts the input data (content) that is part of a rights-protected file.

open Array<String!>!

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

open MutableCollection<DrmSupportInfo!>

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

open ContentValues!
getConstraints(path: String!, action: Int)

Retrieves constraint information for rights-protected content.

open ContentValues!
getConstraints(uri: Uri!, action: Int)

Retrieves constraint information for rights-protected content.

open Int
getDrmObjectType(path: String!, mimeType: String!)

Retrieves the type of rights-protected object (for example, content object, rights object, and so on) using the specified path or MIME type.

open Int
getDrmObjectType(uri: Uri!, mimeType: String!)

Retrieves the type of rights-protected object (for example, content object, rights object, and so on) using the specified URI or MIME type.

open ContentValues!

Retrieves metadata information for rights-protected content.

open ContentValues!

Retrieves metadata information for rights-protected content.

open String!

Retrieves the MIME type embedded in the original content.

open String!

Retrieves the MIME type embedded in the original content.

open Int

Initiates a new conversion session.

open Int

Processes the given DRM information based on the information type.

open Unit

open Int

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

open Int

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

open Int

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

open Int
saveRights(drmRights: DrmRights!, rightsPath: String!, contentPath: String!)

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

open Unit

Registers an DrmManagerClient.OnErrorListener callback, which is invoked when the DRM framework sends error information.

open Unit

Registers an DrmManagerClient.OnEventListener callback, which is invoked when the DRM framework sends information about DRM processing.

open Unit

Registers an DrmManagerClient.OnInfoListener callback, which is invoked when the DRM framework sends status or warning information during registration or rights acquisition.

Protected methods
open Unit

Constants

ERROR_NONE

Added in API level 11
static val ERROR_NONE: Int

Deprecated: Deprecated in Java.

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

Value: 0

ERROR_UNKNOWN

Added in API level 11
static val ERROR_UNKNOWN: Int

Deprecated: Deprecated in Java.

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

Value: -2000

Public constructors

DrmManagerClient

Added in API level 11
DrmManagerClient(context: Context!)

Creates a DrmManagerClient.

Parameters
context Context!: Context of the caller.

Public methods

acquireDrmInfo

Added in API level 11
open fun acquireDrmInfo(drmInfoRequest: DrmInfoRequest!): DrmInfo!

Deprecated: Deprecated in Java.

Retrieves information for registering, unregistering, or acquiring rights.

Parameters
drmInfoRequest DrmInfoRequest!: The DrmInfoRequest that specifies the type of DRM information being retrieved.
Return
DrmInfo! A DrmInfo instance.

acquireRights

Added in API level 11
open fun acquireRights(drmInfoRequest: DrmInfoRequest!): Int

Deprecated: Deprecated in Java.

Processes a given DrmInfoRequest and returns the rights information asynchronously.

This is a utility method that consists of an acquireDrmInfo() and a processDrmInfo() 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 acquireDrmInfo() and processDrmInfo() separately.

Parameters
drmInfoRequest DrmInfoRequest!: The DrmInfoRequest used to acquire the rights.
Return
Int ERROR_NONE for success; ERROR_UNKNOWN for failure.

canHandle

Added in API level 11
open fun canHandle(
    path: String!,
    mimeType: String!
): Boolean

Deprecated: Deprecated in Java.

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

Parameters
path String!: Path of the content to be handled.
mimeType String!: MIME type of the object to be handled.
Return
Boolean True if the given MIME type or path can be handled; false if they cannot be handled.

canHandle

Added in API level 11
open fun canHandle(
    uri: Uri!,
    mimeType: String!
): Boolean

Deprecated: Deprecated in Java.

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

Parameters
uri Uri!: URI for the content to be handled.
mimeType String!: MIME type of the object to be handled
Return
Boolean True if the given MIME type or URI can be handled; false if they cannot be handled.

checkRightsStatus

Added in API level 11
open fun checkRightsStatus(path: String!): Int

Deprecated: Deprecated in Java.

Checks whether the given content has valid rights.

Parameters
path String!: Path to the rights-protected content.
Return
Int An int representing the DrmStore.RightsStatus of the content.

checkRightsStatus

Added in API level 11
open fun checkRightsStatus(uri: Uri!): Int

Deprecated: Deprecated in Java.

Check whether the given content has valid rights.

Parameters
uri Uri!: URI of the rights-protected content.
Return
Int An int representing the DrmStore.RightsStatus of the content.

checkRightsStatus

Added in API level 11
open fun checkRightsStatus(
    path: String!,
    action: Int
): Int

Deprecated: Deprecated in Java.

Checks whether the given rights-protected content has valid rights for the specified DrmStore.Action.

Parameters
path String!: Path to the rights-protected content.
action Int: The DrmStore.Action to perform.
Return
Int An int representing the DrmStore.RightsStatus of the content.

checkRightsStatus

Added in API level 11
open fun checkRightsStatus(
    uri: Uri!,
    action: Int
): Int

Deprecated: Deprecated in Java.

Checks whether the given rights-protected content has valid rights for the specified DrmStore.Action.

Parameters
uri Uri!: URI for the rights-protected content.
action Int: The DrmStore.Action to perform.
Return
Int An int representing the DrmStore.RightsStatus of the content.

close

Added in API level 24
Deprecated in API level 30
open fun close(): Unit

Deprecated: Deprecated in Java.

Releases resources associated with the current session of DrmManagerClient. It is considered good practice to call this method when the DrmManagerClient object is no longer needed in your application. After this method is called, 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.

Exceptions
java.lang.Exception if this resource cannot be closed

closeConvertSession

Added in API level 11
open fun closeConvertSession(convertId: Int): DrmConvertedStatus!

Deprecated: Deprecated in Java.

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.

Parameters
convertId Int: Handle for the conversion session.
Return
DrmConvertedStatus! A DrmConvertedStatus object that contains the status of the data conversion, the converted data, and the offset for the header and body signature.

convertData

Added in API level 11
open fun convertData(
    convertId: Int,
    inputData: ByteArray!
): DrmConvertedStatus!

Deprecated: Deprecated in Java.

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

Parameters
convertId Int: Handle for the conversion session.
inputData ByteArray!: Input data that needs to be converted.
Return
DrmConvertedStatus! A 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 closeConvertSession() method.

getAvailableDrmEngines

Added in API level 11
open fun getAvailableDrmEngines(): Array<String!>!

Deprecated: Deprecated in Java.

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

Return
Array<String!>! A String array of DRM plug-in descriptions.

getAvailableDrmSupportInfo

Added in API level 30
Deprecated in API level 30
open fun getAvailableDrmSupportInfo(): MutableCollection<DrmSupportInfo!>

Deprecated: Deprecated in Java.

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

Return
MutableCollection<DrmSupportInfo!> List of all the DRM plug-ins (agents) that are registered with the DRM framework. This value cannot be null.

getConstraints

Added in API level 11
open fun getConstraints(
    path: String!,
    action: Int
): ContentValues!

Deprecated: Deprecated in Java.

Retrieves constraint information for rights-protected content.

Parameters
path String!: Path to the content from which you are retrieving DRM constraints.
action Int: Action defined in DrmStore.Action.
Return
ContentValues! A android.content.ContentValues instance that contains key-value pairs representing the constraints. Null in case of failure. The keys are defined in DrmStore.ConstraintsColumns.

getConstraints

Added in API level 11
open fun getConstraints(
    uri: Uri!,
    action: Int
): ContentValues!

Deprecated: Deprecated in Java.

Retrieves constraint information for rights-protected content.

Parameters
uri Uri!: URI for the content from which you are retrieving DRM constraints.
action Int: Action defined in DrmStore.Action.
Return
ContentValues! A android.content.ContentValues instance that contains key-value pairs representing the constraints. Null in case of failure.

getDrmObjectType

Added in API level 11
open fun getDrmObjectType(
    path: String!,
    mimeType: String!
): Int

Deprecated: Deprecated in Java.

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.

Parameters
path String!: Path to the content or null.
mimeType String!: MIME type of the content or null.
Return
Int An int that corresponds to a DrmStore.DrmObjectType.

getDrmObjectType

Added in API level 11
open fun getDrmObjectType(
    uri: Uri!,
    mimeType: String!
): Int

Deprecated: Deprecated in Java.

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.

Parameters
uri Uri!: URI for the content or null.
mimeType String!: MIME type of the content or null.
Return
Int An int that corresponds to a DrmStore.DrmObjectType.

getMetadata

Added in API level 11
open fun getMetadata(path: String!): ContentValues!

Deprecated: Deprecated in Java.

Retrieves metadata information for rights-protected content.

Parameters
path String!: Path to the content from which you are retrieving metadata information.
Return
ContentValues! A android.content.ContentValues instance that contains key-value pairs representing the metadata. Null in case of failure.

getMetadata

Added in API level 11
open fun getMetadata(uri: Uri!): ContentValues!

Deprecated: Deprecated in Java.

Retrieves metadata information for rights-protected content.

Parameters
uri Uri!: URI for the content from which you are retrieving metadata information.
Return
ContentValues! A android.content.ContentValues instance that contains key-value pairs representing the constraints. Null in case of failure.

getOriginalMimeType

Added in API level 11
open fun getOriginalMimeType(path: String!): String!

Deprecated: Deprecated in Java.

Retrieves the MIME type embedded in the original content.

Parameters
path String!: Path to the rights-protected content.
Return
String! The MIME type of the original content, such as video/mpeg.

getOriginalMimeType

Added in API level 11
open fun getOriginalMimeType(uri: Uri!): String!

Deprecated: Deprecated in Java.

Retrieves the MIME type embedded in the original content.

Parameters
uri Uri!: URI of the rights-protected content.
Return
String! MIME type of the original content, such as video/mpeg.

openConvertSession

Added in API level 11
open fun openConvertSession(mimeType: String!): Int

Deprecated: Deprecated in Java.

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.

Parameters
mimeType String!: MIME type of the input data packet.
Return
Int A convert ID that is used used to maintain the conversion session.

processDrmInfo

Added in API level 11
open fun processDrmInfo(drmInfo: DrmInfo!): Int

Deprecated: Deprecated in Java.

Processes the given DRM information based on the information type.

Parameters
drmInfo DrmInfo!: The DrmInfo to be processed.
Return
Int ERROR_NONE for success; ERROR_UNKNOWN for failure.

release

Added in API level 16
Deprecated in API level 24
open fun release(): Unit

Deprecated: replaced by close().

removeAllRights

Added in API level 11
open fun removeAllRights(): Int

Deprecated: Deprecated in Java.

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

Return
Int ERROR_NONE for success; ERROR_UNKNOWN for failure.

removeRights

Added in API level 11
open fun removeRights(path: String!): Int

Deprecated: Deprecated in Java.

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

Parameters
path String!: Path to the rights-protected content.
Return
Int ERROR_NONE for success; ERROR_UNKNOWN for failure.

removeRights

Added in API level 11
open fun removeRights(uri: Uri!): Int

Deprecated: Deprecated in Java.

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

Parameters
uri Uri!: URI for the rights-protected content.
Return
Int ERROR_NONE for success; ERROR_UNKNOWN for failure.

saveRights

Added in API level 11
open fun saveRights(
    drmRights: DrmRights!,
    rightsPath: String!,
    contentPath: String!
): Int

Deprecated: Deprecated in Java.

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.

Parameters
drmRights DrmRights!: The DrmRights to be saved.
rightsPath String!: File path where rights will be saved.
contentPath String!: File path where content is saved.
Return
Int ERROR_NONE for success; ERROR_UNKNOWN for failure.
Exceptions
java.io.IOException If the call failed to save rights information at the given rightsPath.

setOnErrorListener

Added in API level 11
open fun setOnErrorListener(errorListener: DrmManagerClient.OnErrorListener!): Unit

Deprecated: Deprecated in Java.

Registers an DrmManagerClient.OnErrorListener callback, which is invoked when the DRM framework sends error information.

Parameters
errorListener DrmManagerClient.OnErrorListener!: Interface definition for the callback.

setOnEventListener

Added in API level 11
open fun setOnEventListener(eventListener: DrmManagerClient.OnEventListener!): Unit

Deprecated: Deprecated in Java.

Registers an DrmManagerClient.OnEventListener callback, which is invoked when the DRM framework sends information about DRM processing.

Parameters
eventListener DrmManagerClient.OnEventListener!: Interface definition for the callback.

setOnInfoListener

Added in API level 11
open fun setOnInfoListener(infoListener: DrmManagerClient.OnInfoListener!): Unit

Deprecated: Deprecated in Java.

Registers an DrmManagerClient.OnInfoListener callback, which is invoked when the DRM framework sends status or warning information during registration or rights acquisition.

Parameters
infoListener DrmManagerClient.OnInfoListener!: Interface definition for the callback.

Protected methods

finalize

Added in API level 11
protected open fun finalize(): Unit

Deprecated: Deprecated in Java.

Exceptions
java.lang.Throwable the Exception raised by this method