/**
* Called when the playlist is changed.
* <p>
- * When it's called, you should invalidate previous playback information such as position,
- * player state, current item, etc.
+ * If the previously playing media item is gone, you should invalidate previous playback
+ * information and wait for later callbacks.
*
* @param controller the controller for this event
* @param playlist A new playlist set by the session.
+ * @see #onPositionChanged(long, long)
+ * @see #onBufferedPositionChanged(long)
+ * @see #onCurrentPlaylistItemChanged(MediaItem2)
*/
- // TODO(jaewan): Enhance doc
public void onPlaylistChanged(@NonNull MediaController2 controller,
@NonNull List<MediaItem2> playlist) { }
* @param state latest playback state
* @hide
*/
- // TODo(jaewan): Remove
+ // TODO(jaewan): Remove (b/73971431)
public void onPlaybackStateChanged(@NonNull MediaController2 controller,
@NonNull PlaybackState2 state) { }
/**
* Called when the player's current playing item is changed
+ * <p>
+ * When it's called, you should invalidate previous playback information and wait for later
+ * callbacks.
*
* @param controller the controller for this event
* @param item new item
+ * @see #onPositionChanged(long, long)
+ * @see #onBufferedPositionChanged(long)
+ * @see #onCurrentPlaylistItemChanged(MediaItem2)
*/
public void onCurrentPlaylistItemChanged(@NonNull MediaController2 controller,
@NonNull MediaItem2 item) { }
* @param executor executor to run callbacks on.
* @param callback controller callback to receive changes in
*/
- // TODO(jaewan): Put @CallbackExecutor to the constructor.
public MediaController2(@NonNull Context context, @NonNull SessionToken2 token,
@NonNull @CallbackExecutor Executor executor, @NonNull ControllerCallback callback) {
super();
* Set the playback speed.
*/
public void setPlaybackSpeed(float speed) {
- // TODO: implement this
+ // TODO(jaewan): implement this (b/74093080)
}
/**
public class MediaSession2 implements AutoCloseable, MediaPlaylistController {
private final MediaSession2Provider mProvider;
- // TODO(jaewan): Should we define IntDef? Currently we don't have to allow subclass to add more.
- // TODO(jaewan): Shouldn't we pull out?
- // TODO(jaewan): Should we also protect getters not related with metadata?
- // Getters are getPlaybackState(), getSessionActivity(), getPlaylistParams()
// Next ID: 23
/**
* Command code for the custom command which can be defined by string action in the
* If {@link #getCommandCode()} is {@link #COMMAND_CODE_CUSTOM}), it's custom command and
* {@link #getCustomCommand()} shouldn't be {@code null}.
*/
- // TODO(jaewan): Move this into the updatable.
public static final class Command {
private final CommandProvider mProvider;
}
public List<Command> getCommands() {
- // TODO: implement this
- return null;
+ return mProvider.getCommands_impl();
}
/**
* If it's not set, the session will accept all controllers and all incoming commands by
* default.
*/
- // TODO(jaewan): Can we move this inside of the updatable for default implementation.
+ // TODO(jaewan): Move this to updatable for default implementation (b/74091963)
public static abstract class SessionCallback {
private final Context mContext;
* @param controller controller information.
* @return allowed commands. Can be {@code null} to reject coonnection.
*/
- // TODO(jaewan): Change return type. Once we do, null is for reject.
public @Nullable CommandGroup onConnect(@NonNull MediaSession2 session,
@NonNull ControllerInfo controller) {
CommandGroup commands = new CommandGroup(mContext);
* @param player a {@link MediaPlayerBase} that handles actual media playback in your app.
*/
U setPlayer(@NonNull MediaPlayerBase player) {
- // TODO: Change the provider properly
+ // TODO(jaewan): Change the provider properly (b/74093082)
mProvider.setPlayer_impl(player, null, null);
return (U) this;
}
* {@code player.}
*/
U setPlaylistController(@NonNull MediaPlaylistController mplc) {
- // TODO: implement this
+ // TODO(jaewan): implement this (b/74093082)
return (U) this;
}
* @param volumeProvider The provider that will receive volume button events.
*/
U setVolumeProvider(@NonNull VolumeProvider2 volumeProvider) {
- // TODO: implement this
+ // TODO(jaewan): implement this (b/74093082)
return (U) this;
}
/**
* @hide
*/
- // TODO(jaewan): Also accept componentName to check notificaiton listener.
public ControllerInfo(Context context, int uid, int pid, String packageName,
IInterface callback) {
mProvider = ApiLoader.getProvider(context)
@Override
public boolean equals(Object obj) {
- if (!(obj instanceof ControllerInfo)) {
- return false;
- }
- ControllerInfo other = (ControllerInfo) obj;
- return mProvider.equals_impl(other.mProvider);
+ return mProvider.equals_impl(obj);
}
@Override
public String toString() {
- // TODO(jaewan): Move this to updatable.
- return "ControllerInfo {pkg=" + getPackageName() + ", uid=" + getUid() + ", trusted="
- + isTrusted() + "}";
+ return mProvider.toString_impl();
}
}
*
* @param player a {@link MediaPlayerBase} that handles actual media playback in your app.
* @param mplc a {@link MediaPlaylistController} that manages playlist of the
- * {@code player.}
+ * {@code player}
* @param volumeProvider The provider that will receive volume button events. If
* {@code null}, system will adjust the appropriate stream volume for this session's player.
*/
public void updatePlayer(@NonNull MediaPlayerBase player,
- @Nullable MediaPlaylistController mplc, @NonNull VolumeProvider2 volumeProvider) {
- // TODO: rename setPlayer_impl to updatePlayer_impl
- mProvider.setPlayer_impl(player, mplc, volumeProvider);
+ @Nullable MediaPlaylistController mplc, @Nullable VolumeProvider2 volumeProvider) {
+ mProvider.updatePlayer_impl(player, mplc, volumeProvider);
}
@Override
/**
* @return playlist controller
*/
- public @Nullable
- MediaPlaylistController getMediaPlaylistController() {
- // TODO: implement this
+ public @Nullable MediaPlaylistController getMediaPlaylistController() {
+ // TODO(jaewan): implement this (b/74090741)
return null;
}
/**
* @return volume provider
*/
- public @Nullable
- VolumeProvider2 getVolumeProvider() {
- // TODO: implement this
- return null;
+ public @Nullable VolumeProvider2 getVolumeProvider() {
+ return mProvider.getVolumeProvider_impl();
}
/**
* @param afr the full request parameters
*/
public void setAudioFocusRequest(AudioFocusRequest afr) {
- // TODO: implement this
+ // TODO(jaewan): implement this (b/72529899)
// mProvider.setAudioFocusRequest_impl(focusGain);
}
*
* @throws IllegalArgumentException if the play list is null
*/
- // TODO(jaewan): Remove with index was previously rejected by council (b/36524925)
- // TODO(jaewan): Should we also add movePlaylistItem from index to index?
public void removePlaylistItem(MediaItem2 item) {
mProvider.removePlaylistItem_impl(item);
}
* @throws IllegalArgumentException if executor or callback is {@code null}.
* @hide
*/
- // TODO(jaewan): Unhide or remove
+ // TODO(jaewan): Remove (b/74157064)
public void registerPlayerEventCallback(@NonNull @CallbackExecutor Executor executor,
@NonNull PlayerEventCallback callback) {
mProvider.registerPlayerEventCallback_impl(executor, callback);
* @throws IllegalArgumentException if the callback is {@code null}.
* @hide
*/
- // TODO(jaewan): Unhide or remove
+ // TODO(jaewan): Remove (b/74157064)
public void unregisterPlayerEventCallback(@NonNull PlayerEventCallback callback) {
mProvider.unregisterPlayerEventCallback_impl(callback);
}
* @return speed
*/
public float getPlaybackSpeed() {
- // TODO: implement this
+ // TODO(jaewan): implement this (b/74093080)
return -1;
}
* Set the playback speed.
*/
public void setPlaybackSpeed(float speed) {
- // TODO: implement this
+ // TODO(jaewan): implement this (b/74093080)
}
}