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

Commit 3a4a27cf authored by Wei Jia's avatar Wei Jia Committed by android-build-merger
Browse files

Merge "MediaPlayer2: clarify sync/async for API's" into pi-dev

am: 97d579d1

Change-Id: I26d1541c0d016181be09afdb172715fda3dc41dc
parents 044a2e74 97d579d1
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -24371,8 +24371,6 @@ package android.media {
    field public static final int MEDIA_CALL_PAUSE = 4; // 0x4
    field public static final int MEDIA_CALL_PLAY = 5; // 0x5
    field public static final int MEDIA_CALL_PREPARE = 6; // 0x6
    field public static final int MEDIA_CALL_PREPARE_DRM = 7; // 0x7
    field public static final int MEDIA_CALL_PROVIDE_DRM_KEY_RESPONSE = 8; // 0x8
    field public static final int MEDIA_CALL_RELEASE_DRM = 12; // 0xc
    field public static final int MEDIA_CALL_RESTORE_DRM_KEYS = 13; // 0xd
    field public static final int MEDIA_CALL_SEEK_TO = 14; // 0xe
@@ -24381,8 +24379,6 @@ package android.media {
    field public static final int MEDIA_CALL_SET_AUDIO_SESSION_ID = 17; // 0x11
    field public static final int MEDIA_CALL_SET_AUX_EFFECT_SEND_LEVEL = 18; // 0x12
    field public static final int MEDIA_CALL_SET_DATA_SOURCE = 19; // 0x13
    field public static final int MEDIA_CALL_SET_DRM_CONFIG_HELPER = 20; // 0x14
    field public static final int MEDIA_CALL_SET_DRM_PROPERTY_STRING = 21; // 0x15
    field public static final int MEDIA_CALL_SET_NEXT_DATA_SOURCE = 22; // 0x16
    field public static final int MEDIA_CALL_SET_NEXT_DATA_SOURCES = 23; // 0x17
    field public static final int MEDIA_CALL_SET_PLAYBACK_PARAMS = 24; // 0x18
+89 −67
Original line number Diff line number Diff line
@@ -130,22 +130,21 @@ import java.util.concurrent.Executor;
 *         the internal player engine.</li>
 *         <li>IllegalStateException is
 *         thrown to prevent programming errors such as calling
 *         {@link #prepare()}, {@link #setDataSource(DataSourceDesc)}, or
 *         {@code setPlaylist} methods in an invalid state. </li>
 *         {@link #prepare()}, {@link #setDataSource(DataSourceDesc)}
 *         methods in an invalid state. </li>
 *         </ul>
 *         </li>
 *     <li>Calling
 *         {@link #setDataSource(DataSourceDesc)}, or
 *         {@code setPlaylist} transfers a
 *         {@link #setDataSource(DataSourceDesc)} transfers a
 *         MediaPlayer2 object in the <em>Idle</em> state to the
 *         <em>Initialized</em> state.
 *         <ul>
 *         <li>An IllegalStateException is thrown if
 *         setDataSource() or setPlaylist() is called in any other state.</li>
 *         setDataSource() is called in any other state.</li>
 *         <li>It is good programming
 *         practice to always look out for <code>IllegalArgumentException</code>
 *         and <code>IOException</code> that may be thrown from
 *         <code>setDataSource</code> and <code>setPlaylist</code> methods.</li>
 *         <code>setDataSource</code>.</li>
 *         </ul>
 *         </li>
 *     <li>A MediaPlayer2 object must first enter the <em>Prepared</em> state
@@ -258,7 +257,7 @@ import java.util.concurrent.Executor;
 * <tr><td>attachAuxEffect </p></td>
 *     <td>{Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted} </p></td>
 *     <td>{Idle, Error} </p></td>
 *     <td>This method must be called after setDataSource or setPlaylist.
 *     <td>This method must be called after setDataSource.
 *     Calling it does not change the object state. </p></td></tr>
 * <tr><td>getAudioSessionId </p></td>
 *     <td>any </p></td>
@@ -338,7 +337,7 @@ import java.util.concurrent.Executor;
 *     <td>{Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted,
 *          Error} </p></td>
 *     <td>This method must be called in idle state as the audio session ID must be known before
 *         calling setDataSource or setPlaylist. Calling it does not change the object
 *         calling setDataSource. Calling it does not change the object
 *         state. </p></td></tr>
 * <tr><td>setAudioStreamType (deprecated)</p></td>
 *     <td>{Idle, Initialized, Stopped, Prepared, Started, Paused,
@@ -358,13 +357,6 @@ import java.util.concurrent.Executor;
 *     <td>Successful invoke of this method in a valid state transfers the
 *         object to the <em>Initialized</em> state. Calling this method in an
 *         invalid state throws an IllegalStateException.</p></td></tr>
 * <tr><td>setPlaylist </p></td>
 *     <td>{Idle} </p></td>
 *     <td>{Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted,
 *          Error} </p></td>
 *     <td>Successful invoke of this method in a valid state transfers the
 *         object to the <em>Initialized</em> state. Calling this method in an
 *         invalid state throws an IllegalStateException.</p></td></tr>
 * <tr><td>setDisplay </p></td>
 *     <td>any </p></td>
 *     <td>{} </p></td>
@@ -500,6 +492,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * This class implements the Java {@code AutoCloseable} interface and
     * may be used with try-with-resources.
     */
    // This is a synchronous call.
    @Override
    public abstract void close();

@@ -511,6 +504,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * prepared, the player will prepare the source and play.
     *
     */
    // This is an asynchronous call.
    @Override
    public abstract void play();

@@ -521,18 +515,21 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * call prepare().
     *
     */
    // This is an asynchronous call.
    @Override
    public abstract void prepare();

    /**
     * Pauses playback. Call play() to resume.
     */
    // This is an asynchronous call.
    @Override
    public abstract void pause();

    /**
     * Tries to play next data source if applicable.
     */
    // This is an asynchronous call.
    @Override
    public abstract void skipToNext();

@@ -542,6 +539,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     *
     * @param msec the offset in milliseconds from the start to seek to
     */
    // This is an asynchronous call.
    @Override
    public void seekTo(long msec) {
        seekTo(msec, SEEK_PREVIOUS_SYNC /* mode */);
@@ -600,6 +598,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * for the audio attributes to become effective thereafter.
     * @param attributes a non-null set of audio attributes
     */
    // This is an asynchronous call.
    @Override
    public abstract void setAudioAttributes(@NonNull AudioAttributes attributes);

@@ -615,6 +614,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     *
     * @param dsd the descriptor of data source you want to play
     */
    // This is an asynchronous call.
    @Override
    public abstract void setDataSource(@NonNull DataSourceDesc dsd);

@@ -624,6 +624,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     *
     * @param dsd the descriptor of data source you want to play after current one
     */
    // This is an asynchronous call.
    @Override
    public abstract void setNextDataSource(@NonNull DataSourceDesc dsd);

@@ -632,6 +633,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     *
     * @param dsds the list of data sources you want to play after current one
     */
    // This is an asynchronous call.
    @Override
    public abstract void setNextDataSources(@NonNull List<DataSourceDesc> dsds);

@@ -647,6 +649,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * Configures the player to loop on the current data source.
     * @param loop true if the current data source is meant to loop.
     */
    // This is an asynchronous call.
    @Override
    public abstract void loopCurrent(boolean loop);

@@ -659,6 +662,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * by the player, see {@link #getPlaybackSpeed()}.
     * @param speed the desired playback speed
     */
    // This is an asynchronous call.
    @Override
    public abstract void setPlaybackSpeed(float speed);

@@ -692,6 +696,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * gain. See {@link #getMaxPlayerVolume()} for the volume range supported by this player.
     * @param volume a value between 0.0f and {@link #getMaxPlayerVolume()}.
     */
    // This is an asynchronous call.
    @Override
    public abstract void setPlayerVolume(float volume);

@@ -716,6 +721,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * @param e the {@link Executor} to be used for the events.
     * @param cb the callback to receive the events.
     */
    // This is a synchronous call.
    @Override
    public abstract void registerPlayerEventCallback(@NonNull Executor e,
            @NonNull PlayerEventCallback cb);
@@ -724,6 +730,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * Removes a previously registered callback for player events
     * @param cb the callback to remove
     */
    // This is a synchronous call.
    @Override
    public abstract void unregisterPlayerEventCallback(@NonNull PlayerEventCallback cb);

@@ -746,7 +753,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * Invoke a generic method on the native player using opaque
     * parcels for the request and reply. Both payloads' format is a
     * convention between the java caller and the native player.
     * Must be called after setDataSource or setPlaylist to make sure a native player
     * Must be called after setDataSource to make sure a native player
     * exists. On failure, a RuntimeException is thrown.
     *
     * @param request Parcel with the data for the extension. The
@@ -769,6 +776,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * @param label An application specific Object used to help to identify the completeness
     * of a batch of commands.
     */
    // This is an asynchronous call.
    public void notifyWhenCommandLabelReached(Object label) { }

    /**
@@ -807,6 +815,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * @throws IllegalStateException if the internal player engine has not been
     * initialized or has been released.
     */
    // This is an asynchronous call.
    public abstract void setSurface(Surface surface);

    /* Do not change these video scaling mode values below without updating
@@ -855,6 +864,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
    /**
     * Discards all pending commands.
     */
    // This is a synchronous call.
    public abstract void clearPendingCommands();

    /**
@@ -878,6 +888,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * @return true if succesful, false if the specified {@link AudioDeviceInfo} is non-null and
     * does not correspond to a valid audio device.
     */
    // This is an asynchronous call.
    @Override
    public abstract boolean setPreferredDevice(AudioDeviceInfo deviceInfo);

@@ -905,6 +916,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * @param handler  Specifies the {@link Handler} object for the thread on which to execute
     * the callback. If <code>null</code>, the handler on the main looper will be used.
     */
    // This is a synchronous call.
    @Override
    public abstract void addOnRoutingChangedListener(AudioRouting.OnRoutingChangedListener listener,
            Handler handler);
@@ -915,6 +927,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * @param listener The previously added {@link AudioRouting.OnRoutingChangedListener} interface
     * to remove.
     */
    // This is a synchronous call.
    @Override
    public abstract void removeOnRoutingChangedListener(AudioRouting.OnRoutingChangedListener listener);

@@ -1070,6 +1083,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * @throws IllegalArgumentException if params is invalid or not supported.
     * @hide
     */
    // This is an asynchronous call.
    public void setBufferingParams(@NonNull BufferingParams params) { }

    /**
@@ -1152,6 +1166,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     *
     * @param params the playback params.
     */
    // This is an asynchronous call.
    public abstract void setPlaybackParams(@NonNull PlaybackParams params);

    /**
@@ -1167,6 +1182,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     *
     * @param params the A/V sync params to apply
     */
    // This is an asynchronous call.
    public abstract void setSyncParams(@NonNull SyncParams params);

    /**
@@ -1255,6 +1271,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * {@link #SEEK_CLOSEST} often has larger performance overhead compared
     * to the other options if there is no sync frame located at msec.
     */
    // This is an asynchronous call.
    public abstract void seekTo(long msec, @SeekMode int mode);

    /**
@@ -1327,6 +1344,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * this method, you will have to initialize it again by setting the
     * data source and calling prepare().
     */
    // This is a synchronous call.
    @Override
    public abstract void reset();

@@ -1365,6 +1383,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * by calling this method.
     * This method must be called before one of the overloaded <code> setDataSource </code> methods.
     */
    // This is an asynchronous call.
    public abstract void setAudioSessionId(int sessionId);

    /**
@@ -1389,6 +1408,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * methods.
     * @param effectId system wide unique id of the effect to attach
     */
    // This is an asynchronous call.
    public abstract void attachAuxEffect(int effectId);


@@ -1404,6 +1424,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * 0 < x <= R -> level = 10^(72*(x-R)/20/R)
     * @param level send level scalar
     */
    // This is an asynchronous call.
    public abstract void setAuxEffectSendLevel(float level);

    /**
@@ -1618,6 +1639,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     *
     * @see android.media.MediaPlayer2#getTrackInfo
     */
    // This is an asynchronous call.
    public abstract void selectTrack(int index);

    /**
@@ -1634,6 +1656,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     *
     * @see android.media.MediaPlayer2#getTrackInfo
     */
    // This is an asynchronous call.
    public abstract void deselectTrack(int index);

    /** @hide */
@@ -1754,8 +1777,6 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
         * <li>{@link #MEDIA_CALL_PAUSE}
         * <li>{@link #MEDIA_CALL_PLAY}
         * <li>{@link #MEDIA_CALL_PREPARE}
         * <li>{@link #MEDIA_CALL_PREPARE_DRM}
         * <li>{@link #MEDIA_CALL_PROVIDE_DRM_KEY_RESPONSE}
         * <li>{@link #MEDIA_CALL_RELEASE_DRM}
         * <li>{@link #MEDIA_CALL_RESTORE_DRM_KEYS}
         * <li>{@link #MEDIA_CALL_SEEK_TO}
@@ -1764,8 +1785,6 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
         * <li>{@link #MEDIA_CALL_SET_AUDIO_SESSION_ID}
         * <li>{@link #MEDIA_CALL_SET_AUX_EFFECT_SEND_LEVEL}
         * <li>{@link #MEDIA_CALL_SET_DATA_SOURCE}
         * <li>{@link #MEDIA_CALL_SET_DRM_CONFIG_HELPER}
         * <li>{@link #MEDIA_CALL_SET_DRM_PROPERTY_STRING}
         * <li>{@link #MEDIA_CALL_SET_NEXT_DATA_SOURCE}
         * <li>{@link #MEDIA_CALL_SET_NEXT_DATA_SOURCES}
         * <li>{@link #MEDIA_CALL_SET_PLAYBACK_PARAMS}
@@ -1804,12 +1823,14 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * @param eventCallback the callback that will be run
     * @param executor the executor through which the callback should be invoked
     */
    // This is a synchronous call.
    public abstract void setMediaPlayer2EventCallback(@NonNull @CallbackExecutor Executor executor,
            @NonNull MediaPlayer2EventCallback eventCallback);

    /**
     * Clears the {@link MediaPlayer2EventCallback}.
     */
    // This is a synchronous call.
    public abstract void clearMediaPlayer2EventCallback();

    /**
@@ -1830,6 +1851,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     *
     * @hide
     */
    // This is a synchronous call.
    public void setOnSubtitleDataListener(OnSubtitleDataListener listener) { }


@@ -1996,136 +2018,128 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
    public static final int MEDIA_INFO_SUBTITLE_TIMED_OUT = 902;

    //--------------------------------------------------------------------------
    /** The player just completed a call {@code attachAuxEffect}.
    /** The player just completed a call {@link #attachAuxEffect}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_ATTACH_AUX_EFFECT = 1;

    /** The player just completed a call {@code deselectTrack}.
    /** The player just completed a call {@link #deselectTrack}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_DESELECT_TRACK = 2;

    /** The player just completed a call {@code loopCurrent}.
    /** The player just completed a call {@link #loopCurrent}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_LOOP_CURRENT = 3;

    /** The player just completed a call {@code pause}.
    /** The player just completed a call {@link #pause}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_PAUSE = 4;

    /** The player just completed a call {@code play}.
    /** The player just completed a call {@link #play}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_PLAY = 5;

    /** The player just completed a call {@code prepare}.
    /** The player just completed a call {@link #prepare}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_PREPARE = 6;

    /** The player just completed a call {@code prepareDrm}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_PREPARE_DRM = 7;

    /** The player just completed a call {@code provideDrmKeyResponse}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_PROVIDE_DRM_KEY_RESPONSE = 8;

    /** The player just completed a call {@code releaseDrm}.
    /** The player just completed a call {@link #releaseDrm}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_RELEASE_DRM = 12;

    /** The player just completed a call {@code restoreDrmKeys}.
    /** The player just completed a call {@link #restoreDrmKeys}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_RESTORE_DRM_KEYS = 13;

    /** The player just completed a call {@code seekTo}.
    /** The player just completed a call {@link #seekTo}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SEEK_TO = 14;

    /** The player just completed a call {@code selectTrack}.
    /** The player just completed a call {@link #selectTrack}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SELECT_TRACK = 15;

    /** The player just completed a call {@code setAudioAttributes}.
    /** The player just completed a call {@link #setAudioAttributes}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SET_AUDIO_ATTRIBUTES = 16;

    /** The player just completed a call {@code setAudioSessionId}.
    /** The player just completed a call {@link #setAudioSessionId}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SET_AUDIO_SESSION_ID = 17;

    /** The player just completed a call {@code setAuxEffectSendLevel}.
    /** The player just completed a call {@link #setAuxEffectSendLevel}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SET_AUX_EFFECT_SEND_LEVEL = 18;

    /** The player just completed a call {@code setDataSource}.
    /** The player just completed a call {@link #setDataSource}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SET_DATA_SOURCE = 19;

    /** The player just completed a call {@code setOnDrmConfigHelper}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SET_DRM_CONFIG_HELPER = 20;

    /** The player just completed a call {@code setDrmPropertyString}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SET_DRM_PROPERTY_STRING = 21;

    /** The player just completed a call {@code setNextDataSource}.
    /** The player just completed a call {@link #setNextDataSource}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SET_NEXT_DATA_SOURCE = 22;

    /** The player just completed a call {@code setNextDataSources}.
    /** The player just completed a call {@link #setNextDataSources}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SET_NEXT_DATA_SOURCES = 23;

    /** The player just completed a call {@code setPlaybackParams}.
    /** The player just completed a call {@link #setPlaybackParams}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SET_PLAYBACK_PARAMS = 24;

    /** The player just completed a call {@code setPlaybackSpeed}.
    /** The player just completed a call {@link #setPlaybackSpeed}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SET_PLAYBACK_SPEED = 25;

    /** The player just completed a call {@code setPlayerVolume}.
    /** The player just completed a call {@link #setPlayerVolume}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SET_PLAYER_VOLUME = 26;

    /** The player just completed a call {@code setSurface}.
    /** The player just completed a call {@link #setSurface}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SET_SURFACE = 27;

    /** The player just completed a call {@code setSyncParams}.
    /** The player just completed a call {@link #setSyncParams}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SET_SYNC_PARAMS = 28;

    /** The player just completed a call {@code skipToNext}.
    /** The player just completed a call {@link #skipToNext}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     */
    public static final int MEDIA_CALL_SKIP_TO_NEXT = 29;

    /** The player just completed a call {@link #setBufferingParams}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     * @hide
     */
    public static final int MEDIA_CALL_SET_BUFFERING_PARAMS = 1001;

    /** The player just completed a call {@link #setPreferredDevice}.
     * @see android.media.MediaPlayer2.MediaPlayer2EventCallback#onCallComplete
     * @hide
     */
    public static final int MEDIA_CALL_SET_PREFERRED_DEVICE = 1002;


    // Modular DRM begin

@@ -2136,8 +2150,8 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * 'securityLevel', which has to be set after DRM scheme creation but
     * before the DRM session is opened.
     *
     * The only allowed DRM calls in this listener are {@code getDrmPropertyString}
     * and {@code setDrmPropertyString}.
     * The only allowed DRM calls in this listener are {@link #getDrmPropertyString}
     * and {@link #setDrmPropertyString}.
     */
    public interface OnDrmConfigHelper
    {
@@ -2158,6 +2172,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     *
     * @param listener the callback that will be run
     */
    // This is a synchronous call.
    public abstract void setOnDrmConfigHelper(OnDrmConfigHelper listener);

    /**
@@ -2176,7 +2191,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
        public void onDrmInfo(MediaPlayer2 mp, DataSourceDesc dsd, DrmInfo drmInfo) { }

        /**
         * Called to notify the client that {@code prepareDrm} is finished and ready for
         * Called to notify the client that {@link #prepareDrm} is finished and ready for
         * key request/response.
         *
         * @param mp the {@code MediaPlayer2} associated with this callback
@@ -2196,12 +2211,14 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * @param eventCallback the callback that will be run
     * @param executor the executor through which the callback should be invoked
     */
    // This is a synchronous call.
    public abstract void setDrmEventCallback(@NonNull @CallbackExecutor Executor executor,
            @NonNull DrmEventCallback eventCallback);

    /**
     * Clears the {@link DrmEventCallback}.
     */
    // This is a synchronous call.
    public abstract void clearDrmEventCallback();

    /**
@@ -2248,10 +2265,10 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
    /**
     * Prepares the DRM for the current source
     * <p>
     * If {@code OnDrmConfigHelper} is registered, it will be called during
     * If {@link OnDrmConfigHelper} is registered, it will be called during
     * preparation to allow configuration of the DRM properties before opening the
     * DRM session. Note that the callback is called synchronously in the thread that called
     * {@code prepareDrm}. It should be used only for a series of {@code getDrmPropertyString}
     * {@link #prepareDrm}. It should be used only for a series of {@code getDrmPropertyString}
     * and {@code setDrmPropertyString} calls and refrain from any lengthy operation.
     * <p>
     * If the device has not been provisioned before, this call also provisions the device
@@ -2281,6 +2298,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * @throws ProvisioningServerErrorException   if provisioning is required but failed due to
     *                                            the request denied by the provisioning server
     */
    // This is a synchronous call.
    public abstract void prepareDrm(@NonNull UUID uuid)
            throws UnsupportedSchemeException, ResourceBusyException,
                   ProvisioningNetworkErrorException, ProvisioningServerErrorException;
@@ -2294,6 +2312,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     *
     * @throws NoDrmSchemeException if there is no active DRM session to release
     */
    // This is an asynchronous call.
    public abstract void releaseDrm() throws NoDrmSchemeException;

    /**
@@ -2359,6 +2378,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * @throws DeniedByServerException if the response indicates that the
     * server rejected the request
     */
    // This is a synchronous call.
    public abstract byte[] provideDrmKeyResponse(
            @Nullable byte[] keySetId, @NonNull byte[] response)
            throws NoDrmSchemeException, DeniedByServerException;
@@ -2369,6 +2389,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     *
     * @param keySetId identifies the saved key set to restore
     */
    // This is an asynchronous call.
    public abstract void restoreDrmKeys(@NonNull byte[] keySetId)
            throws NoDrmSchemeException;

@@ -2396,6 +2417,7 @@ public abstract class MediaPlayer2 extends MediaPlayerBase
     * {@link MediaDrm#PROPERTY_VENDOR}, {@link MediaDrm#PROPERTY_VERSION},
     * {@link MediaDrm#PROPERTY_DESCRIPTION}, {@link MediaDrm#PROPERTY_ALGORITHMS}
     */
    // This is a synchronous call.
    public abstract void setDrmPropertyString(
            @NonNull @MediaDrm.StringProperty String propertyName, @NonNull String value)
            throws NoDrmSchemeException;