com.google.android.exoplayer2.util.EventDispatcher Java Examples

The following examples show how to use com.google.android.exoplayer2.util.EventDispatcher. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultDrmSessionManager.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("nullness:initialization.fields.uninitialized")
private DefaultDrmSessionManager(
    UUID uuid,
    ExoMediaDrm.Provider<T> exoMediaDrmProvider,
    MediaDrmCallback callback,
    HashMap<String, String> keyRequestParameters,
    boolean multiSession,
    int[] useDrmSessionsForClearContentTrackTypes,
    boolean playClearSamplesWithoutKeys,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
  Assertions.checkNotNull(uuid);
  Assertions.checkArgument(!C.COMMON_PSSH_UUID.equals(uuid), "Use C.CLEARKEY_UUID instead");
  this.uuid = uuid;
  this.exoMediaDrmProvider = exoMediaDrmProvider;
  this.callback = callback;
  this.keyRequestParameters = keyRequestParameters;
  this.eventDispatcher = new EventDispatcher<>();
  this.multiSession = multiSession;
  this.useDrmSessionsForClearContentTrackTypes = useDrmSessionsForClearContentTrackTypes;
  this.playClearSamplesWithoutKeys = playClearSamplesWithoutKeys;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  provisioningManagerImpl = new ProvisioningManagerImpl();
  mode = MODE_PLAYBACK;
  sessions = new ArrayList<>();
  provisioningSessions = new ArrayList<>();
}
 
Example #2
Source File: DefaultBandwidthMeter.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private DefaultBandwidthMeter(
    @Nullable Context context,
    SparseArray<Long> initialBitrateEstimates,
    int maxWeight,
    Clock clock,
    boolean resetOnNetworkTypeChange) {
  this.context = context == null ? null : context.getApplicationContext();
  this.initialBitrateEstimates = initialBitrateEstimates;
  this.eventDispatcher = new EventDispatcher<>();
  this.slidingPercentile = new SlidingPercentile(maxWeight);
  this.clock = clock;
  // Set the initial network type and bitrate estimate
  networkType = context == null ? C.NETWORK_TYPE_UNKNOWN : Util.getNetworkType(context);
  bitrateEstimate = getInitialBitrateEstimateForNetworkType(networkType);
  // Register to receive connectivity actions if possible.
  if (context != null && resetOnNetworkTypeChange) {
    ConnectivityActionReceiver connectivityActionReceiver =
        ConnectivityActionReceiver.getInstance(context);
    connectivityActionReceiver.register(/* bandwidthMeter= */ this);
  }
}
 
Example #3
Source File: DefaultDrmSessionManager.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param uuid The UUID of the drm scheme.
 * @param mediaDrm An underlying {@link ExoMediaDrm} for use by the manager.
 * @param callback Performs key and provisioning requests.
 * @param optionalKeyRequestParameters An optional map of parameters to pass as the last argument
 *     to {@link ExoMediaDrm#getKeyRequest(byte[], byte[], String, int, HashMap)}. May be null.
 * @param multiSession A boolean that specify whether multiple key session support is enabled.
 *     Default is false.
 * @param initialDrmRequestRetryCount The number of times to retry for initial provisioning and
 *     key request before reporting error.
 */
public DefaultDrmSessionManager(
    UUID uuid,
    ExoMediaDrm<T> mediaDrm,
    MediaDrmCallback callback,
    HashMap<String, String> optionalKeyRequestParameters,
    boolean multiSession,
    int initialDrmRequestRetryCount) {
  Assertions.checkNotNull(uuid);
  Assertions.checkNotNull(mediaDrm);
  Assertions.checkArgument(!C.COMMON_PSSH_UUID.equals(uuid), "Use C.CLEARKEY_UUID instead");
  this.uuid = uuid;
  this.mediaDrm = mediaDrm;
  this.callback = callback;
  this.optionalKeyRequestParameters = optionalKeyRequestParameters;
  this.eventDispatcher = new EventDispatcher<>();
  this.multiSession = multiSession;
  this.initialDrmRequestRetryCount = initialDrmRequestRetryCount;
  mode = MODE_PLAYBACK;
  sessions = new ArrayList<>();
  provisioningSessions = new ArrayList<>();
  if (multiSession) {
    mediaDrm.setPropertyString("sessionSharing", "enable");
  }
  mediaDrm.setOnEventListener(new MediaDrmEventListener());
}
 
Example #4
Source File: DefaultDrmSessionManager.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param uuid The UUID of the drm scheme.
 * @param mediaDrm An underlying {@link ExoMediaDrm} for use by the manager.
 * @param callback Performs key and provisioning requests.
 * @param optionalKeyRequestParameters An optional map of parameters to pass as the last argument
 *     to {@link ExoMediaDrm#getKeyRequest(byte[], byte[], String, int, HashMap)}. May be null.
 * @param multiSession A boolean that specify whether multiple key session support is enabled.
 *     Default is false.
 * @param initialDrmRequestRetryCount The number of times to retry for initial provisioning and
 *     key request before reporting error.
 */
public DefaultDrmSessionManager(
    UUID uuid,
    ExoMediaDrm<T> mediaDrm,
    MediaDrmCallback callback,
    HashMap<String, String> optionalKeyRequestParameters,
    boolean multiSession,
    int initialDrmRequestRetryCount) {
  Assertions.checkNotNull(uuid);
  Assertions.checkNotNull(mediaDrm);
  Assertions.checkArgument(!C.COMMON_PSSH_UUID.equals(uuid), "Use C.CLEARKEY_UUID instead");
  this.uuid = uuid;
  this.mediaDrm = mediaDrm;
  this.callback = callback;
  this.optionalKeyRequestParameters = optionalKeyRequestParameters;
  this.eventDispatcher = new EventDispatcher<>();
  this.multiSession = multiSession;
  this.initialDrmRequestRetryCount = initialDrmRequestRetryCount;
  mode = MODE_PLAYBACK;
  sessions = new ArrayList<>();
  provisioningSessions = new ArrayList<>();
  if (multiSession) {
    mediaDrm.setPropertyString("sessionSharing", "enable");
  }
  mediaDrm.setOnEventListener(new MediaDrmEventListener());
}
 
Example #5
Source File: DefaultBandwidthMeter.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private DefaultBandwidthMeter(
    @Nullable Context context,
    SparseArray<Long> initialBitrateEstimates,
    int maxWeight,
    Clock clock,
    boolean resetOnNetworkTypeChange) {
  this.context = context == null ? null : context.getApplicationContext();
  this.initialBitrateEstimates = initialBitrateEstimates;
  this.eventDispatcher = new EventDispatcher<>();
  this.slidingPercentile = new SlidingPercentile(maxWeight);
  this.clock = clock;
  // Set the initial network type and bitrate estimate
  networkType = context == null ? C.NETWORK_TYPE_UNKNOWN : Util.getNetworkType(context);
  bitrateEstimate = getInitialBitrateEstimateForNetworkType(networkType);
  // Register to receive connectivity actions if possible.
  if (context != null && resetOnNetworkTypeChange) {
    ConnectivityActionReceiver connectivityActionReceiver =
        ConnectivityActionReceiver.getInstance(context);
    connectivityActionReceiver.register(/* bandwidthMeter= */ this);
  }
}
 
Example #6
Source File: DefaultBandwidthMeter.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private DefaultBandwidthMeter(
    @Nullable Context context,
    SparseArray<Long> initialBitrateEstimates,
    int maxWeight,
    Clock clock,
    boolean resetOnNetworkTypeChange) {
  this.context = context == null ? null : context.getApplicationContext();
  this.initialBitrateEstimates = initialBitrateEstimates;
  this.eventDispatcher = new EventDispatcher<>();
  this.slidingPercentile = new SlidingPercentile(maxWeight);
  this.clock = clock;
  // Set the initial network type and bitrate estimate
  networkType = context == null ? C.NETWORK_TYPE_UNKNOWN : Util.getNetworkType(context);
  bitrateEstimate = getInitialBitrateEstimateForNetworkType(networkType);
  // Register to receive connectivity actions if possible.
  if (context != null && resetOnNetworkTypeChange) {
    ConnectivityActionReceiver connectivityActionReceiver =
        ConnectivityActionReceiver.getInstance(context);
    connectivityActionReceiver.register(/* bandwidthMeter= */ this);
  }
}
 
Example #7
Source File: DefaultDrmSession.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Instantiates a new DRM session.
 *
 * @param uuid The UUID of the drm scheme.
 * @param mediaDrm The media DRM.
 * @param provisioningManager The manager for provisioning.
 * @param schemeData The DRM data for this session, or null if a {@code offlineLicenseKeySetId} is
 *     provided.
 * @param mode The DRM mode.
 * @param offlineLicenseKeySetId The offline license key set identifier, or null when not using
 *     offline keys.
 * @param optionalKeyRequestParameters The optional key request parameters.
 * @param callback The media DRM callback.
 * @param playbackLooper The playback looper.
 * @param eventDispatcher The dispatcher for DRM session manager events.
 * @param initialDrmRequestRetryCount The number of times to retry for initial provisioning and
 *     key request before reporting error.
 */
public DefaultDrmSession(
    UUID uuid,
    ExoMediaDrm<T> mediaDrm,
    ProvisioningManager<T> provisioningManager,
    @Nullable SchemeData schemeData,
    @DefaultDrmSessionManager.Mode int mode,
    @Nullable byte[] offlineLicenseKeySetId,
    HashMap<String, String> optionalKeyRequestParameters,
    MediaDrmCallback callback,
    Looper playbackLooper,
    EventDispatcher<DefaultDrmSessionEventListener> eventDispatcher,
    int initialDrmRequestRetryCount) {
  this.uuid = uuid;
  this.provisioningManager = provisioningManager;
  this.mediaDrm = mediaDrm;
  this.mode = mode;
  this.offlineLicenseKeySetId = offlineLicenseKeySetId;
  this.schemeData = offlineLicenseKeySetId == null ? schemeData : null;
  this.optionalKeyRequestParameters = optionalKeyRequestParameters;
  this.callback = callback;
  this.initialDrmRequestRetryCount = initialDrmRequestRetryCount;
  this.eventDispatcher = eventDispatcher;
  state = STATE_OPENING;

  postResponseHandler = new PostResponseHandler(playbackLooper);
  requestHandlerThread = new HandlerThread("DrmRequestHandler");
  requestHandlerThread.start();
  postRequestHandler = new PostRequestHandler(requestHandlerThread.getLooper());
}
 
Example #8
Source File: DefaultBandwidthMeter.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private DefaultBandwidthMeter(
    long initialBitrateEstimate,
    int maxWeight,
    Clock clock) {
  this.eventDispatcher = new EventDispatcher<>();
  this.slidingPercentile = new SlidingPercentile(maxWeight);
  this.clock = clock;
  bitrateEstimate = initialBitrateEstimate;
}
 
Example #9
Source File: DefaultDrmSession.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Instantiates a new DRM session.
 *
 * @param uuid The UUID of the drm scheme.
 * @param mediaDrm The media DRM.
 * @param provisioningManager The manager for provisioning.
 * @param schemeData The DRM data for this session, or null if a {@code offlineLicenseKeySetId} is
 *     provided.
 * @param mode The DRM mode.
 * @param offlineLicenseKeySetId The offline license key set identifier, or null when not using
 *     offline keys.
 * @param optionalKeyRequestParameters The optional key request parameters.
 * @param callback The media DRM callback.
 * @param playbackLooper The playback looper.
 * @param eventDispatcher The dispatcher for DRM session manager events.
 * @param initialDrmRequestRetryCount The number of times to retry for initial provisioning and
 *     key request before reporting error.
 */
public DefaultDrmSession(
    UUID uuid,
    ExoMediaDrm<T> mediaDrm,
    ProvisioningManager<T> provisioningManager,
    @Nullable SchemeData schemeData,
    @DefaultDrmSessionManager.Mode int mode,
    @Nullable byte[] offlineLicenseKeySetId,
    HashMap<String, String> optionalKeyRequestParameters,
    MediaDrmCallback callback,
    Looper playbackLooper,
    EventDispatcher<DefaultDrmSessionEventListener> eventDispatcher,
    int initialDrmRequestRetryCount) {
  this.uuid = uuid;
  this.provisioningManager = provisioningManager;
  this.mediaDrm = mediaDrm;
  this.mode = mode;
  this.offlineLicenseKeySetId = offlineLicenseKeySetId;
  this.schemeData = offlineLicenseKeySetId == null ? schemeData : null;
  this.optionalKeyRequestParameters = optionalKeyRequestParameters;
  this.callback = callback;
  this.initialDrmRequestRetryCount = initialDrmRequestRetryCount;
  this.eventDispatcher = eventDispatcher;
  state = STATE_OPENING;

  postResponseHandler = new PostResponseHandler(playbackLooper);
  requestHandlerThread = new HandlerThread("DrmRequestHandler");
  requestHandlerThread.start();
  postRequestHandler = new PostRequestHandler(requestHandlerThread.getLooper());
}
 
Example #10
Source File: DefaultBandwidthMeter.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private DefaultBandwidthMeter(
    long initialBitrateEstimate,
    int maxWeight,
    Clock clock) {
  this.eventDispatcher = new EventDispatcher<>();
  this.slidingPercentile = new SlidingPercentile(maxWeight);
  this.clock = clock;
  bitrateEstimate = initialBitrateEstimate;
}
 
Example #11
Source File: DefaultDrmSessionManager.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param uuid The UUID of the drm scheme.
 * @param mediaDrm An underlying {@link ExoMediaDrm} for use by the manager.
 * @param callback Performs key and provisioning requests.
 * @param optionalKeyRequestParameters An optional map of parameters to pass as the last argument
 *     to {@link ExoMediaDrm#getKeyRequest(byte[], List, int, HashMap)}. May be null.
 * @param multiSession A boolean that specify whether multiple key session support is enabled.
 *     Default is false.
 * @param initialDrmRequestRetryCount The number of times to retry for initial provisioning and
 *     key request before reporting error.
 */
public DefaultDrmSessionManager(
    UUID uuid,
    ExoMediaDrm<T> mediaDrm,
    MediaDrmCallback callback,
    @Nullable HashMap<String, String> optionalKeyRequestParameters,
    boolean multiSession,
    int initialDrmRequestRetryCount) {
  Assertions.checkNotNull(uuid);
  Assertions.checkNotNull(mediaDrm);
  Assertions.checkArgument(!C.COMMON_PSSH_UUID.equals(uuid), "Use C.CLEARKEY_UUID instead");
  this.uuid = uuid;
  this.mediaDrm = mediaDrm;
  this.callback = callback;
  this.optionalKeyRequestParameters = optionalKeyRequestParameters;
  this.eventDispatcher = new EventDispatcher<>();
  this.multiSession = multiSession;
  this.initialDrmRequestRetryCount = initialDrmRequestRetryCount;
  mode = MODE_PLAYBACK;
  sessions = new ArrayList<>();
  provisioningSessions = new ArrayList<>();
  if (multiSession && C.WIDEVINE_UUID.equals(uuid) && Util.SDK_INT >= 19) {
    // TODO: Enabling session sharing probably doesn't do anything useful here. It would only be
    // useful if DefaultDrmSession instances were aware of one another's state, which is not
    // implemented. Or if custom renderers are being used that allow playback to proceed before
    // keys, which seems unlikely to be true in practice.
    mediaDrm.setPropertyString("sessionSharing", "enable");
  }
  mediaDrm.setOnEventListener(new MediaDrmEventListener());
}
 
Example #12
Source File: DefaultDrmSession.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Instantiates a new DRM session.
 *
 * @param uuid The UUID of the drm scheme.
 * @param mediaDrm The media DRM.
 * @param provisioningManager The manager for provisioning.
 * @param schemeDatas DRM scheme datas for this session, or null if an {@code
 *     offlineLicenseKeySetId} is provided.
 * @param mode The DRM mode.
 * @param offlineLicenseKeySetId The offline license key set identifier, or null when not using
 *     offline keys.
 * @param optionalKeyRequestParameters The optional key request parameters.
 * @param callback The media DRM callback.
 * @param playbackLooper The playback looper.
 * @param eventDispatcher The dispatcher for DRM session manager events.
 * @param initialDrmRequestRetryCount The number of times to retry for initial provisioning and
 *     key request before reporting error.
 */
public DefaultDrmSession(
    UUID uuid,
    ExoMediaDrm<T> mediaDrm,
    ProvisioningManager<T> provisioningManager,
    @Nullable List<SchemeData> schemeDatas,
    @DefaultDrmSessionManager.Mode int mode,
    @Nullable byte[] offlineLicenseKeySetId,
    @Nullable HashMap<String, String> optionalKeyRequestParameters,
    MediaDrmCallback callback,
    Looper playbackLooper,
    EventDispatcher<DefaultDrmSessionEventListener> eventDispatcher,
    int initialDrmRequestRetryCount) {
  if (mode == DefaultDrmSessionManager.MODE_QUERY
      || mode == DefaultDrmSessionManager.MODE_RELEASE) {
    Assertions.checkNotNull(offlineLicenseKeySetId);
  }
  this.uuid = uuid;
  this.provisioningManager = provisioningManager;
  this.mediaDrm = mediaDrm;
  this.mode = mode;
  if (offlineLicenseKeySetId != null) {
    this.offlineLicenseKeySetId = offlineLicenseKeySetId;
    this.schemeDatas = null;
  } else {
    this.schemeDatas = Collections.unmodifiableList(Assertions.checkNotNull(schemeDatas));
  }
  this.optionalKeyRequestParameters = optionalKeyRequestParameters;
  this.callback = callback;
  this.initialDrmRequestRetryCount = initialDrmRequestRetryCount;
  this.eventDispatcher = eventDispatcher;
  state = STATE_OPENING;

  postResponseHandler = new PostResponseHandler(playbackLooper);
  requestHandlerThread = new HandlerThread("DrmRequestHandler");
  requestHandlerThread.start();
  postRequestHandler = new PostRequestHandler(requestHandlerThread.getLooper());
}
 
Example #13
Source File: DefaultDrmSessionManager.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param uuid The UUID of the drm scheme.
 * @param mediaDrm An underlying {@link ExoMediaDrm} for use by the manager.
 * @param callback Performs key and provisioning requests.
 * @param optionalKeyRequestParameters An optional map of parameters to pass as the last argument
 *     to {@link ExoMediaDrm#getKeyRequest(byte[], List, int, HashMap)}. May be null.
 * @param multiSession A boolean that specify whether multiple key session support is enabled.
 *     Default is false.
 * @param initialDrmRequestRetryCount The number of times to retry for initial provisioning and
 *     key request before reporting error.
 */
public DefaultDrmSessionManager(
    UUID uuid,
    ExoMediaDrm<T> mediaDrm,
    MediaDrmCallback callback,
    @Nullable HashMap<String, String> optionalKeyRequestParameters,
    boolean multiSession,
    int initialDrmRequestRetryCount) {
  Assertions.checkNotNull(uuid);
  Assertions.checkNotNull(mediaDrm);
  Assertions.checkArgument(!C.COMMON_PSSH_UUID.equals(uuid), "Use C.CLEARKEY_UUID instead");
  this.uuid = uuid;
  this.mediaDrm = mediaDrm;
  this.callback = callback;
  this.optionalKeyRequestParameters = optionalKeyRequestParameters;
  this.eventDispatcher = new EventDispatcher<>();
  this.multiSession = multiSession;
  this.initialDrmRequestRetryCount = initialDrmRequestRetryCount;
  mode = MODE_PLAYBACK;
  sessions = new ArrayList<>();
  provisioningSessions = new ArrayList<>();
  if (multiSession && C.WIDEVINE_UUID.equals(uuid) && Util.SDK_INT >= 19) {
    // TODO: Enabling session sharing probably doesn't do anything useful here. It would only be
    // useful if DefaultDrmSession instances were aware of one another's state, which is not
    // implemented. Or if custom renderers are being used that allow playback to proceed before
    // keys, which seems unlikely to be true in practice.
    mediaDrm.setPropertyString("sessionSharing", "enable");
  }
  mediaDrm.setOnEventListener(new MediaDrmEventListener());
}
 
Example #14
Source File: DefaultDrmSession.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Instantiates a new DRM session.
 *
 * @param uuid The UUID of the drm scheme.
 * @param mediaDrm The media DRM.
 * @param provisioningManager The manager for provisioning.
 * @param schemeDatas DRM scheme datas for this session, or null if an {@code
 *     offlineLicenseKeySetId} is provided.
 * @param mode The DRM mode.
 * @param offlineLicenseKeySetId The offline license key set identifier, or null when not using
 *     offline keys.
 * @param optionalKeyRequestParameters The optional key request parameters.
 * @param callback The media DRM callback.
 * @param playbackLooper The playback looper.
 * @param eventDispatcher The dispatcher for DRM session manager events.
 * @param initialDrmRequestRetryCount The number of times to retry for initial provisioning and
 *     key request before reporting error.
 */
public DefaultDrmSession(
    UUID uuid,
    ExoMediaDrm<T> mediaDrm,
    ProvisioningManager<T> provisioningManager,
    @Nullable List<SchemeData> schemeDatas,
    @DefaultDrmSessionManager.Mode int mode,
    @Nullable byte[] offlineLicenseKeySetId,
    @Nullable HashMap<String, String> optionalKeyRequestParameters,
    MediaDrmCallback callback,
    Looper playbackLooper,
    EventDispatcher<DefaultDrmSessionEventListener> eventDispatcher,
    int initialDrmRequestRetryCount) {
  if (mode == DefaultDrmSessionManager.MODE_QUERY
      || mode == DefaultDrmSessionManager.MODE_RELEASE) {
    Assertions.checkNotNull(offlineLicenseKeySetId);
  }
  this.uuid = uuid;
  this.provisioningManager = provisioningManager;
  this.mediaDrm = mediaDrm;
  this.mode = mode;
  if (offlineLicenseKeySetId != null) {
    this.offlineLicenseKeySetId = offlineLicenseKeySetId;
    this.schemeDatas = null;
  } else {
    this.schemeDatas = Collections.unmodifiableList(Assertions.checkNotNull(schemeDatas));
  }
  this.optionalKeyRequestParameters = optionalKeyRequestParameters;
  this.callback = callback;
  this.initialDrmRequestRetryCount = initialDrmRequestRetryCount;
  this.eventDispatcher = eventDispatcher;
  state = STATE_OPENING;

  postResponseHandler = new PostResponseHandler(playbackLooper);
  requestHandlerThread = new HandlerThread("DrmRequestHandler");
  requestHandlerThread.start();
  postRequestHandler = new PostRequestHandler(requestHandlerThread.getLooper());
}
 
Example #15
Source File: DefaultDrmSession.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
/**
 * Instantiates a new DRM session.
 *
 * @param uuid The UUID of the drm scheme.
 * @param mediaDrm The media DRM.
 * @param provisioningManager The manager for provisioning.
 * @param releaseCallback The {@link ReleaseCallback}.
 * @param schemeDatas DRM scheme datas for this session, or null if an {@code
 *     offlineLicenseKeySetId} is provided or if {@code isPlaceholderSession} is true.
 * @param mode The DRM mode. Ignored if {@code isPlaceholderSession} is true.
 * @param isPlaceholderSession Whether this session is not expected to acquire any keys.
 * @param offlineLicenseKeySetId The offline license key set identifier, or null when not using
 *     offline keys.
 * @param keyRequestParameters Key request parameters.
 * @param callback The media DRM callback.
 * @param playbackLooper The playback looper.
 * @param eventDispatcher The dispatcher for DRM session manager events.
 * @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy} for key and provisioning
 *     requests.
 */
// the constructor does not initialize fields: sessionId
@SuppressWarnings("nullness:initialization.fields.uninitialized")
public DefaultDrmSession(
    UUID uuid,
    ExoMediaDrm<T> mediaDrm,
    ProvisioningManager<T> provisioningManager,
    ReleaseCallback<T> releaseCallback,
    @Nullable List<SchemeData> schemeDatas,
    @DefaultDrmSessionManager.Mode int mode,
    boolean playClearSamplesWithoutKeys,
    boolean isPlaceholderSession,
    @Nullable byte[] offlineLicenseKeySetId,
    HashMap<String, String> keyRequestParameters,
    MediaDrmCallback callback,
    Looper playbackLooper,
    EventDispatcher<DefaultDrmSessionEventListener> eventDispatcher,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
  if (mode == DefaultDrmSessionManager.MODE_QUERY
      || mode == DefaultDrmSessionManager.MODE_RELEASE) {
    Assertions.checkNotNull(offlineLicenseKeySetId);
  }
  this.uuid = uuid;
  this.provisioningManager = provisioningManager;
  this.releaseCallback = releaseCallback;
  this.mediaDrm = mediaDrm;
  this.mode = mode;
  this.playClearSamplesWithoutKeys = playClearSamplesWithoutKeys;
  this.isPlaceholderSession = isPlaceholderSession;
  if (offlineLicenseKeySetId != null) {
    this.offlineLicenseKeySetId = offlineLicenseKeySetId;
    this.schemeDatas = null;
  } else {
    this.schemeDatas = Collections.unmodifiableList(Assertions.checkNotNull(schemeDatas));
  }
  this.keyRequestParameters = keyRequestParameters;
  this.callback = callback;
  this.eventDispatcher = eventDispatcher;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  state = STATE_OPENING;
  responseHandler = new ResponseHandler(playbackLooper);
}