mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Merge pull request #2114 from MGaetan89:remove_player_deprecated_next_methods
PiperOrigin-RevId: 731651706
This commit is contained in:
commit
c1a269b79f
@ -81,6 +81,14 @@
|
||||
`SegmentDownloader(MediaItem, Parser<M>, CacheDataSource.Factory,
|
||||
Executor)` and the corresponding constructors in its subclasses
|
||||
`DashDownloader`, `HlsDownloader` and `SsDownloader`.
|
||||
* Removed deprecated `Player.hasNext()`, `Player.hasNextWindow()`. Use
|
||||
`Player.hasNextMediaItem()` instead.
|
||||
* Removed deprecated `Player.next()`. Use `Player.seekToNextMediaItem()`
|
||||
instead.
|
||||
* Removed deprecated `Player.seekToPreviousWindow()`. Use
|
||||
`Player.seekToPreviousMediaItem()` instead.
|
||||
* Removed deprecated `Player.seekToNextWindow()`. Use
|
||||
`Player.seekToNextMediaItem()` instead.
|
||||
|
||||
## 1.6
|
||||
|
||||
|
@ -151,15 +151,6 @@ public abstract class BasePlayer implements Player {
|
||||
return getPreviousMediaItemIndex() != C.INDEX_UNSET;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #seekToPreviousMediaItem()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public final void seekToPreviousWindow() {
|
||||
seekToPreviousMediaItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void seekToPreviousMediaItem() {
|
||||
seekToPreviousMediaItemInternal(Player.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM);
|
||||
@ -186,47 +177,11 @@ public abstract class BasePlayer implements Player {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #hasNextMediaItem()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public final boolean hasNext() {
|
||||
return hasNextMediaItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #hasNextMediaItem()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public final boolean hasNextWindow() {
|
||||
return hasNextMediaItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean hasNextMediaItem() {
|
||||
return getNextMediaItemIndex() != C.INDEX_UNSET;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #seekToNextMediaItem()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public final void next() {
|
||||
seekToNextMediaItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #seekToNextMediaItem()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public final void seekToNextWindow() {
|
||||
seekToNextMediaItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void seekToNextMediaItem() {
|
||||
seekToNextMediaItemInternal(Player.COMMAND_SEEK_TO_NEXT_MEDIA_ITEM);
|
||||
|
@ -352,18 +352,6 @@ public class ForwardingPlayer implements Player {
|
||||
return player.hasPreviousMediaItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls {@link Player#seekToPreviousWindow()} on the delegate.
|
||||
*
|
||||
* @deprecated Use {@link #seekToPreviousMediaItem()} instead.
|
||||
*/
|
||||
@SuppressWarnings("deprecation") // Forwarding to deprecated method
|
||||
@Deprecated
|
||||
@Override
|
||||
public void seekToPreviousWindow() {
|
||||
player.seekToPreviousWindow();
|
||||
}
|
||||
|
||||
/** Calls {@link Player#seekToPreviousMediaItem()} on the delegate. */
|
||||
@Override
|
||||
public void seekToPreviousMediaItem() {
|
||||
@ -382,60 +370,12 @@ public class ForwardingPlayer implements Player {
|
||||
return player.getMaxSeekToPreviousPosition();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls {@link Player#hasNext()} on the delegate and returns the result.
|
||||
*
|
||||
* @deprecated Use {@link #hasNextMediaItem()} instead.
|
||||
*/
|
||||
@SuppressWarnings("deprecation") // Forwarding to deprecated method
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return player.hasNext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls {@link Player#hasNextWindow()} on the delegate and returns the result.
|
||||
*
|
||||
* @deprecated Use {@link #hasNextMediaItem()} instead.
|
||||
*/
|
||||
@SuppressWarnings("deprecation") // Forwarding to deprecated method
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean hasNextWindow() {
|
||||
return player.hasNextWindow();
|
||||
}
|
||||
|
||||
/** Calls {@link Player#hasNextMediaItem()} on the delegate and returns the result. */
|
||||
@Override
|
||||
public boolean hasNextMediaItem() {
|
||||
return player.hasNextMediaItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls {@link Player#next()} on the delegate.
|
||||
*
|
||||
* @deprecated Use {@link #seekToNextMediaItem()} instead.
|
||||
*/
|
||||
@SuppressWarnings("deprecation") // Forwarding to deprecated method
|
||||
@Deprecated
|
||||
@Override
|
||||
public void next() {
|
||||
player.next();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls {@link Player#seekToNextWindow()} on the delegate.
|
||||
*
|
||||
* @deprecated Use {@link #seekToNextMediaItem()} instead.
|
||||
*/
|
||||
@SuppressWarnings("deprecation") // Forwarding to deprecated method
|
||||
@Deprecated
|
||||
@Override
|
||||
public void seekToNextWindow() {
|
||||
player.seekToNextWindow();
|
||||
}
|
||||
|
||||
/** Calls {@link Player#seekToNextMediaItem()} on the delegate. */
|
||||
@Override
|
||||
public void seekToNextMediaItem() {
|
||||
|
@ -2648,13 +2648,6 @@ public interface Player {
|
||||
*/
|
||||
boolean hasPreviousMediaItem();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #seekToPreviousMediaItem()} instead.
|
||||
*/
|
||||
@UnstableApi
|
||||
@Deprecated
|
||||
void seekToPreviousWindow();
|
||||
|
||||
/**
|
||||
* Seeks to the default position of the previous {@link MediaItem}, which may depend on the
|
||||
* current repeat mode and whether shuffle mode is enabled. Does nothing if {@link
|
||||
@ -2703,20 +2696,6 @@ public interface Player {
|
||||
*/
|
||||
void seekToPrevious();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #hasNextMediaItem()} instead.
|
||||
*/
|
||||
@UnstableApi
|
||||
@Deprecated
|
||||
boolean hasNext();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #hasNextMediaItem()} instead.
|
||||
*/
|
||||
@UnstableApi
|
||||
@Deprecated
|
||||
boolean hasNextWindow();
|
||||
|
||||
/**
|
||||
* Returns whether a next {@link MediaItem} exists, which may depend on the current repeat mode
|
||||
* and whether shuffle mode is enabled.
|
||||
@ -2730,20 +2709,6 @@ public interface Player {
|
||||
*/
|
||||
boolean hasNextMediaItem();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #seekToNextMediaItem()} instead.
|
||||
*/
|
||||
@UnstableApi
|
||||
@Deprecated
|
||||
void next();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #seekToNextMediaItem()} instead.
|
||||
*/
|
||||
@UnstableApi
|
||||
@Deprecated
|
||||
void seekToNextWindow();
|
||||
|
||||
/**
|
||||
* Seeks to the default position of the next {@link MediaItem}, which may depend on the current
|
||||
* repeat mode and whether shuffle mode is enabled. Does nothing if {@link #hasNextMediaItem()} is
|
||||
|
@ -30,12 +30,13 @@ public class PlayerTest {
|
||||
/**
|
||||
* This test picks a method on the {@link Player} interface that is known will never be
|
||||
* stabilised, and asserts that it is required to be implemented (therefore enforcing that {@link
|
||||
* Player} is unstable-for-implementors). If this test fails because the {@link Player#next()}
|
||||
* method is removed, it should be replaced with an equivalent unstable, unimplemented method.
|
||||
* Player} is unstable-for-implementors). If this test fails because the {@link
|
||||
* Player#getCurrentWindowIndex()} method is removed, it should be replaced with an equivalent
|
||||
* unstable, unimplemented method.
|
||||
*/
|
||||
@Test
|
||||
public void testAtLeastOneUnstableUnimplementedMethodExists() throws Exception {
|
||||
Method nextMethod = Player.class.getMethod("next");
|
||||
assertThat(nextMethod.isDefault()).isFalse();
|
||||
Method getCurrentWindowIndexMethod = Player.class.getMethod("getCurrentWindowIndex");
|
||||
assertThat(getCurrentWindowIndexMethod.isDefault()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@ -1537,26 +1537,6 @@ public class MediaController implements Player {
|
||||
return isConnected() ? impl.getNextMediaItemIndex() : C.INDEX_UNSET;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #hasNextMediaItem()} instead.
|
||||
*/
|
||||
@UnstableApi
|
||||
@Deprecated
|
||||
@Override
|
||||
public final boolean hasNext() {
|
||||
return hasNextMediaItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #hasNextMediaItem()} instead.
|
||||
*/
|
||||
@UnstableApi
|
||||
@Deprecated
|
||||
@Override
|
||||
public final boolean hasNextWindow() {
|
||||
return hasNextMediaItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean hasPreviousMediaItem() {
|
||||
verifyApplicationThread();
|
||||
@ -1569,26 +1549,6 @@ public class MediaController implements Player {
|
||||
return isConnected() && impl.hasNextMediaItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #seekToNextMediaItem()} instead.
|
||||
*/
|
||||
@UnstableApi
|
||||
@Deprecated
|
||||
@Override
|
||||
public final void next() {
|
||||
seekToNextMediaItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #seekToPreviousMediaItem()} instead.
|
||||
*/
|
||||
@UnstableApi
|
||||
@Deprecated
|
||||
@Override
|
||||
public final void seekToPreviousWindow() {
|
||||
seekToPreviousMediaItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
@ -1605,16 +1565,6 @@ public class MediaController implements Player {
|
||||
impl.seekToPreviousMediaItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #seekToNextMediaItem()} instead.
|
||||
*/
|
||||
@UnstableApi
|
||||
@Deprecated
|
||||
@Override
|
||||
public final void seekToNextWindow() {
|
||||
seekToNextMediaItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
|
@ -618,22 +618,6 @@ import java.util.List;
|
||||
super.replaceMediaItems(fromIndex, toIndex, mediaItems);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Forwarding deprecated call
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
verifyApplicationThread();
|
||||
return super.hasNext();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Forwarding deprecated call
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean hasNextWindow() {
|
||||
verifyApplicationThread();
|
||||
return super.hasNextWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPreviousMediaItem() {
|
||||
verifyApplicationThread();
|
||||
@ -646,30 +630,6 @@ import java.util.List;
|
||||
return super.hasNextMediaItem();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Forwarding deprecated call
|
||||
@Deprecated
|
||||
@Override
|
||||
public void next() {
|
||||
verifyApplicationThread();
|
||||
super.next();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Forwarding deprecated call
|
||||
@Deprecated
|
||||
@Override
|
||||
public void seekToPreviousWindow() {
|
||||
verifyApplicationThread();
|
||||
super.seekToPreviousWindow();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Forwarding deprecated call
|
||||
@Deprecated
|
||||
@Override
|
||||
public void seekToNextWindow() {
|
||||
verifyApplicationThread();
|
||||
super.seekToNextWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void seekToPreviousMediaItem() {
|
||||
verifyApplicationThread();
|
||||
|
@ -1081,24 +1081,6 @@ public class MockPlayer implements Player {
|
||||
checkNotNull(conditionVariables.get(METHOD_REPLACE_MEDIA_ITEMS)).open();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #hasNextMediaItem()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #hasNextMediaItem()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean hasNextWindow() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPreviousMediaItem() {
|
||||
throw new UnsupportedOperationException();
|
||||
@ -1109,33 +1091,6 @@ public class MockPlayer implements Player {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #seekToNextMediaItem()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public void next() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #seekToPreviousMediaItem()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public void seekToPreviousWindow() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #seekToNextMediaItem()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public void seekToNextWindow() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void seekToPreviousMediaItem() {
|
||||
checkNotNull(conditionVariables.get(METHOD_SEEK_TO_PREVIOUS_MEDIA_ITEM)).open();
|
||||
|
Loading…
x
Reference in New Issue
Block a user