/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.android.exoplayer2.drm;

import android.os.Looper;
import com.google.android.exoplayer2.drm.DrmInitData.SchemeData;

/**
 * Manages a DRM session.
 */
public interface DrmSessionManager<T extends ExoMediaCrypto> {

  /**
   * Returns whether the manager is capable of acquiring a session for the given
   * {@link DrmInitData}.
   *
   * @param drmInitData DRM initialization data.
   * @return Whether the manager is capable of acquiring a session for the given
   *     {@link DrmInitData}.
   */
  boolean canAcquireSession(DrmInitData drmInitData);

  /**
   * Returns a {@link DrmSession} with an acquired reference for the specified {@link DrmInitData}.
   *
   * <p>The caller must call {@link DrmSession#releaseReference} to decrement the session's
   * reference count when the session is no longer required.
   *
   * @param playbackLooper The looper associated with the media playback thread.
   * @param drmInitData DRM initialization data. All contained {@link SchemeData}s must contain
   *     non-null {@link SchemeData#data}.
   * @return The DRM session.
   */
  DrmSession<T> acquireSession(Looper playbackLooper, DrmInitData drmInitData);
}

@@ -683,16 +683,51 @@
 Looper;%0A
+import androidx.annotation.IntDef;%0A
 import c
@@ -787,105 +787,1082 @@
 ta;%0A
-%0A/**%0A * Manages a DRM session.%0A */%0Apublic interface DrmSessionManager%3CT extends ExoMediaCrypto%3E %7B
+import java.lang.annotation.Documented;%0Aimport java.lang.annotation.Retention;%0Aimport java.lang.annotation.RetentionPolicy;%0A%0A/**%0A * Manages a DRM session.%0A */%0Apublic interface DrmSessionManager%3CT extends ExoMediaCrypto%3E %7B%0A%0A  /** Flags that control the handling of DRM protected content. */%0A  @Documented%0A  @Retention(RetentionPolicy.SOURCE)%0A  @IntDef(%0A      flag = true,%0A      value = %7BFLAG_PLAY_CLEAR_SAMPLES_WITHOUT_KEYS%7D)%0A  @interface Flags %7B%7D%0A%0A  /**%0A   * When this flag is set, clear samples of an encrypted region may be rendered when no keys are%0A   * available.%0A   *%0A   * %3Cp%3EEncrypted media may contain clear (un-encrypted) regions. For example a media file may start%0A   * with a short clear region so as to allow playback to begin in parallel with key acquisition.%0A   * When this flag is set, consumers of sample data are permitted to access the clear regions of%0A   * encrypted media files when the associated %7B@link DrmSession%7D has not yet obtained the keys%0A   * necessary for the encrypted regions of the media.%0A   */%0A  int FLAG_PLAY_CLEAR_SAMPLES_WITHOUT_KEYS = 1;
 %0A%0A  
@@ -2802,11 +2802,141 @@
 itData);
+%0A%0A  /** Returns flags that control the handling of DRM protected content. */%0A  @Flags%0A  default int getFlags() %7B%0A    return 0;%0A  %7D
 %0A%7D%0A

Add flags to DrmSessionManager