Added in API level 29

SessionException


class SessionException : RuntimeException, MediaDrmThrowable
kotlin.Any
   ↳ kotlin.Throwable
   ↳ java.lang.Exception
   ↳ java.lang.RuntimeException
   ↳ android.media.MediaDrm.SessionException

SessionException is a misnomer because it may occur in methods without a session context.

A SessionException is most likely to be thrown when an operation failed in a way that is likely to succeed on a subsequent attempt; call isTransient() to determine whether the app should retry the failing operation.

Summary

Constants
static Int

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

static Int

The SessionException has an unknown error code.

Public constructors
SessionException(errorCode: Int, detailMessage: String?)

Public methods
Int

Retrieve the error code associated with the SessionException

Int

Int

Int

Boolean

Returns true if the SessionException is a transient issue, perhaps due to resource constraints, and that the operation (e.g. provisioning, generating requests) may succeed on a subsequent attempt.

Constants

ERROR_RESOURCE_CONTENTION

Added in API level 29
Deprecated in API level 31
static val ERROR_RESOURCE_CONTENTION: Int

Deprecated: Please use isTransient() instead of comparing the return value of getErrorCode() against SessionException#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.

Value: 1

ERROR_UNKNOWN

Added in API level 29
Deprecated in API level 31
static val ERROR_UNKNOWN: Int

Deprecated: Unused.

The SessionException has an unknown error code.

Value: 0

Public constructors

SessionException

Added in API level 29
SessionException(
    errorCode: Int,
    detailMessage: String?)
Parameters
detailMessage String?: This value may be null.

Public methods

getErrorCode

Added in API level 29
Deprecated in API level 31
fun getErrorCode(): Int

Deprecated: Please use isTransient() instead of comparing the return value of getErrorCode() against SessionException#ERROR_RESOURCE_CONTENTION.

Retrieve the error code associated with the SessionException

Return
Int Value is android.media.MediaDrm.SessionException#ERROR_RESOURCE_CONTENTION

getErrorContext

Added in API level 34
fun getErrorContext(): Int
Return
Int an opaque integer that would help the @MediaDrm vendor locate the source of the error if available, otherwise 0.

getOemError

Added in API level 34
fun getOemError(): Int
Return
Int an OEM or SOC specific error code if available, otherwise 0.

getVendorError

Added in API level 34
fun getVendorError(): Int
Return
Int an error code defined by the MediaDrm plugin vendor if available, otherwise 0.

isTransient

Added in API level 31
fun isTransient(): Boolean

Returns true if the SessionException is a transient issue, perhaps due to resource constraints, and that the operation (e.g. provisioning, generating requests) may succeed on a subsequent attempt.