Fix review comments

This commit is contained in:
Ian Baker 2023-09-28 15:54:10 +01:00
parent 8e6d3e7541
commit a1767d349a
4 changed files with 18 additions and 34 deletions

View file

@ -24,7 +24,6 @@ import androidx.media3.common.DrmInitData;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util;
import androidx.media3.decoder.CryptoConfig;
import com.google.common.collect.ImmutableList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -121,17 +120,6 @@ public final class DummyExoMediaDrm implements ExoMediaDrm {
throw new IllegalStateException();
}
@Override
public void removeOfflineLicense(byte[] keySetId) {
// Should not be invoked. No session should exist.
throw new IllegalStateException();
}
@Override
public ImmutableList<byte[]> getOfflineLicenseKeySetIds() {
return ImmutableList.of();
}
@Override
@Nullable
public PersistableBundle getMetrics() {

View file

@ -536,18 +536,26 @@ public interface ExoMediaDrm {
* <p>See {@link MediaDrm#removeOfflineLicense(byte[])} for more details.
*
* @param keySetId The {@code keySetId} of the license to remove.
* @throws UnsupportedOperationException if the implementation doesn't support this method.
*/
void removeOfflineLicense(byte[] keySetId);
default void removeOfflineLicense(byte[] keySetId) {
throw new UnsupportedOperationException();
}
/**
* Returns a list of the {@code keySetIds} for all offline licenses.
*
* <p>This is an optional method, and some implementations may only support it on certain Android
* API levels. If the method is unsupported an empty list is returned.
* API levels.
*
* <p>See {@link MediaDrm#getOfflineLicenseKeySetIds()} for more details.
*
* @return The list of {@code keySetIds} for all offline licenses.
* @throws UnsupportedOperationException if the implementation doesn't support this method.
*/
List<byte[]> getOfflineLicenseKeySetIds();
default List<byte[]> getOfflineLicenseKeySetIds() {
throw new UnsupportedOperationException();
}
/**
* Returns metrics data for this ExoMediaDrm instance, or {@code null} if metrics are unavailable.
@ -609,6 +617,4 @@ public interface ExoMediaDrm {
*/
@C.CryptoType
int getCryptoType();
}

View file

@ -26,7 +26,6 @@ import android.media.MediaDrmException;
import android.media.NotProvisionedException;
import android.media.UnsupportedSchemeException;
import android.media.metrics.LogSessionId;
import android.os.Build;
import android.os.PersistableBundle;
import android.text.TextUtils;
import androidx.annotation.DoNotInline;
@ -44,7 +43,6 @@ import androidx.media3.common.util.Util;
import androidx.media3.exoplayer.analytics.PlayerId;
import androidx.media3.extractor.mp4.PsshAtomUtil;
import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
@ -330,19 +328,21 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
}
@Override
@RequiresApi(Build.VERSION_CODES.Q)
@UnstableApi
@RequiresApi(29)
public void removeOfflineLicense(byte[] keySetId) {
if (Util.SDK_INT < Build.VERSION_CODES.Q) {
if (Util.SDK_INT < 29) {
throw new UnsupportedOperationException();
}
mediaDrm.removeOfflineLicense(keySetId);
}
@Override
@RequiresApi(Build.VERSION_CODES.Q)
@UnstableApi
@RequiresApi(29)
public List<byte[]> getOfflineLicenseKeySetIds() {
if (Util.SDK_INT < Build.VERSION_CODES.Q) {
return ImmutableList.of();
if (Util.SDK_INT < 29) {
throw new UnsupportedOperationException();
}
return mediaDrm.getOfflineLicenseKeySetIds();
}

View file

@ -361,16 +361,6 @@ public final class FakeExoMediaDrm implements ExoMediaDrm {
throw new UnsupportedOperationException();
}
@Override
public void removeOfflineLicense(byte[] keySetId) {
throw new UnsupportedOperationException();
}
@Override
public ImmutableList<byte[]> getOfflineLicenseKeySetIds() {
return ImmutableList.of();
}
@Nullable
@Override
public PersistableBundle getMetrics() {