diff --git a/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastTimeline.java b/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastTimeline.java index 38a7a692b2..edd2a060d2 100644 --- a/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastTimeline.java +++ b/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastTimeline.java @@ -15,10 +15,12 @@ */ package com.google.android.exoplayer2.ext.cast; +import android.net.Uri; import android.util.SparseArray; import android.util.SparseIntArray; import androidx.annotation.Nullable; import com.google.android.exoplayer2.C; +import com.google.android.exoplayer2.MediaItem; import com.google.android.exoplayer2.Timeline; import java.util.Arrays; @@ -126,7 +128,7 @@ import java.util.Arrays; boolean isDynamic = durationUs == C.TIME_UNSET; return window.set( /* uid= */ ids[windowIndex], - /* tag= */ ids[windowIndex], + /* mediaItem= */ new MediaItem.Builder().setUri(Uri.EMPTY).setTag(ids[windowIndex]).build(), /* manifest= */ null, /* presentationStartTimeMs= */ C.TIME_UNSET, /* windowStartTimeMs= */ C.TIME_UNSET, diff --git a/library/core/src/main/java/com/google/android/exoplayer2/Timeline.java b/library/core/src/main/java/com/google/android/exoplayer2/Timeline.java index 7e22671f00..fa062bbbff 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/Timeline.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/Timeline.java @@ -225,44 +225,6 @@ public abstract class Timeline { mediaItem = DUMMY_MEDIA_ITEM; } - /** - * @deprecated Use {@link #set(Object, MediaItem, Object, long, long, long, boolean, boolean, - * boolean, long, long, int, int, long)} instead. - */ - @Deprecated - public Window set( - Object uid, - @Nullable Object tag, - @Nullable Object manifest, - long presentationStartTimeMs, - long windowStartTimeMs, - long elapsedRealtimeEpochOffsetMs, - boolean isSeekable, - boolean isDynamic, - boolean isLive, - long defaultPositionUs, - long durationUs, - int firstPeriodIndex, - int lastPeriodIndex, - long positionInFirstPeriodUs) { - set( - uid, - DUMMY_MEDIA_ITEM.buildUpon().setTag(tag).build(), - manifest, - presentationStartTimeMs, - windowStartTimeMs, - elapsedRealtimeEpochOffsetMs, - isSeekable, - isDynamic, - isLive, - defaultPositionUs, - durationUs, - firstPeriodIndex, - lastPeriodIndex, - positionInFirstPeriodUs); - return this; - } - /** Sets the data held by this window. */ @SuppressWarnings("deprecation") public Window set( diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/SinglePeriodTimeline.java b/library/core/src/main/java/com/google/android/exoplayer2/source/SinglePeriodTimeline.java index c841829c48..a99ceb6951 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/SinglePeriodTimeline.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/SinglePeriodTimeline.java @@ -46,7 +46,6 @@ public final class SinglePeriodTimeline extends Timeline { private final boolean isSeekable; private final boolean isDynamic; private final boolean isLive; - @Nullable private final Object tag; @Nullable private final Object manifest; @Nullable private final MediaItem mediaItem; @@ -208,8 +207,7 @@ public final class SinglePeriodTimeline extends Timeline { isDynamic, isLive, manifest, - MEDIA_ITEM.buildUpon().setTag(tag).build(), - tag); + MEDIA_ITEM.buildUpon().setTag(tag).build()); } /** @@ -248,36 +246,6 @@ public final class SinglePeriodTimeline extends Timeline { boolean isLive, @Nullable Object manifest, MediaItem mediaItem) { - this( - presentationStartTimeMs, - windowStartTimeMs, - elapsedRealtimeEpochOffsetMs, - periodDurationUs, - windowDurationUs, - windowPositionInPeriodUs, - windowDefaultStartPositionUs, - isSeekable, - isDynamic, - isLive, - manifest, - mediaItem, - /* tag= */ null); - } - - private SinglePeriodTimeline( - long presentationStartTimeMs, - long windowStartTimeMs, - long elapsedRealtimeEpochOffsetMs, - long periodDurationUs, - long windowDurationUs, - long windowPositionInPeriodUs, - long windowDefaultStartPositionUs, - boolean isSeekable, - boolean isDynamic, - boolean isLive, - @Nullable Object manifest, - MediaItem mediaItem, - @Nullable Object tag) { this.presentationStartTimeMs = presentationStartTimeMs; this.windowStartTimeMs = windowStartTimeMs; this.elapsedRealtimeEpochOffsetMs = elapsedRealtimeEpochOffsetMs; @@ -290,7 +258,6 @@ public final class SinglePeriodTimeline extends Timeline { this.isLive = isLive; this.manifest = manifest; this.mediaItem = checkNotNull(mediaItem); - this.tag = tag; } @Override @@ -316,24 +283,6 @@ public final class SinglePeriodTimeline extends Timeline { } } } - if (tag != null) { - // Support deprecated constructors. - return window.set( - Window.SINGLE_WINDOW_UID, - tag, - manifest, - presentationStartTimeMs, - windowStartTimeMs, - elapsedRealtimeEpochOffsetMs, - isSeekable, - isDynamic, - isLive, - windowDefaultStartPositionUs, - windowDurationUs, - /* firstPeriodIndex= */ 0, - /* lastPeriodIndex= */ 0, - windowPositionInPeriodUs); - } return window.set( Window.SINGLE_WINDOW_UID, mediaItem, diff --git a/library/core/src/test/java/com/google/android/exoplayer2/TimelineTest.java b/library/core/src/test/java/com/google/android/exoplayer2/TimelineTest.java index 06fb452444..65b0119354 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/TimelineTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/TimelineTest.java @@ -17,7 +17,6 @@ package com.google.android.exoplayer2; import static com.google.common.truth.Truth.assertThat; -import android.net.Uri; import androidx.annotation.Nullable; import androidx.test.ext.junit.runners.AndroidJUnit4; import com.google.android.exoplayer2.testutil.FakeTimeline; @@ -141,38 +140,6 @@ public class TimelineTest { assertThat(window).isEqualTo(otherWindow); } - @SuppressWarnings("deprecation") - @Test - public void windowSet_withTag() { - Object tag = new Object(); - Timeline.Window window = - populateWindow( - new MediaItem.Builder() - .setMediaId("com.google.android.exoplayer2.Timeline") - .setUri(Uri.EMPTY) - .setTag(tag) - .build(), - tag); - Timeline.Window otherWindow = new Timeline.Window(); - otherWindow = - otherWindow.set( - window.uid, - window.tag, - window.manifest, - window.presentationStartTimeMs, - window.windowStartTimeMs, - window.elapsedRealtimeEpochOffsetMs, - window.isSeekable, - window.isDynamic, - window.isLive, - window.defaultPositionUs, - window.durationUs, - window.firstPeriodIndex, - window.lastPeriodIndex, - window.positionInFirstPeriodUs); - assertThat(window).isEqualTo(otherWindow); - } - @Test public void windowHashCode() { Timeline.Window window = new Timeline.Window();