Package com.google.android.exoplayer2.testutil

## Class FakeExoMediaDrm.Builder

- java.lang.Object
- - com.google.android.exoplayer2.testutil.FakeExoMediaDrm.Builder

- Enclosing class:
    FakeExoMediaDrm

      public static class FakeExoMediaDrm.Builder
      extends Object

  Builder for `FakeExoMediaDrm` instances.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Builder()` | Constructs an instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `FakeExoMediaDrm` | `build()` | Returns a `FakeExoMediaDrm` instance with an initial reference count of 1.
    `FakeExoMediaDrm.Builder` | `setEnforceValidKeyResponses​(boolean enforceValidKeyResponses)` | Sets whether key responses passed to `FakeExoMediaDrm.provideKeyResponse(byte[], byte[])` should be checked for validity (i.e.
    `FakeExoMediaDrm.Builder` | `setMaxConcurrentSessions​(int maxConcurrentSessions)` | Sets the maximum number of concurrent sessions the `FakeExoMediaDrm` will support.
    `FakeExoMediaDrm.Builder` | `setProvisionsRequired​(int provisionsRequired)` | Sets how many successful provisioning round trips are needed for the `FakeExoMediaDrm` to be provisioned.
    `FakeExoMediaDrm.Builder` | `throwNotProvisionedExceptionFromGetKeyRequest()` | Configures the `FakeExoMediaDrm` to throw any `NotProvisionedException` from `FakeExoMediaDrm.getKeyRequest(byte[], List, int, HashMap)` instead of the default behaviour of throwing from `FakeExoMediaDrm.openSession()`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Builder

          public Builder()

      Constructs an instance.

  - ### Method Detail

    - #### setEnforceValidKeyResponses

          @CanIgnoreReturnValue
          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.

    - #### 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 `FakeExoMediaDrm.provideProvisionResponse(byte[])`.

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

    - #### throwNotProvisionedExceptionFromGetKeyRequest

          @CanIgnoreReturnValue
          public FakeExoMediaDrm.Builder throwNotProvisionedExceptionFromGetKeyRequest()

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

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

      Defaults to `Integer.MAX_VALUE`.

    - #### build

          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.