diff options
6 files changed, 43 insertions, 0 deletions
diff --git a/media/java/android/media/IMediaSession2Callback.aidl b/media/java/android/media/IMediaSession2Callback.aidl index eb02fa7a6bd2..45d40e6cc155 100644 --- a/media/java/android/media/IMediaSession2Callback.aidl +++ b/media/java/android/media/IMediaSession2Callback.aidl @@ -30,6 +30,7 @@ import android.media.IMediaSession2; */ oneway interface IMediaSession2Callback { void onPlaybackStateChanged(in Bundle state); + void onPlaylistParamsChanged(in Bundle params); /** * Called only when the controller is created with service's token. diff --git a/media/java/android/media/MediaController2.java b/media/java/android/media/MediaController2.java index 6064ec4bbccf..e2d5c5de7c42 100644 --- a/media/java/android/media/MediaController2.java +++ b/media/java/android/media/MediaController2.java @@ -138,6 +138,13 @@ public class MediaController2 implements AutoCloseable { * @param state */ public void onPlaybackStateChanged(@NonNull PlaybackState2 state) { } + + /** + * Called when the playlist parameters are changed. + * + * @param params The new play list parameters. + */ + public void onPlaylistParamsChanged(@NonNull PlaylistParams params) { } } /** @@ -359,6 +366,17 @@ public class MediaController2 implements AutoCloseable { } /** + * Sets the {@link PlaylistParams} for the current play list. Repeat/shuffle mode and metadata + * for the list can be set by calling this method. + * + * @param params A {@link PlaylistParams} object to set. + * @throws IllegalArgumentException if given {@param param} is null. + */ + public void setPlaylistParams(PlaylistParams params) { + mProvider.setPlaylistParams_impl(params); + } + + /** * @hide */ public void skipForward() { diff --git a/media/java/android/media/MediaPlayerInterface.java b/media/java/android/media/MediaPlayerInterface.java index 5ff8a581f5f9..8bebed095873 100644 --- a/media/java/android/media/MediaPlayerInterface.java +++ b/media/java/android/media/MediaPlayerInterface.java @@ -52,6 +52,8 @@ public interface MediaPlayerInterface { void setPlaylist(List<MediaItem2> item, PlaylistParams param); void setCurrentPlaylistItem(int index); + void setPlaylistParams(PlaylistParams params); + PlaylistParams getPlaylistParams(); /** * Add a {@link PlaybackListener} to be invoked when the playback state is changed. diff --git a/media/java/android/media/MediaSession2.java b/media/java/android/media/MediaSession2.java index 8c499c873d9b..6d1c3c8a5ab7 100644 --- a/media/java/android/media/MediaSession2.java +++ b/media/java/android/media/MediaSession2.java @@ -1264,4 +1264,23 @@ public class MediaSession2 implements AutoCloseable { public void setPlaylist(@NonNull List<MediaItem2> playlist, @NonNull PlaylistParams param) { mProvider.setPlaylist_impl(playlist, param); } + + /** + * Sets the {@link PlaylistParams} for the current play list. Repeat/shuffle mode and metadata + * for the list can be set by calling this method. + * + * @param params A {@link PlaylistParams} object to set. + * @throws IllegalArgumentException if given {@param param} is null. + */ + public void setPlaylistParams(PlaylistParams params) { + mProvider.setPlaylistParams_impl(params); + } + + /** + * Returns the {@link PlaylistParams} for the current play list. + * Returns {@code null} if not set. + */ + public PlaylistParams getPlaylistParams() { + return mProvider.getPlaylistParams_impl(); + } } diff --git a/media/java/android/media/update/MediaController2Provider.java b/media/java/android/media/update/MediaController2Provider.java index 8dfb892c7306..cf35358c7841 100644 --- a/media/java/android/media/update/MediaController2Provider.java +++ b/media/java/android/media/update/MediaController2Provider.java @@ -61,5 +61,6 @@ public interface MediaController2Provider extends TransportControlProvider { void addPlaylistItem_impl(int index, MediaItem2 item); PlaylistParams getPlaylistParam_impl(); + void setPlaylistParams_impl(PlaylistParams params); PlaybackState2 getPlaybackState_impl(); } diff --git a/media/java/android/media/update/MediaSession2Provider.java b/media/java/android/media/update/MediaSession2Provider.java index d340245c0e81..801bdeb68eef 100644 --- a/media/java/android/media/update/MediaSession2Provider.java +++ b/media/java/android/media/update/MediaSession2Provider.java @@ -51,6 +51,8 @@ public interface MediaSession2Provider extends TransportControlProvider { ResultReceiver receiver); void sendCustomCommand_impl(Command command, Bundle args); void setPlaylist_impl(List<MediaItem2> playlist, PlaylistParams param); + void setPlaylistParams_impl(PlaylistParams params); + PlaylistParams getPlaylistParams_impl(); interface ControllerInfoProvider { String getPackageName_impl(); |