FakeExoMediaDrm.Builder


class FakeExoMediaDrm.Builder


Builder for FakeExoMediaDrm instances.

Summary

Public constructors

Constructs an instance.

Public functions

FakeExoMediaDrm!

Returns a FakeExoMediaDrm instance with an initial reference count of 1.

FakeExoMediaDrm.Builder!

Sets whether key responses passed to provideKeyResponse should be checked for validity (i.e. that they came from a LicenseServer).

FakeExoMediaDrm.Builder!

Sets the maximum number of concurrent sessions the FakeExoMediaDrm will support.

FakeExoMediaDrm.Builder!

Sets how many successful provisioning round trips are needed for the FakeExoMediaDrm to be provisioned.

FakeExoMediaDrm.Builder!
@CanIgnoreReturnValue
throwNoSuchMethodErrorForProvisioningAndResourceBusy(
    throwNoSuchMethodErrorForProvisioningAndResourceBusy: Boolean
)

Configures the FakeExoMediaDrm to throw NoSuchMethodError instead of or ResourceBusyException.

FakeExoMediaDrm.Builder!

Configures the FakeExoMediaDrm to throw any NotProvisionedException from getKeyRequest instead of the default behaviour of throwing from openSession.

Public constructors

Builder

Builder()

Constructs an instance.

Public functions

build

fun build(): FakeExoMediaDrm!

Returns a FakeExoMediaDrm instance with an initial reference count of 1. The caller is responsible for calling release when they no longer need the instance.

setEnforceValidKeyResponses

@CanIgnoreReturnValue
fun setEnforceValidKeyResponses(enforceValidKeyResponses: Boolean): FakeExoMediaDrm.Builder!

Sets whether key responses passed to provideKeyResponse should be checked for validity (i.e. that they came from a LicenseServer).

Defaults to true.

setMaxConcurrentSessions

@CanIgnoreReturnValue
fun setMaxConcurrentSessions(maxConcurrentSessions: Int): FakeExoMediaDrm.Builder!

Sets the maximum number of concurrent sessions the FakeExoMediaDrm will support.

If this is exceeded then subsequent calls to openSession will throw ResourceBusyException.

Defaults to MAX_VALUE.

setProvisionsRequired

@CanIgnoreReturnValue
fun setProvisionsRequired(provisionsRequired: Int): FakeExoMediaDrm.Builder!

Sets how many successful provisioning round trips are needed for the FakeExoMediaDrm to be provisioned.

An unprovisioned FakeExoMediaDrm will throw NotProvisionedException from methods that declare it until enough valid provisioning responses are passed to provideProvisionResponse.

Defaults to 0 (i.e. device is already provisioned).

throwNoSuchMethodErrorForProvisioningAndResourceBusy

@CanIgnoreReturnValue
fun throwNoSuchMethodErrorForProvisioningAndResourceBusy(
    throwNoSuchMethodErrorForProvisioningAndResourceBusy: Boolean
): FakeExoMediaDrm.Builder!

Configures the FakeExoMediaDrm to throw NoSuchMethodError instead of or ResourceBusyException.

This simulates a framework bug (b/291440132) introduced in API 34 and resolved by http://r.android.com/2770659, allowing us to test workarounds for the bug.

The default is false.

throwNotProvisionedExceptionFromGetKeyRequest

@CanIgnoreReturnValue
fun throwNotProvisionedExceptionFromGetKeyRequest(): FakeExoMediaDrm.Builder!

Configures the FakeExoMediaDrm to throw any NotProvisionedException from getKeyRequest instead of the default behaviour of throwing from openSession.