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

Commit 888ccd17 authored by Jaewan Kim's avatar Jaewan Kim
Browse files

MediaSession2: Match APIs with MediaPlayerBase

Bug: 75500592
Test: Build
Change-Id: Ic2cf1fc9a9d11752d84ff6f69905b5983e57d10a
parent 1f654aa2
Loading
Loading
Loading
Loading
+15 −10
Original line number Original line Diff line number Diff line
@@ -16,7 +16,7 @@


package android.media;
package android.media;


import static android.media.MediaPlayerBase.PLAYER_STATE_IDLE;
import static android.media.MediaPlayerBase.BUFFERING_STATE_UNKNOWN;


import android.annotation.CallbackExecutor;
import android.annotation.CallbackExecutor;
import android.annotation.IntDef;
import android.annotation.IntDef;
@@ -26,7 +26,6 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.media.MediaPlayerBase.BuffState;
import android.media.MediaPlayerBase.BuffState;
import android.media.MediaPlayerBase.PlayerEventCallback;
import android.media.MediaPlayerBase.PlayerState;
import android.media.MediaPlayerBase.PlayerState;
import android.media.MediaPlaylistAgent.RepeatMode;
import android.media.MediaPlaylistAgent.RepeatMode;
import android.media.MediaPlaylistAgent.ShuffleMode;
import android.media.MediaPlaylistAgent.ShuffleMode;
@@ -1467,9 +1466,7 @@ public class MediaSession2 implements AutoCloseable {
     * Gets the current player state.
     * Gets the current player state.
     *
     *
     * @return the current player state
     * @return the current player state
     * @hide
     */
     */
    // TODO(jaewan): Unhide (b/74578458)
    public @PlayerState int getPlayerState() {
    public @PlayerState int getPlayerState() {
        return mProvider.getPlayerState_impl();
        return mProvider.getPlayerState_impl();
    }
    }
@@ -1479,24 +1476,32 @@ public class MediaSession2 implements AutoCloseable {
     *
     *
     * @return the current playback position in ms, or {@link MediaPlayerBase#UNKNOWN_TIME} if
     * @return the current playback position in ms, or {@link MediaPlayerBase#UNKNOWN_TIME} if
     *         unknown.
     *         unknown.
     * @hide
     */
     */
    // TODO(jaewan): Unhide (b/74578458)
    public long getCurrentPosition() {
    public long getPosition() {
        return mProvider.getCurrentPosition_impl();
        return mProvider.getPosition_impl();
    }
    }


    /**
    /**
     * Gets the buffered position, or {@link MediaPlayerBase#UNKNOWN_TIME} if unknown.
     * Gets the buffered position, or {@link MediaPlayerBase#UNKNOWN_TIME} if unknown.
     *
     *
     * @return the buffered position in ms, or {@link MediaPlayerBase#UNKNOWN_TIME}.
     * @return the buffered position in ms, or {@link MediaPlayerBase#UNKNOWN_TIME}.
     * @hide
     */
     */
    // TODO(jaewan): Unhide (b/74578458)
    public long getBufferedPosition() {
    public long getBufferedPosition() {
        return mProvider.getBufferedPosition_impl();
        return mProvider.getBufferedPosition_impl();
    }
    }


    /**
     * Gets the current buffering state of the player.
     * During buffering, see {@link #getBufferedPosition()} for the quantifying the amount already
     * buffered.
     *
     * @return the buffering state.
     */
    public @BuffState int getBufferingState() {
        // TODO(jaewan): Implement this
        return BUFFERING_STATE_UNKNOWN;
    }

    /**
    /**
     * Get the playback speed.
     * Get the playback speed.
     *
     *
+1 −1
Original line number Original line Diff line number Diff line
@@ -66,7 +66,7 @@ public interface MediaSession2Provider extends TransportControlProvider {
    MediaItem2 getCurrentPlaylistItem_impl();
    MediaItem2 getCurrentPlaylistItem_impl();
    void notifyError_impl(int errorCode, Bundle extras);
    void notifyError_impl(int errorCode, Bundle extras);
    int getPlayerState_impl();
    int getPlayerState_impl();
    long getPosition_impl();
    long getCurrentPosition_impl();
    long getBufferedPosition_impl();
    long getBufferedPosition_impl();


    interface CommandProvider {
    interface CommandProvider {