Replace non-inclusively named constant

Issue: #7565
PiperOrigin-RevId: 353649187
This commit is contained in:
olly 2021-01-25 16:11:39 +00:00 committed by Ian Baker
parent b0258e7192
commit a1f06987eb
23 changed files with 63 additions and 51 deletions

View File

@ -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);

View File

@ -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);

View File

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

View File

@ -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
@ -54,6 +49,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.
*

View File

@ -337,7 +337,7 @@ public final class ExtractorMediaSource extends CompositeMediaSource<Void> {
.build(),
dataSourceFactory,
extractorsFactory,
DrmSessionManager.getDummyDrmSessionManager(),
DrmSessionManager.DRM_UNSUPPORTED,
loadableLoadErrorHandlingPolicy,
continueLoadingCheckIntervalBytes);
}

View File

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

View File

@ -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(

View File

@ -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));

View File

@ -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(

View File

@ -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(

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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(),

View File

@ -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));

View File

@ -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(

View File

@ -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),

View File

@ -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);
}
}

View File

@ -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());

View File

@ -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) {

View File

@ -175,7 +175,7 @@ public class FakeAdaptiveMediaPeriod
/* callback= */ this,
allocator,
positionUs,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
new DefaultLoadErrorHandlingPolicy(/* minimumLoadableRetryCount= */ 3),
mediaSourceEventDispatcher);

View File

@ -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");
},

View File

@ -116,7 +116,7 @@ public class FakeMediaPeriod implements MediaPeriod {
allocator,
TrackDataFactory.singleSampleWithTimeUs(singleSampleTimeUs),
mediaSourceEventDispatcher,
DrmSessionManager.DUMMY,
DrmSessionManager.DRM_UNSUPPORTED,
new DrmSessionEventListener.EventDispatcher(),
/* deferOnPrepared */ false);
}

View File

@ -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);
}
/**