Commit a1f06987 by olly Committed by Ian Baker

Replace non-inclusively named constant

Issue: #7565
PiperOrigin-RevId: 353649187
parent b0258e71
Showing with 63 additions and 51 deletions
......@@ -152,7 +152,7 @@ public final class MainActivity extends Activity {
.setUuidAndExoMediaDrmProvider(drmSchemeUuid, FrameworkMediaDrm.DEFAULT_PROVIDER)
.build(drmCallback);
} else {
drmSessionManager = DrmSessionManager.getDummyDrmSessionManager();
drmSessionManager = DrmSessionManager.DRM_UNSUPPORTED;
}
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this);
......
......@@ -197,7 +197,7 @@ public final class MainActivity extends Activity {
.setUuidAndExoMediaDrmProvider(drmSchemeUuid, FrameworkMediaDrm.DEFAULT_PROVIDER)
.build(drmCallback);
} else {
drmSessionManager = DrmSessionManager.getDummyDrmSessionManager();
drmSessionManager = DrmSessionManager.DRM_UNSUPPORTED;
}
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this);
......
......@@ -64,7 +64,7 @@ public final class DefaultDrmSessionManagerProvider implements DrmSessionManager
@Nullable
MediaItem.DrmConfiguration drmConfiguration = mediaItem.playbackProperties.drmConfiguration;
if (drmConfiguration == null || Util.SDK_INT < 18) {
return DrmSessionManager.getDummyDrmSessionManager();
return DrmSessionManager.DRM_UNSUPPORTED;
}
HttpDataSource.Factory dataSourceFactory =
drmHttpDataSourceFactory != null
......
......@@ -22,13 +22,8 @@ import com.google.android.exoplayer2.Format;
/** Manages a DRM session. */
public interface DrmSessionManager {
/** Returns {@link #DUMMY}. */
static DrmSessionManager getDummyDrmSessionManager() {
return DUMMY;
}
/** {@link DrmSessionManager} that supports no DRM schemes. */
DrmSessionManager DUMMY =
/** An instance that supports no DRM schemes. */
DrmSessionManager DRM_UNSUPPORTED =
new DrmSessionManager() {
@Override
......@@ -55,6 +50,23 @@ public interface DrmSessionManager {
};
/**
* An instance that supports no DRM schemes.
*
* @deprecated Use {@link #DRM_UNSUPPORTED}.
*/
@Deprecated DrmSessionManager DUMMY = DRM_UNSUPPORTED;
/**
* Returns {@link #DRM_UNSUPPORTED}.
*
* @deprecated Use {@link #DRM_UNSUPPORTED}.
*/
@Deprecated
static DrmSessionManager getDummyDrmSessionManager() {
return DRM_UNSUPPORTED;
}
/**
* Acquires any required resources.
*
* <p>{@link #release()} must be called to ensure the acquired resources are released. After
......
......@@ -337,7 +337,7 @@ public final class ExtractorMediaSource extends CompositeMediaSource<Void> {
.build(),
dataSourceFactory,
extractorsFactory,
DrmSessionManager.getDummyDrmSessionManager(),
DrmSessionManager.DRM_UNSUPPORTED,
loadableLoadErrorHandlingPolicy,
continueLoadingCheckIntervalBytes);
}
......
......@@ -7613,7 +7613,7 @@ public final class ExoPlayerTest {
FakeMediaSource firstMediaSource =
new FakeMediaSource(
/* timeline= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
(unusedFormat, unusedMediaPeriodId) ->
ImmutableList.of(
oneByteSample(firstSampleTimeUs, C.BUFFER_FLAG_KEY_FRAME), END_OF_STREAM_ITEM),
......@@ -7621,7 +7621,7 @@ public final class ExoPlayerTest {
FakeMediaSource secondMediaSource =
new FakeMediaSource(
timelineWithOffsets,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
(unusedFormat, unusedMediaPeriodId) ->
ImmutableList.of(
oneByteSample(firstSampleTimeUs, C.BUFFER_FLAG_KEY_FRAME), END_OF_STREAM_ITEM),
......@@ -8155,7 +8155,7 @@ public final class ExoPlayerTest {
allocator,
/* singleSampleTimeUs= */ 0,
mediaSourceEventDispatcher,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
drmEventDispatcher,
/* deferOnPrepared= */ true) {
@Override
......
......@@ -1005,7 +1005,7 @@ public final class AnalyticsCollectorTest {
FakeMediaSource fakeMediaSource =
new FakeMediaSource(
adTimeline,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
(unusedFormat, mediaPeriodId) -> {
if (mediaPeriodId.isAd()) {
return ImmutableList.of(
......@@ -1265,7 +1265,7 @@ public final class AnalyticsCollectorTest {
FakeMediaSource fakeMediaSource =
new FakeMediaSource(
adTimeline,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
(unusedFormat, mediaPeriodId) -> {
if (mediaPeriodId.isAd()) {
return ImmutableList.of(
......
......@@ -107,7 +107,7 @@ public class DecoderAudioRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
FORMAT,
ImmutableList.of(END_OF_STREAM_ITEM));
......
......@@ -121,7 +121,7 @@ public class MediaCodecAudioRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ AUDIO_AAC,
ImmutableList.of(
......@@ -178,7 +178,7 @@ public class MediaCodecAudioRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ AUDIO_AAC,
ImmutableList.of(
......@@ -256,7 +256,7 @@ public class MediaCodecAudioRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ AUDIO_AAC,
ImmutableList.of(
......
......@@ -151,7 +151,7 @@ public class MetadataRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
EMSG_FORMAT,
ImmutableList.of(
......
......@@ -35,7 +35,7 @@ public class DefaultDrmSessionManagerProviderTest {
DrmSessionManager drmSessionManager =
new DefaultDrmSessionManagerProvider().get(MediaItem.fromUri(Uri.EMPTY));
assertThat(drmSessionManager).isEqualTo(DrmSessionManager.DUMMY);
assertThat(drmSessionManager).isEqualTo(DrmSessionManager.DRM_UNSUPPORTED);
}
@Test
......@@ -49,6 +49,6 @@ public class DefaultDrmSessionManagerProviderTest {
DrmSessionManager drmSessionManager = new DefaultDrmSessionManagerProvider().get(mediaItem);
assertThat(drmSessionManager).isNotEqualTo(DrmSessionManager.DUMMY);
assertThat(drmSessionManager).isNotEqualTo(DrmSessionManager.DRM_UNSUPPORTED);
}
}
......@@ -212,7 +212,7 @@ public final class MergingMediaPeriodTest {
new DefaultAllocator(/* trimOnReset= */ false, /* individualAllocationSize= */ 1024),
trackDataFactory,
mediaSourceEventDispatcher,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* deferOnPrepared= */ false);
selectTracksPositionUs = C.TIME_UNSET;
......
......@@ -49,7 +49,7 @@ public final class ProgressiveMediaPeriodTest {
Uri.parse("asset://android_asset/media/mp4/sample.mp4"),
new AssetDataSource(ApplicationProvider.getApplicationContext()),
() -> new Extractor[] {new Mp4Extractor()},
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher()
.withParameters(/* windowIndex= */ 0, mediaPeriodId),
new DefaultLoadErrorHandlingPolicy(),
......
......@@ -187,7 +187,7 @@ public final class DecoderVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ H264_FORMAT,
ImmutableList.of(oneByteSample(/* timeUs= */ 0, C.BUFFER_FLAG_KEY_FRAME)));
......@@ -218,7 +218,7 @@ public final class DecoderVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ H264_FORMAT,
ImmutableList.of(oneByteSample(/* timeUs= */ 0, C.BUFFER_FLAG_KEY_FRAME)));
......@@ -248,7 +248,7 @@ public final class DecoderVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ H264_FORMAT,
ImmutableList.of(oneByteSample(/* timeUs= */ 0, C.BUFFER_FLAG_KEY_FRAME)));
......@@ -281,7 +281,7 @@ public final class DecoderVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ H264_FORMAT,
ImmutableList.of(
......@@ -291,7 +291,7 @@ public final class DecoderVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ H264_FORMAT,
ImmutableList.of(oneByteSample(/* timeUs= */ 0), END_OF_STREAM_ITEM));
......@@ -333,7 +333,7 @@ public final class DecoderVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ H264_FORMAT,
ImmutableList.of(
......@@ -343,7 +343,7 @@ public final class DecoderVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ H264_FORMAT,
ImmutableList.of(oneByteSample(/* timeUs= */ 0), END_OF_STREAM_ITEM));
......
......@@ -128,7 +128,7 @@ public class MediaCodecVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ VIDEO_H264,
ImmutableList.of(
......@@ -167,7 +167,7 @@ public class MediaCodecVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ VIDEO_H264,
ImmutableList.of(
......@@ -212,7 +212,7 @@ public class MediaCodecVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ pAsp1,
ImmutableList.of(oneByteSample(/* timeUs= */ 0, C.BUFFER_FLAG_KEY_FRAME)));
......@@ -264,7 +264,7 @@ public class MediaCodecVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ VIDEO_H264,
ImmutableList.of(oneByteSample(/* timeUs= */ 0, C.BUFFER_FLAG_KEY_FRAME)));
......@@ -303,7 +303,7 @@ public class MediaCodecVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ VIDEO_H264,
ImmutableList.of(oneByteSample(/* timeUs= */ 0, C.BUFFER_FLAG_KEY_FRAME)));
......@@ -333,7 +333,7 @@ public class MediaCodecVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ VIDEO_H264,
ImmutableList.of(oneByteSample(/* timeUs= */ 0, C.BUFFER_FLAG_KEY_FRAME)));
......@@ -362,7 +362,7 @@ public class MediaCodecVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ VIDEO_H264,
ImmutableList.of(oneByteSample(/* timeUs= */ 0, C.BUFFER_FLAG_KEY_FRAME)));
......@@ -393,7 +393,7 @@ public class MediaCodecVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ VIDEO_H264,
ImmutableList.of(
......@@ -403,7 +403,7 @@ public class MediaCodecVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ VIDEO_H264,
ImmutableList.of(
......@@ -447,7 +447,7 @@ public class MediaCodecVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ VIDEO_H264,
ImmutableList.of(
......@@ -457,7 +457,7 @@ public class MediaCodecVideoRendererTest {
new FakeSampleStream(
new DefaultAllocator(/* trimOnReset= */ true, /* individualAllocationSize= */ 1024),
/* mediaSourceEventDispatcher= */ null,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* initialFormat= */ VIDEO_H264,
ImmutableList.of(
......
......@@ -201,7 +201,7 @@ public final class DashMediaPeriodTest {
periodIndex,
mock(DashChunkSource.Factory.class),
mock(TransferListener.class),
DrmSessionManager.getDummyDrmSessionManager(),
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher()
.withParameters(/* windowIndex= */ 0, mediaPeriodId),
mock(LoadErrorHandlingPolicy.class),
......
......@@ -42,6 +42,6 @@ public final class DownloadHelperTest {
DownloadHelper.DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_CONTEXT,
(handler, videoListener, audioListener, text, metadata) -> new Renderer[0],
new FakeDataSource.Factory(),
/* drmSessionManager= */ DrmSessionManager.getDummyDrmSessionManager());
/* drmSessionManager= */ DrmSessionManager.DRM_UNSUPPORTED);
}
}
......@@ -260,7 +260,7 @@ import java.util.List;
@Override
protected DrmSessionManager buildDrmSessionManager() {
if (widevineLicenseUrl == null) {
return DrmSessionManager.getDummyDrmSessionManager();
return DrmSessionManager.DRM_UNSUPPORTED;
}
MediaDrmCallback drmCallback =
new HttpMediaDrmCallback(widevineLicenseUrl, new DefaultHttpDataSourceFactory());
......
......@@ -227,7 +227,7 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
protected DrmSessionManager buildDrmSessionManager() {
// Do nothing. Interested subclasses may override.
return DrmSessionManager.getDummyDrmSessionManager();
return DrmSessionManager.DRM_UNSUPPORTED;
}
protected DefaultTrackSelector buildTrackSelector(HostActivity host) {
......
......@@ -175,7 +175,7 @@ public class FakeAdaptiveMediaPeriod
/* callback= */ this,
allocator,
positionUs,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
new DefaultLoadErrorHandlingPolicy(/* minimumLoadableRetryCount= */ 3),
mediaSourceEventDispatcher);
......
......@@ -42,7 +42,7 @@ public class FakeAdaptiveMediaSource extends FakeMediaSource {
FakeChunkSource.Factory chunkSourceFactory) {
super(
timeline,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
/* trackDataFactory= */ (unusedFormat, unusedMediaPeriodId) -> {
throw new RuntimeException("Unused TrackDataFactory");
},
......
......@@ -116,7 +116,7 @@ public class FakeMediaPeriod implements MediaPeriod {
allocator,
TrackDataFactory.singleSampleWithTimeUs(singleSampleTimeUs),
mediaSourceEventDispatcher,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* deferOnPrepared */ false);
}
......
......@@ -104,7 +104,7 @@ public class FakeMediaSource extends BaseMediaSource {
* can be manually set later using {@link #setNewSourceInfo(Timeline)}.
*/
public FakeMediaSource(@Nullable Timeline timeline, Format... formats) {
this(timeline, DrmSessionManager.DUMMY, formats);
this(timeline, DrmSessionManager.DRM_UNSUPPORTED, formats);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment