to top
Android APIs
Added in API level 11
package

android.drm

Provides classes for managing DRM content and determining the capabilities of DRM plugins (agents). Common uses of the DRM API include:

  • Determining which DRM plug-ins (agents) are installed on a device.
  • Retrieving information about specific plug-ins, such as the MIME types and file suffixes they support.
  • Registering a user or a device with an online DRM service.
  • Retrieving license constraints for rights-protected content.
  • Checking whether a user has the proper rights to play or use rights-protected content.
  • Associating rights-protected content with its license so you can use the MediaPlayer API to play the content.

DRM Overview

The Android platform provides an extensible DRM framework that lets applications manage rights-protected content according to the license constraints that are associated with the content. The DRM framework supports many DRM schemes; which DRM schemes a device supports is up to the device manufacturer.

The Android DRM framework is implemented in two architectural layers (see figure below):

  • A DRM framework API, which is exposed to applications through the Android application framework and runs through the Dalvik VM for standard applications.
  • A native code DRM manager, which implements the DRM framework and exposes an interface for DRM plug-ins (agents) to handle rights management and decryption for various DRM schemes.
DRM architecture diagram

For application developers, the DRM framework offers an abstract, unified API that simplifies the management of rights-protected content. The API hides the complexity of DRM operations and allows a consistent operation mode for both rights-protected and unprotected content across a variety of DRM schemes. For device manufacturers, content owners, and Internet digital media providers the DRM framework’s plugin architecture provides a means of adding support for a specific DRM scheme to the Android system.

Using the DRM API

In a typical DRM session, an Android application uses the DRM framework API to instantiate a DrmManagerClient. The application calls various methods on the DRM client to query rights and perform other DRM-related tasks. Each DrmManagerClient instance has its own unique ID, so the DRM manager is able to differentiate callers.

Although each DRM plug-in may require a different sequence of API calls, the general call sequence for an application is as follows:

  • Register the device with an online DRM service.

    You can do this by first using the acquireDrmInfo() method to acquire the registration information, and then using the processDrmInfo() method to process the registration information.

  • Acquire the license that's associated with the rights-protected content.

    You can do this by first using the acquireDrmInfo() method to acquire the license information, and then using the processDrmInfo() method to process the license information. You can also use the acquireRights() method.

  • Extract constraint information from the license.

    You can use the getConstraints() method to do this.

  • Associate the rights-protected content with its license.

    You can use the saveRights() method to do this.

After you make an association between the rights-protected content and its license, the DRM manager automatically handles rights management for that content. Specifically, the DRM manager will handle all further licensing checks when you attempt to play the content using the MediaPlayer API.

To learn how to use the DRM API with a specific DRM plug-in, see the documentation provided by the plug-in developer.

Interfaces

DrmManagerClient.OnErrorListener Interface definition for a callback that receives information about DRM framework errors. 
DrmManagerClient.OnEventListener Interface definition for a callback that receives information about DRM processing events. 
DrmManagerClient.OnInfoListener Interface definition for a callback that receives status messages and warnings during registration and rights acquisition. 
DrmStore.ConstraintsColumns Interface definition for the columns that represent DRM constraints. 

Classes

DrmConvertedStatus An entity class that wraps converted data, conversion status, and the offset for appending the header and body signature to the converted data. 
DrmErrorEvent An entity class that is passed to the onError() callback. 
DrmEvent A base class that is used to send asynchronous event information from the DRM framework. 
DrmInfo An entity class that describes the information required to send transactions between a device and an online DRM server. 
DrmInfoEvent An entity class that is passed to the onInfo() callback. 
DrmInfoRequest An entity class that is used to pass information to an online DRM server. 
DrmInfoStatus An entity class that wraps the result of communication between a device and an online DRM server. 
DrmManagerClient The main programming interface for the DRM framework. 
DrmRights An entity class that wraps the license information retrieved from the online DRM server. 
DrmStore Defines constants that are used by the DRM framework. 
DrmStore.Action Defines actions that can be performed on rights-protected content. 
DrmStore.DrmObjectType Defines DRM object types. 
DrmStore.Playback Defines playback states for content. 
DrmStore.RightsStatus Defines status notifications for digital rights. 
DrmSupportInfo An entity class that wraps the capability of each DRM plug-in (agent), such as the MIME type and file suffix the DRM plug-in can handle. 
DrmUtils A utility class that provides operations for parsing extended metadata embedded in DRM constraint information. 
DrmUtils.ExtendedMetadataParser Utility that parses extended metadata embedded in DRM constraint information. 
ProcessedData An entity class that wraps the result of a processDrmInfo() transaction between a device and a DRM server.