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

Commit 6df7c2c3 authored by Hyundo Moon's avatar Hyundo Moon Committed by android-build-merger
Browse files

MediaSession2: Implement getPlayerState/Position/BufferedPosition am: 78e4f84f

am: 5563e8f5

Change-Id: I79ff65c6e5a70f0bc6a693c9b84ac17d4133380e
parents c9871326 5563e8f5
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -132,8 +132,8 @@ public abstract class MediaPlayerBase implements AutoCloseable {
    public static final long UNKNOWN_TIME = -1;

    /**
     * Returns the current playback head position.
     * @return the current play position in ms, or {@link #UNKNOWN_TIME} if unknown.
     * Gets the current playback head position.
     * @return the current playback position in ms, or {@link #UNKNOWN_TIME} if unknown.
     */
    public long getCurrentPosition() { return UNKNOWN_TIME; }

@@ -144,8 +144,8 @@ public abstract class MediaPlayerBase implements AutoCloseable {
    public long getDuration() { return UNKNOWN_TIME; }

    /**
     * Returns the duration of the current data source, or {@link #UNKNOWN_TIME} if unknown.
     * @return the duration in ms, or {@link #UNKNOWN_TIME}.
     * Gets the buffered position of current playback, or {@link #UNKNOWN_TIME} if unknown.
     * @return the buffered position in ms, or {@link #UNKNOWN_TIME}.
     */
    public long getBufferedPosition() { return UNKNOWN_TIME; }

+11 −13
Original line number Diff line number Diff line
@@ -1465,39 +1465,37 @@ public class MediaSession2 implements AutoCloseable {
    }

    /**
     * Get the player state.
     * Gets the current player state.
     *
     * @return player state
     * @return the current player state
     * @hide
     */
    // TODO(jaewan): Unhide (b/74578458)
    public @PlayerState int getPlayerState() {
        // TODO(jaewan): implement this (b/74578458)
        return PLAYER_STATE_IDLE;
        return mProvider.getPlayerState_impl();
    }

    /**
     * Get the current position.
     * Gets the current position.
     *
     * @return position
     * @return the current playback position in ms, or {@link MediaPlayerBase#UNKNOWN_TIME} if
     *         unknown.
     * @hide
     */
    // TODO(jaewan): Unhide (b/74578458)
    public long getCurrentPosition() {
        // TODO(jaewan): implement this (b/74578458)
        return -1;
    public long getPosition() {
        return mProvider.getPosition_impl();
    }

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

    /**
+3 −0
Original line number Diff line number Diff line
@@ -65,6 +65,9 @@ public interface MediaSession2Provider extends TransportControlProvider {
    void setPlaylist_impl(List<MediaItem2> list, MediaMetadata2 metadata);
    MediaItem2 getCurrentPlaylistItem_impl();
    void notifyError_impl(int errorCode, Bundle extras);
    int getPlayerState_impl();
    long getPosition_impl();
    long getBufferedPosition_impl();

    interface CommandProvider {
        int getCommandCode_impl();