Added in API level 31

ErrorCodes


class ErrorCodes
kotlin.Any
   ↳ android.media.MediaDrm.ErrorCodes

Error codes that may be returned from android.media.MediaDrm.MediaDrmStateException#getErrorCode() and android.media.MediaCodec.CryptoException#getErrorCode()

The description of each error code includes steps that may be taken to resolve the error condition. For some errors however, a recovery action cannot be predetermined. The description of those codes refers to a general strategy for handling the error condition programmatically, which is to try the following in listed order until successful:

  1. retry the operation
  2. if the operation is related to a session, close the session, open a new session, and retry the operation
  3. close the MediaDrm instance and any other related components such as the codec and retry playback, or
  4. try using a different configuration of the MediaDrm plugin, such as a different security level.

If the problem still persists after all the aforementioned steps, please report the failure to the MediaDrm plugin vendor along with the log messages returned by android.media.MediaDrm#getLogMessages(), and a bugreport if possible.

Summary

Constants
static Int

Certificate is malformed or is of the wrong type.

static Int

Certificate has not been set.

static Int

An error happened within the crypto library used by the drm plugin.

static Int

The video frame being decrypted exceeds the size of the device's protected output buffers.

static Int

Unexpected error reported by the device OEM subsystem.

static Int

Unexpected internal failure in MediaDrm/MediaCrypto.

static Int

The init data parameter passed to MediaDrm#getKeyRequest is empty or invalid.

static Int

The output protection levels supported by the device are not sufficient to meet the requirements set by the content owner in the license policy.

static Int

The security level of the device is not sufficient to meet the requirements set by the content owner in the license policy.

static Int

The key used for decryption is no longer valid due to license term expiration.

static Int

Either the key was not loaded from the license before attempting the operation, or the key ID parameter provided by the app is incorrect.

static Int

The license response was empty, fields are missing or otherwise unable to be parsed or decrypted.

static Int

The operation (e.g. to renew or persist a license) is prohibited by the license policy.

static Int

Failed to generate a release request because a field in the offline license is empty or malformed.

static Int

The license server detected an error in the license request.

static Int

Failed to restore an offline license because a field in the offline license is empty or malformed.

static Int

Offline license is in an invalid state for the attempted operation.

static Int

The session state has been invalidated.

static Int

Failure in the media framework.

static Int

The requested key was not found when trying to perform a decrypt operation.

static Int

Error loading the provisioned certificate.

static Int

Required steps were not performed before provisioning was attempted.

static Int

The provisioning response was empty, fields are missing or otherwise unable to be parsed.

static Int

The provisioning server detected an error in the provisioning request.

static Int

Provisioning failed in a way that is likely to succeed on a subsequent attempt.

static Int

A required crypto resource was not able to be allocated while attempting the requested operation.

static Int

This indicates that apps using MediaDrm sessions are temporarily exceeding the capacity of available crypto resources.

static Int

Failed to generate a secure stop request because a field in the stored license is empty or malformed.

static Int

Decryption was attempted on a session that is not opened, which could be due to a failure to open the session, closing the session prematurely, the session being reclaimed by the resource manager, or a non-existent session id.

static Int

The plugin was unable to read data from the filesystem.

static Int

The plugin was unable to write data to the filesystem.

static Int

ERROR_UNKNOWN is used where no other defined error code is applicable to the current failure.

static Int

An operation was attempted that could not be supported by the crypto system of the device in its current configuration.

static Int

MediaCodec#queueSecureInputBuffer called with 0 subsamples.

Constants

ERROR_CERTIFICATE_MALFORMED

Added in API level 31
static val ERROR_CERTIFICATE_MALFORMED: Int

Certificate is malformed or is of the wrong type.

Ensure the certificate provided by the app or returned from the license server is valid. Check with the MediaDrm plugin vendor for the expected certificate format.

Value: 10

ERROR_CERTIFICATE_MISSING

Added in API level 31
static val ERROR_CERTIFICATE_MISSING: Int

Certificate has not been set.

Ensure the certificate has been provided by the app. Check with the MediaDrm plugin vendor for the expected method to provide MediaDrm a certificate.

Value: 11

ERROR_CRYPTO_LIBRARY

Added in API level 31
static val ERROR_CRYPTO_LIBRARY: Int

An error happened within the crypto library used by the drm plugin.

Value: 12

ERROR_FRAME_TOO_LARGE

Added in API level 31
static val ERROR_FRAME_TOO_LARGE: Int

The video frame being decrypted exceeds the size of the device's protected output buffers.

When encountering this error the app should try playing content of a lower resolution or skipping the problematic frame.

Value: 8

ERROR_GENERIC_OEM

Added in API level 31
static val ERROR_GENERIC_OEM: Int

Unexpected error reported by the device OEM subsystem.

Please see the general error handling strategy for unexpected errors described in ErrorCodes.

Value: 13

ERROR_GENERIC_PLUGIN

Added in API level 31
static val ERROR_GENERIC_PLUGIN: Int

Unexpected internal failure in MediaDrm/MediaCrypto.

Please see the general error handling strategy for unexpected errors described in ErrorCodes.

Value: 14

ERROR_INIT_DATA

Added in API level 31
static val ERROR_INIT_DATA: Int

The init data parameter passed to MediaDrm#getKeyRequest is empty or invalid.

Init data is typically obtained from android.media.MediaExtractor#getPsshInfo() or android.media.MediaExtractor#getDrmInitData(). Check with the MediaDrm plugin vendor for the expected init data format.

Value: 15

ERROR_INSUFFICIENT_OUTPUT_PROTECTION

Added in API level 31
static val ERROR_INSUFFICIENT_OUTPUT_PROTECTION: Int

The output protection levels supported by the device are not sufficient to meet the requirements set by the content owner in the license policy.

Value: 4

ERROR_INSUFFICIENT_SECURITY

Added in API level 31
static val ERROR_INSUFFICIENT_SECURITY: Int

The security level of the device is not sufficient to meet the requirements set by the content owner in the license policy.

Value: 7

ERROR_KEY_EXPIRED

Added in API level 31
static val ERROR_KEY_EXPIRED: Int

The key used for decryption is no longer valid due to license term expiration.

The operation can be retried after updating the expired keys.

Value: 2

ERROR_KEY_NOT_LOADED

Added in API level 31
static val ERROR_KEY_NOT_LOADED: Int

Either the key was not loaded from the license before attempting the operation, or the key ID parameter provided by the app is incorrect.

Ensure the proper keys are in the license, and check the key ID parameter provided by the app is correct. Check with the MediaDrm plugin vendor for the expected license format.

Value: 16

ERROR_LICENSE_PARSE

Added in API level 31
static val ERROR_LICENSE_PARSE: Int

The license response was empty, fields are missing or otherwise unable to be parsed or decrypted.

Check for mistakes such as empty or overwritten buffers. Otherwise, check with the MediaDrm plugin vendor for the expected license format.

Value: 17

ERROR_LICENSE_POLICY

Added in API level 31
static val ERROR_LICENSE_POLICY: Int

The operation (e.g. to renew or persist a license) is prohibited by the license policy.

Check the license policy configuration on the license server.

Value: 18

ERROR_LICENSE_RELEASE

Added in API level 31
static val ERROR_LICENSE_RELEASE: Int

Failed to generate a release request because a field in the offline license is empty or malformed.

The license can't be released on the server, but the app may remove the offline license explicitly using android.media.MediaDrm#removeOfflineLicense.

Value: 19

ERROR_LICENSE_REQUEST_REJECTED

Added in API level 31
static val ERROR_LICENSE_REQUEST_REJECTED: Int

The license server detected an error in the license request.

Check for errors on the license server.

Value: 20

ERROR_LICENSE_RESTORE

Added in API level 31
static val ERROR_LICENSE_RESTORE: Int

Failed to restore an offline license because a field in the offline license is empty or malformed.

Try requesting the license again if the device is online.

Value: 21

ERROR_LICENSE_STATE

Added in API level 31
static val ERROR_LICENSE_STATE: Int

Offline license is in an invalid state for the attempted operation.

Check the sequence of API calls made that can affect offline license state. For example, this could happen when the app attempts to restore a license after it has been released.

Value: 22

ERROR_LOST_STATE

Added in API level 31
static val ERROR_LOST_STATE: Int

The session state has been invalidated. This can occur on devices that are not capable of retaining crypto session state across device suspend/resume.

The session must be closed and a new session opened to resume operation.

Value: 9

ERROR_MEDIA_FRAMEWORK

Added in API level 31
static val ERROR_MEDIA_FRAMEWORK: Int

Failure in the media framework.

Try releasing media resources (e.g. MediaCodec, MediaDrm), and restarting playback.

Value: 23

ERROR_NO_KEY

Added in API level 31
static val ERROR_NO_KEY: Int

The requested key was not found when trying to perform a decrypt operation.

The operation can be retried after adding the correct decryption key.

Value: 1

ERROR_PROVISIONING_CERTIFICATE

Added in API level 31
static val ERROR_PROVISIONING_CERTIFICATE: Int

Error loading the provisioned certificate.

Re-provisioning may resolve the problem; check with the MediaDrm plugin vendor for re-provisioning instructions. Otherwise, using a different security level may resolve the issue.

Value: 24

ERROR_PROVISIONING_CONFIG

Added in API level 31
static val ERROR_PROVISIONING_CONFIG: Int

Required steps were not performed before provisioning was attempted.

Ask the MediaDrm plugin vendor for situations where this error may occur.

Value: 25

ERROR_PROVISIONING_PARSE

Added in API level 31
static val ERROR_PROVISIONING_PARSE: Int

The provisioning response was empty, fields are missing or otherwise unable to be parsed.

Check for mistakes such as empty or overwritten buffers. Otherwise, check with the MediaDrm plugin vendor for the expected provisioning response format.

Value: 26

ERROR_PROVISIONING_REQUEST_REJECTED

Added in API level 31
static val ERROR_PROVISIONING_REQUEST_REJECTED: Int

The provisioning server detected an error in the provisioning request.

Check for errors on the provisioning server.

Value: 27

ERROR_PROVISIONING_RETRY

Added in API level 31
static val ERROR_PROVISIONING_RETRY: Int

Provisioning failed in a way that is likely to succeed on a subsequent attempt.

The app should retry the operation.

Value: 28

ERROR_RESOURCE_BUSY

Added in API level 31
static val ERROR_RESOURCE_BUSY: Int

A required crypto resource was not able to be allocated while attempting the requested operation.

The operation can be retried if the app is able to release resources.

Value: 3

ERROR_RESOURCE_CONTENTION

Added in API level 31
static val ERROR_RESOURCE_CONTENTION: Int

This indicates that apps using MediaDrm sessions are temporarily exceeding the capacity of available crypto resources.

The app should retry the operation later.

Value: 29

ERROR_SECURE_STOP_RELEASE

Added in API level 31
static val ERROR_SECURE_STOP_RELEASE: Int

Failed to generate a secure stop request because a field in the stored license is empty or malformed.

The secure stop can't be released on the server, but the app may remove it explicitly using MediaDrm#removeSecureStop.

Value: 30

ERROR_SESSION_NOT_OPENED

Added in API level 31
static val ERROR_SESSION_NOT_OPENED: Int

Decryption was attempted on a session that is not opened, which could be due to a failure to open the session, closing the session prematurely, the session being reclaimed by the resource manager, or a non-existent session id.

Value: 5

ERROR_STORAGE_READ

Added in API level 31
static val ERROR_STORAGE_READ: Int

The plugin was unable to read data from the filesystem.

Please see the general error handling strategy for unexpected errors described in ErrorCodes.

Value: 31

ERROR_STORAGE_WRITE

Added in API level 31
static val ERROR_STORAGE_WRITE: Int

The plugin was unable to write data to the filesystem.

Please see the general error handling strategy for unexpected errors described in ErrorCodes.

Value: 32

ERROR_UNKNOWN

Added in API level 31
static val ERROR_UNKNOWN: Int

ERROR_UNKNOWN is used where no other defined error code is applicable to the current failure.

Please see the general error handling strategy for unexpected errors described in ErrorCodes.

Value: 0

ERROR_UNSUPPORTED_OPERATION

Added in API level 31
static val ERROR_UNSUPPORTED_OPERATION: Int

An operation was attempted that could not be supported by the crypto system of the device in its current configuration.

This may occur when the license policy requires device security features that aren't supported by the device, or due to an internal error in the crypto system that prevents the specified security policy from being met.

Value: 6

ERROR_ZERO_SUBSAMPLES

Added in API level 31
static val ERROR_ZERO_SUBSAMPLES: Int

MediaCodec#queueSecureInputBuffer called with 0 subsamples.

Check the MediaCodec.CryptoInfo object passed to android.media.MediaCodec#queueSecureInputBuffer.

Value: 33