public class

FakeExoMediaDrm.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.media3.test.utils.FakeExoMediaDrm.Builder

Overview

Builder for FakeExoMediaDrm instances.

Summary

Constructors
publicBuilder()

Constructs an instance.

Methods
public FakeExoMediaDrmbuild()

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

public FakeExoMediaDrm.BuildersetEnforceValidKeyResponses(boolean enforceValidKeyResponses)

Sets whether key responses passed to FakeExoMediaDrm.provideKeyResponse(byte[], byte[]) should be checked for validity (i.e.

public FakeExoMediaDrm.BuildersetMaxConcurrentSessions(int maxConcurrentSessions)

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

public FakeExoMediaDrm.BuildersetProvisionsRequired(int provisionsRequired)

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

public FakeExoMediaDrm.BuilderthrowNoSuchMethodErrorForProvisioningAndResourceBusy(boolean throwNoSuchMethodErrorForProvisioningAndResourceBusy)

Configures the FakeExoMediaDrm to throw java.lang.NoSuchMethodError instead of or .

public FakeExoMediaDrm.BuilderthrowNotProvisionedExceptionFromGetKeyRequest()

Configures the FakeExoMediaDrm to throw any from FakeExoMediaDrm.getKeyRequest(byte[], List, int, HashMap) instead of the default behaviour of throwing from FakeExoMediaDrm.openSession().

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder()

Constructs an instance.

Methods

public FakeExoMediaDrm.Builder setEnforceValidKeyResponses(boolean enforceValidKeyResponses)

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

Defaults to true.

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 from methods that declare it until enough valid provisioning responses are passed to FakeExoMediaDrm.provideProvisionResponse(byte[]).

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

public FakeExoMediaDrm.Builder throwNotProvisionedExceptionFromGetKeyRequest()

Configures the FakeExoMediaDrm to throw any from FakeExoMediaDrm.getKeyRequest(byte[], List, int, HashMap) instead of the default behaviour of throwing from FakeExoMediaDrm.openSession().

public FakeExoMediaDrm.Builder throwNoSuchMethodErrorForProvisioningAndResourceBusy(boolean throwNoSuchMethodErrorForProvisioningAndResourceBusy)

Configures the FakeExoMediaDrm to throw java.lang.NoSuchMethodError instead of or .

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.

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 FakeExoMediaDrm.openSession() will throw .

Defaults to MAX_VALUE.

public FakeExoMediaDrm build()

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