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

Commit e851d7c6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "MediaSession2: Use VolumeProvider2 instead of VolumeProvider"

parents ee9d7a99 71bb3176
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -171,6 +171,14 @@ public class MediaController2 implements AutoCloseable {
            mProvider = provider;
        }

        /**
         * @hide
         */
        @SystemApi
        public PlaybackInfoProvider getProvider() {
            return mProvider;
        }

        /**
         * Get the type of playback which affects volume handling. One of:
         * <ul>
@@ -199,9 +207,9 @@ public class MediaController2 implements AutoCloseable {
        /**
         * Get the type of volume control that can be used. One of:
         * <ul>
         * <li>{@link VolumeProvider#VOLUME_CONTROL_ABSOLUTE}</li>
         * <li>{@link VolumeProvider#VOLUME_CONTROL_RELATIVE}</li>
         * <li>{@link VolumeProvider#VOLUME_CONTROL_FIXED}</li>
         * <li>{@link VolumeProvider2#VOLUME_CONTROL_ABSOLUTE}</li>
         * <li>{@link VolumeProvider2#VOLUME_CONTROL_RELATIVE}</li>
         * <li>{@link VolumeProvider2#VOLUME_CONTROL_FIXED}</li>
         * </ul>
         *
         * @return The type of volume control that may be used with this session.
@@ -472,7 +480,7 @@ public class MediaController2 implements AutoCloseable {

    /**
     * Set the volume of the output this session is playing on. The command will be ignored if it
     * does not support {@link VolumeProvider#VOLUME_CONTROL_ABSOLUTE}.
     * does not support {@link VolumeProvider2#VOLUME_CONTROL_ABSOLUTE}.
     * <p>
     * If the session is local playback, this changes the device's volume with the stream that
     * session's player is using. Flags will be specified for the {@link AudioManager}.
@@ -494,8 +502,8 @@ public class MediaController2 implements AutoCloseable {
     * must be one of {@link AudioManager#ADJUST_LOWER},
     * {@link AudioManager#ADJUST_RAISE}, or {@link AudioManager#ADJUST_SAME}.
     * The command will be ignored if the session does not support
     * {@link VolumeProvider#VOLUME_CONTROL_RELATIVE} or
     * {@link VolumeProvider#VOLUME_CONTROL_ABSOLUTE}.
     * {@link VolumeProvider2#VOLUME_CONTROL_RELATIVE} or
     * {@link VolumeProvider2#VOLUME_CONTROL_ABSOLUTE}.
     * <p>
     * If the session is local playback, this changes the device's volume with the stream that
     * session's player is using. Flags will be specified for the {@link AudioManager}.
+6 −6
Original line number Diff line number Diff line
@@ -599,9 +599,9 @@ public class MediaSession2 implements AutoCloseable {
         * <p>
         * Set {@code null} to reset.
         *
         * @param volumeProvider The provider that will handle volume changes. Can be {@code null}
         * @param volumeProvider The provider that will handle volume changes. Can be {@code null}.
         */
        public U setVolumeProvider(@Nullable VolumeProvider volumeProvider) {
        public U setVolumeProvider(@Nullable VolumeProvider2 volumeProvider) {
            mProvider.setVolumeProvider_impl(volumeProvider);
            return (U) this;
        }
@@ -1035,8 +1035,8 @@ public class MediaSession2 implements AutoCloseable {
     * If the new player is successfully set, {@link PlaybackListener}
     * will be called to tell the current playback state of the new player.
     * <p>
     * You can also specify a volume provider. If so, playback in the player is considered as
     * remote playback.
     * For the remote playback case which you want to handle volume by yourself, use
     * {@link #setPlayer(MediaPlayerInterface, VolumeProvider2)}.
     *
     * @param player a {@link MediaPlayerInterface} that handles actual media playback in your app.
     * @throws IllegalArgumentException if the player is {@code null}.
@@ -1051,10 +1051,10 @@ public class MediaSession2 implements AutoCloseable {
     * @param player a {@link MediaPlayerInterface} that handles actual media playback in your app.
     * @param volumeProvider a volume provider
     * @see #setPlayer(MediaPlayerInterface)
     * @see Builder#setVolumeProvider(VolumeProvider)
     * @see Builder#setVolumeProvider(VolumeProvider2)
     */
    public void setPlayer(@NonNull MediaPlayerInterface player,
            @NonNull VolumeProvider volumeProvider) {
            @NonNull VolumeProvider2 volumeProvider) {
        mProvider.setPlayer_impl(player, volumeProvider);
    }

+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ import java.lang.annotation.RetentionPolicy;
 * {@link #setCurrentVolume(int)} each time the volume being provided changes.
 * <p>
 * You can set a volume provider on a session by calling
 * {@link MediaSession2#setPlayer(MediaPlayerInterface, VolumeProvider)}.
 * {@link MediaSession2#setPlayer(MediaPlayerInterface, VolumeProvider2)}.
 *
 * @hide
 */
+3 −3
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import android.media.MediaSession2.ControllerInfo;
import android.media.MediaSession2.PlaylistParams;
import android.media.MediaSession2.SessionCallback;
import android.media.SessionToken2;
import android.media.VolumeProvider;
import android.media.VolumeProvider2;
import android.os.Bundle;
import android.os.ResultReceiver;

@@ -44,7 +44,7 @@ import java.util.concurrent.Executor;
public interface MediaSession2Provider extends TransportControlProvider {
    void close_impl();
    void setPlayer_impl(MediaPlayerInterface player);
    void setPlayer_impl(MediaPlayerInterface player, VolumeProvider volumeProvider);
    void setPlayer_impl(MediaPlayerInterface player, VolumeProvider2 volumeProvider);
    MediaPlayerInterface getPlayer_impl();
    SessionToken2 getToken_impl();
    List<ControllerInfo> getConnectedControllers_impl();
@@ -116,7 +116,7 @@ public interface MediaSession2Provider extends TransportControlProvider {
    }

    interface BuilderBaseProvider<T extends MediaSession2, C extends SessionCallback> {
        void setVolumeProvider_impl(VolumeProvider volumeProvider);
        void setVolumeProvider_impl(VolumeProvider2 volumeProvider);
        void setRatingType_impl(int type);
        void setSessionActivity_impl(PendingIntent pi);
        void setId_impl(String id);