MediaDrm.ErrorCodes

public static final class MediaDrm.ErrorCodes
extends Object

java.lang.Object
   ↳ android.media.MediaDrm.ErrorCodes


Error codes that may be returned from MediaDrm.MediaDrmStateException.getErrorCode() and 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 MediaDrm.getLogMessages(), and a bugreport if possible.

Summary

Constants

int ERROR_CERTIFICATE_MALFORMED

Certificate is malformed or is of the wrong type.

int ERROR_CERTIFICATE_MISSING

Certificate has not been set.

int ERROR_CRYPTO_LIBRARY

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

int ERROR_FRAME_TOO_LARGE

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

int ERROR_GENERIC_OEM

Unexpected error reported by the device OEM subsystem.

int ERROR_GENERIC_PLUGIN

Unexpected internal failure in MediaDrm/MediaCrypto.

int ERROR_INIT_DATA

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

int ERROR_INSUFFICIENT_OUTPUT_PROTECTION

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

int ERROR_INSUFFICIENT_SECURITY

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

int ERROR_KEY_EXPIRED

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

int ERROR_KEY_NOT_LOADED

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

int ERROR_LICENSE_PARSE

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

int ERROR_LICENSE_POLICY

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

int ERROR_LICENSE_RELEASE

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

int ERROR_LICENSE_REQUEST_REJECTED

The license server detected an error in the license request.

int ERROR_LICENSE_RESTORE

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

int ERROR_LICENSE_STATE

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

int ERROR_LOST_STATE

The session state has been invalidated.

int ERROR_MEDIA_FRAMEWORK

Failure in the media framework.

int ERROR_NO_KEY

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

int ERROR_PROVISIONING_CERTIFICATE

Error loading the provisioned certificate.

int ERROR_PROVISIONING_CONFIG

Required steps were not performed before provisioning was attempted.

int ERROR_PROVISIONING_PARSE

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

int ERROR_PROVISIONING_REQUEST_REJECTED

The provisioning server detected an error in the provisioning request.

int ERROR_PROVISIONING_RETRY

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

int ERROR_RESOURCE_BUSY

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

int ERROR_RESOURCE_CONTENTION

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

int ERROR_SECURE_STOP_RELEASE

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

int ERROR_SESSION_NOT_OPENED

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.

int ERROR_STORAGE_READ

The plugin was unable to read data from the filesystem.

int ERROR_STORAGE_WRITE

The plugin was unable to write data to the filesystem.

int ERROR_UNKNOWN

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

int ERROR_UNSUPPORTED_OPERATION

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

int ERROR_ZERO_SUBSAMPLES

MediaCodec#queueSecureInputBuffer called with 0 subsamples.

Inherited methods

Constants

ERROR_CERTIFICATE_MALFORMED

Added in API level 31
public static final int ERROR_CERTIFICATE_MALFORMED

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.

Constant Value: 10 (0x0000000a)

ERROR_CERTIFICATE_MISSING

Added in API level 31
public static final int ERROR_CERTIFICATE_MISSING

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.

Constant Value: 11 (0x0000000b)

ERROR_CRYPTO_LIBRARY

Added in API level 31
public static final int ERROR_CRYPTO_LIBRARY

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

Constant Value: 12 (0x0000000c)

ERROR_FRAME_TOO_LARGE

Added in API level 31
public static final int ERROR_FRAME_TOO_LARGE

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.

Constant Value: 8 (0x00000008)

ERROR_GENERIC_OEM

Added in API level 31
public static final int ERROR_GENERIC_OEM

Unexpected error reported by the device OEM subsystem.

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

Constant Value: 13 (0x0000000d)

ERROR_GENERIC_PLUGIN

Added in API level 31
public static final int ERROR_GENERIC_PLUGIN

Unexpected internal failure in MediaDrm/MediaCrypto.

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

Constant Value: 14 (0x0000000e)

ERROR_INIT_DATA

Added in API level 31
public static final int ERROR_INIT_DATA

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

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

Constant Value: 15 (0x0000000f)

ERROR_INSUFFICIENT_OUTPUT_PROTECTION

Added in API level 31
public static final int ERROR_INSUFFICIENT_OUTPUT_PROTECTION

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

Constant Value: 4 (0x00000004)

ERROR_INSUFFICIENT_SECURITY

Added in API level 31
public static final int ERROR_INSUFFICIENT_SECURITY

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

Constant Value: 7 (0x00000007)

ERROR_KEY_EXPIRED

Added in API level 31
public static final int ERROR_KEY_EXPIRED

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

The operation can be retried after updating the expired keys.

Constant Value: 2 (0x00000002)

ERROR_KEY_NOT_LOADED

Added in API level 31
public static final int ERROR_KEY_NOT_LOADED

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.

Constant Value: 16 (0x00000010)

ERROR_LICENSE_PARSE

Added in API level 31
public static final int ERROR_LICENSE_PARSE

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.

Constant Value: 17 (0x00000011)

ERROR_LICENSE_POLICY

Added in API level 31
public static final int ERROR_LICENSE_POLICY

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.

Constant Value: 18 (0x00000012)

ERROR_LICENSE_RELEASE

Added in API level 31
public static final int ERROR_LICENSE_RELEASE

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 MediaDrm.removeOfflineLicense(byte).

Constant Value: 19 (0x00000013)

ERROR_LICENSE_REQUEST_REJECTED

Added in API level 31
public static final int ERROR_LICENSE_REQUEST_REJECTED

The license server detected an error in the license request.

Check for errors on the license server.

Constant Value: 20 (0x00000014)

ERROR_LICENSE_RESTORE

Added in API level 31
public static final int ERROR_LICENSE_RESTORE

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.

Constant Value: 21 (0x00000015)

ERROR_LICENSE_STATE

Added in API level 31
public static final int ERROR_LICENSE_STATE

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.

Constant Value: 22 (0x00000016)

ERROR_LOST_STATE

Added in API level 31
public static final int ERROR_LOST_STATE

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.

Constant Value: 9 (0x00000009)

ERROR_MEDIA_FRAMEWORK

Added in API level 31
public static final int ERROR_MEDIA_FRAMEWORK

Failure in the media framework.

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

Constant Value: 23 (0x00000017)

ERROR_NO_KEY

Added in API level 31
public static final int ERROR_NO_KEY

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

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

Constant Value: 1 (0x00000001)

ERROR_PROVISIONING_CERTIFICATE

Added in API level 31
public static final int ERROR_PROVISIONING_CERTIFICATE

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.

Constant Value: 24 (0x00000018)

ERROR_PROVISIONING_CONFIG

Added in API level 31
public static final int ERROR_PROVISIONING_CONFIG

Required steps were not performed before provisioning was attempted.

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

Constant Value: 25 (0x00000019)

ERROR_PROVISIONING_PARSE

Added in API level 31
public static final int ERROR_PROVISIONING_PARSE

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.

Constant Value: 26 (0x0000001a)

ERROR_PROVISIONING_REQUEST_REJECTED

Added in API level 31
public static final int ERROR_PROVISIONING_REQUEST_REJECTED

The provisioning server detected an error in the provisioning request.

Check for errors on the provisioning server.

Constant Value: 27 (0x0000001b)

ERROR_PROVISIONING_RETRY

Added in API level 31
public static final int ERROR_PROVISIONING_RETRY

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

The app should retry the operation.

Constant Value: 28 (0x0000001c)

ERROR_RESOURCE_BUSY

Added in API level 31
public static final int ERROR_RESOURCE_BUSY

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.

Constant Value: 3 (0x00000003)

ERROR_RESOURCE_CONTENTION

Added in API level 31
public static final int ERROR_RESOURCE_CONTENTION

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

The app should retry the operation later.

Constant Value: 29 (0x0000001d)

ERROR_SECURE_STOP_RELEASE

Added in API level 31
public static final int ERROR_SECURE_STOP_RELEASE

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.

Constant Value: 30 (0x0000001e)

ERROR_SESSION_NOT_OPENED

Added in API level 31
public static final int ERROR_SESSION_NOT_OPENED

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.

Constant Value: 5 (0x00000005)

ERROR_STORAGE_READ

Added in API level 31
public static final int ERROR_STORAGE_READ

The plugin was unable to read data from the filesystem.

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

Constant Value: 31 (0x0000001f)

ERROR_STORAGE_WRITE

Added in API level 31
public static final int ERROR_STORAGE_WRITE

The plugin was unable to write data to the filesystem.

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

Constant Value: 32 (0x00000020)

ERROR_UNKNOWN

Added in API level 31
public static final int ERROR_UNKNOWN

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.

Constant Value: 0 (0x00000000)

ERROR_UNSUPPORTED_OPERATION

Added in API level 31
public static final int ERROR_UNSUPPORTED_OPERATION

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.

Constant Value: 6 (0x00000006)

ERROR_ZERO_SUBSAMPLES

Added in API level 31
public static final int ERROR_ZERO_SUBSAMPLES

MediaCodec#queueSecureInputBuffer called with 0 subsamples.

Check the MediaCodec.CryptoInfo object passed to MediaCodec.queueSecureInputBuffer(int, int, CryptoInfo, long, int).

Constant Value: 33 (0x00000021)