@UnstableApi
public final class DrmUtil


DRM-related utility methods.

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = )
@IntDef(value = )
public annotation DrmUtil.ErrorSource

Identifies the operation which caused a DRM-related error.

Constants

static final int

Corresponds to failures caused by an ExoMediaDrm method call.

static final int

Corresponds to failures caused by an operation related to obtaining DRM licenses.

static final int

Corresponds to failures caused by an operation related to provisioning the device.

Public methods

static int

Returns the PlaybackException.ErrorCode that corresponds to the given DRM-related exception.

static boolean

Returns true if e represents a failure to construct a NotProvisionedException.

static boolean

Returns true if e represents a failure to construct a ResourceBusyException.

Constants

ERROR_SOURCE_EXO_MEDIA_DRM

public static final int ERROR_SOURCE_EXO_MEDIA_DRM = 1

Corresponds to failures caused by an ExoMediaDrm method call.

ERROR_SOURCE_LICENSE_ACQUISITION

public static final int ERROR_SOURCE_LICENSE_ACQUISITION = 2

Corresponds to failures caused by an operation related to obtaining DRM licenses.

ERROR_SOURCE_PROVISIONING

public static final int ERROR_SOURCE_PROVISIONING = 3

Corresponds to failures caused by an operation related to provisioning the device.

Public methods

getErrorCodeForMediaDrmException

@PlaybackException.ErrorCode
public static int getErrorCodeForMediaDrmException(
    Throwable exception,
    @DrmUtil.ErrorSource int errorSource
)

Returns the PlaybackException.ErrorCode that corresponds to the given DRM-related exception.

Parameters
Throwable exception

The DRM-related exception for which to obtain a corresponding .

@DrmUtil.ErrorSource int errorSource

The ErrorSource for the given exception.

Returns
int

The PlaybackException.ErrorCode that corresponds to the given DRM-related exception.

isFailureToConstructNotProvisionedException

public static boolean isFailureToConstructNotProvisionedException(@Nullable Throwable e)

Returns true if e represents a failure to construct a NotProvisionedException. See b/291440132.

isFailureToConstructResourceBusyException

public static boolean isFailureToConstructResourceBusyException(@Nullable Throwable e)

Returns true if e represents a failure to construct a ResourceBusyException. See b/291440132.