Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a01d80b9 authored by Jaewan Kim's avatar Jaewan Kim Committed by Android (Google) Code Review
Browse files

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

parents d766e212 68c774a1
Loading
Loading
Loading
Loading
+14 −4
Original line number Original line Diff line number Diff line
@@ -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();
    }
    }
+6 −0
Original line number Original line Diff line number Diff line
@@ -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();
    }
    }
+25 −4
Original line number Original line Diff line number Diff line
@@ -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();
    }
    }