Merge "MediaSession2: Implement MediaSession2#updatePlayer()" into pi-dev

am: 790a31ee31

Change-Id: I8240c7c4a1ab0e80d9253a728ac8fa33b1b5535c
This commit is contained in:
Jaewan Kim
2018-03-09 07:04:03 +00:00
committed by android-build-merger
2 changed files with 27 additions and 23 deletions

View File

@@ -901,9 +901,8 @@ public class MediaSession2 implements AutoCloseable {
} }
/** /**
* Set the underlying {@link MediaPlayerBase} for this session to dispatch incoming event * Sets the underlying {@link MediaPlayerBase} for this session to dispatch incoming event
* to. * to.
* <p>
* *
* @param player a {@link MediaPlayerBase} that handles actual media playback in your app. * @param player a {@link MediaPlayerBase} that handles actual media playback in your app.
*/ */
@@ -913,21 +912,24 @@ public class MediaSession2 implements AutoCloseable {
} }
/** /**
* Set the {@link MediaPlaylistAgent} for this session to manages playlist of the * Sets the {@link MediaPlaylistAgent} for this session to manages playlist of the
* underlying {@link MediaPlayerBase player}. * underlying {@link MediaPlayerBase}. The playlist agent should manage
* {@link MediaPlayerBase} for calling {@link MediaPlayerBase#setNextDataSources(List)}.
* <p>
* If the {@link MediaPlaylistAgent} isn't set, session will create the default playlist
* agent.
* *
* @param playlistAgent a {@link MediaPlaylistAgent} that manages playlist of the * @param playlistAgent a {@link MediaPlaylistAgent} that manages playlist of the
* {@code player} * {@code player}
*/ */
U setPlaylistAgent(@NonNull MediaPlaylistAgent playlistAgent) { U setPlaylistAgent(@NonNull MediaPlaylistAgent playlistAgent) {
// TODO(jaewan): fix this
mProvider.setPlaylistAgent_impl(playlistAgent); mProvider.setPlaylistAgent_impl(playlistAgent);
return (U) this; return (U) this;
} }
/** /**
* Set the {@link VolumeProvider2} for this session to receive volume button events. If not * Sets the {@link VolumeProvider2} for this session to handle volume events. If not set,
* set, system will adjust the appropriate stream volume for this session's player. * system will adjust the appropriate stream volume for this session's player.
* *
* @param volumeProvider The provider that will receive volume button events. * @param volumeProvider The provider that will receive volume button events.
*/ */
@@ -1368,15 +1370,19 @@ public class MediaSession2 implements AutoCloseable {
} }
/** /**
* Set the underlying {@link MediaPlayerBase} for this session to dispatch incoming event * Sets the underlying {@link MediaPlayerBase} and {@link MediaPlaylistAgent} for this session
* to. Events from the {@link MediaController2} will be sent directly to the underlying * to dispatch incoming event to.
* player on the {@link Handler} where the session is created on. * <p>
* When a {@link MediaPlaylistAgent} is specified here, the playlist agent should manage
* {@link MediaPlayerBase} for calling {@link MediaPlayerBase#setNextDataSources(List)}.
* <p>
* If the {@link MediaPlaylistAgent} isn't set, session will recreate the default playlist
* agent.
* *
* @param player a {@link MediaPlayerBase} that handles actual media playback in your app. * @param player a {@link MediaPlayerBase} that handles actual media playback in your app
* @param playlistAgent a {@link MediaPlaylistAgent} that manages playlist of the * @param playlistAgent a {@link MediaPlaylistAgent} that manages playlist of the {@code player}
* {@code player} * @param volumeProvider a {@link VolumeProvider2}. If {@code null}, system will adjust the
* @param volumeProvider The provider that will receive volume button events. If * appropriate stream volume for this session's player.
* {@code null}, system will adjust the appropriate stream volume for this session's player.
*/ */
public void updatePlayer(@NonNull MediaPlayerBase player, public void updatePlayer(@NonNull MediaPlayerBase player,
@Nullable MediaPlaylistAgent playlistAgent, @Nullable VolumeProvider2 volumeProvider) { @Nullable MediaPlaylistAgent playlistAgent, @Nullable VolumeProvider2 volumeProvider) {
@@ -1391,18 +1397,15 @@ public class MediaSession2 implements AutoCloseable {
/** /**
* @return player * @return player
*/ */
public @NonNull public @NonNull MediaPlayerBase getPlayer() {
MediaPlayerBase getPlayer() {
return mProvider.getPlayer_impl(); return mProvider.getPlayer_impl();
} }
/** /**
* @return playlist manager * @return playlist agent
*/ */
public @Nullable public @NonNull MediaPlaylistAgent getPlaylistAgent() {
MediaPlaylistAgent getPlaylistAgent() { return mProvider.getPlaylistAgent_impl();
// TODO(jaewan): implement this (b/74090741)
return null;
} }
/** /**

View File

@@ -46,6 +46,7 @@ public interface MediaSession2Provider extends TransportControlProvider {
void updatePlayer_impl(MediaPlayerBase player, MediaPlaylistAgent playlistAgent, void updatePlayer_impl(MediaPlayerBase player, MediaPlaylistAgent playlistAgent,
VolumeProvider2 volumeProvider); VolumeProvider2 volumeProvider);
MediaPlayerBase getPlayer_impl(); MediaPlayerBase getPlayer_impl();
MediaPlaylistAgent getPlaylistAgent_impl();
VolumeProvider2 getVolumeProvider_impl(); VolumeProvider2 getVolumeProvider_impl();
SessionToken2 getToken_impl(); SessionToken2 getToken_impl();
List<ControllerInfo> getConnectedControllers_impl(); List<ControllerInfo> getConnectedControllers_impl();