FakeExoMediaDrm.Builder


public class FakeExoMediaDrm.Builder


Builder for FakeExoMediaDrm instances.

Summary

Public constructors

Constructs an instance.

Public methods

FakeExoMediaDrm

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

FakeExoMediaDrm.Builder
@CanIgnoreReturnValue
setEnforceValidKeyResponses(boolean enforceValidKeyResponses)

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(
    boolean throwNoSuchMethodErrorForProvisioningAndResourceBusy
)

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

public Builder()

Constructs an instance.

Public methods

build

public FakeExoMediaDrm build()

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
public FakeExoMediaDrm.Builder setEnforceValidKeyResponses(boolean enforceValidKeyResponses)

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
public FakeExoMediaDrm.Builder setMaxConcurrentSessions(int maxConcurrentSessions)

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
public FakeExoMediaDrm.Builder setProvisionsRequired(int provisionsRequired)

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
public FakeExoMediaDrm.Builder throwNoSuchMethodErrorForProvisioningAndResourceBusy(
    boolean throwNoSuchMethodErrorForProvisioningAndResourceBusy
)

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
public FakeExoMediaDrm.Builder throwNotProvisionedExceptionFromGetKeyRequest()

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