Merge "MediaSession2: Implement skipTo APIs" into pi-dev

This commit is contained in:
Jaewan Kim
2018-03-15 10:15:07 +00:00
committed by Android (Google) Code Review
3 changed files with 45 additions and 8 deletions

View File

@@ -836,20 +836,30 @@ public class MediaController2 implements AutoCloseable {
} }
/** /**
* Sets the index of current DataSourceDesc in the play list to be played. * Skips to the item in the playlist.
* <p>
* This calls {@link MediaPlaylistAgent#skipToPlaylistItem(MediaItem2)}.
* *
* @param item the index of DataSourceDesc in the play list you want to play * @param item The item in the playlist you want to play
* @throws IllegalArgumentException if the play list is null
* @throws NullPointerException if index is outside play list range
*/ */
public void skipToPlaylistItem(@NonNull MediaItem2 item) { public void skipToPlaylistItem(@NonNull MediaItem2 item) {
mProvider.skipToPlaylistItem_impl(item); mProvider.skipToPlaylistItem_impl(item);
} }
/**
* Skips to the previous item in the playlist.
* <p>
* This calls {@link MediaPlaylistAgent#skipToPreviousItem()}.
*/
public void skipToPreviousItem() { public void skipToPreviousItem() {
mProvider.skipToPreviousItem_impl(); mProvider.skipToPreviousItem_impl();
} }
/**
* Skips to the next item in the playlist.
* <p>
* This calls {@link MediaPlaylistAgent#skipToNextItem()}.
*/
public void skipToNextItem() { public void skipToNextItem() {
mProvider.skipToNextItem_impl(); mProvider.skipToNextItem_impl();
} }

View File

@@ -266,10 +266,16 @@ public abstract class MediaPlaylistAgent {
mProvider.skipToPlaylistItem_impl(item); mProvider.skipToPlaylistItem_impl(item);
} }
/**
* Skips to the previous item in the playlist.
*/
public void skipToPreviousItem() { public void skipToPreviousItem() {
mProvider.skipToPreviousItem_impl(); mProvider.skipToPreviousItem_impl();
} }
/**
* Skips to the next item in the playlist.
*/
public void skipToNextItem() { public void skipToNextItem() {
mProvider.skipToNextItem_impl(); mProvider.skipToNextItem_impl();
} }

View File

@@ -1779,20 +1779,41 @@ public class MediaSession2 implements AutoCloseable {
} }
/** /**
* Skip to the item in the play list. * Skips to the item in the playlist.
* <p>
* This calls {@link MediaPlaylistAgent#skipToPlaylistItem(MediaItem2)} and the behavior depends
* on the playlist agent implementation, especially with the shuffle/repeat mode.
* *
* @param item item in the play list you want to play * @param item The item in the playlist you want to play
* @throws IllegalArgumentException if the play list is null * @see #getShuffleMode()
* @throws NullPointerException if index is outside play list range * @see #getRepeatMode()
*/ */
public void skipToPlaylistItem(@NonNull MediaItem2 item) { public void skipToPlaylistItem(@NonNull MediaItem2 item) {
mProvider.skipToPlaylistItem_impl(item); mProvider.skipToPlaylistItem_impl(item);
} }
/**
* Skips to the previous item.
* <p>
* This calls {@link MediaPlaylistAgent#skipToPreviousItem()} and the behavior depends on the
* playlist agent implementation, especially with the shuffle/repeat mode.
*
* @see #getShuffleMode()
* @see #getRepeatMode()
**/
public void skipToPreviousItem() { public void skipToPreviousItem() {
mProvider.skipToPreviousItem_impl(); mProvider.skipToPreviousItem_impl();
} }
/**
* Skips to the next item.
* <p>
* This calls {@link MediaPlaylistAgent#skipToNextItem()} and the behavior depends on the
* playlist agent implementation, especially with the shuffle/repeat mode.
*
* @see #getShuffleMode()
* @see #getRepeatMode()
*/
public void skipToNextItem() { public void skipToNextItem() {
mProvider.skipToNextItem_impl(); mProvider.skipToNextItem_impl();
} }