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

Commit 59df7206 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android (Google) Code Review
Browse files

Merge "Bug 5045498 javadoc for the remote control client API"

parents 837da715 fcd693a2
Loading
Loading
Loading
Loading
+132 −1
Original line number Diff line number Diff line
@@ -1743,7 +1743,13 @@ public class AudioManager {

    /**
     * @hide
     * @param eventReceiver
     * Unregisters the remote control client that was providing information to display on the
     * remotes.
     * @param eventReceiver identifier of a {@link android.content.BroadcastReceiver}
     *      that receives the media button intent, and associated with the remote control
     *      client.
     * @see #registerRemoteControlClient(ComponentName)

     */
    public void unregisterRemoteControlClient(ComponentName eventReceiver) {
        if (eventReceiver == null) {
@@ -1783,27 +1789,152 @@ public class AudioManager {
     * Definitions of constants to be used in {@link android.media.IRemoteControlClient}.
     */
    public final class RemoteControlParameters {
        /**
         * Playback state of an IRemoteControlClient which is stopped.
         *
         * @see android.media.IRemoteControlClient#getPlaybackState()
         */
        public final static int PLAYSTATE_STOPPED            = 1;
        /**
         * Playback state of an IRemoteControlClient which is paused.
         *
         * @see android.media.IRemoteControlClient#getPlaybackState()
         */
        public final static int PLAYSTATE_PAUSED             = 2;
        /**
         * Playback state of an IRemoteControlClient which is playing media.
         *
         * @see android.media.IRemoteControlClient#getPlaybackState()
         */
        public final static int PLAYSTATE_PLAYING            = 3;
        /**
         * Playback state of an IRemoteControlClient which is fast forwarding in the media
         *    it is currently playing.
         *
         * @see android.media.IRemoteControlClient#getPlaybackState()
         */
        public final static int PLAYSTATE_FAST_FORWARDING    = 4;
        /**
         * Playback state of an IRemoteControlClient which is fast rewinding in the media
         *    it is currently playing.
         *
         * @see android.media.IRemoteControlClient#getPlaybackState()
         */
        public final static int PLAYSTATE_REWINDING          = 5;
        /**
         * Playback state of an IRemoteControlClient which is skipping to the next
         *    logical chapter (such as a song in a playlist) in the media it is currently playing.
         *
         * @see android.media.IRemoteControlClient#getPlaybackState()
         */
        public final static int PLAYSTATE_SKIPPING_FORWARDS  = 6;
        /**
         * Playback state of an IRemoteControlClient which is skipping back to the previous
         *    logical chapter (such as a song in a playlist) in the media it is currently playing.
         *
         * @see android.media.IRemoteControlClient#getPlaybackState()
         */
        public final static int PLAYSTATE_SKIPPING_BACKWARDS = 7;
        /**
         * Playback state of an IRemoteControlClient which is buffering data to play before it can
         *    start or resume playback.
         *
         * @see android.media.IRemoteControlClient#getPlaybackState()
         */
        public final static int PLAYSTATE_BUFFERING          = 8;
        /**
         * Playback state of an IRemoteControlClient which cannot perform any playback related
         *    operation because of an internal error. Examples of such situations are no network
         *    connectivity when attempting to stream data from a server, or expired user credentials
         *    when trying to play subscription-based content.
         *
         * @see android.media.IRemoteControlClient#getPlaybackState()
         */
        public final static int PLAYSTATE_ERROR              = 9;

        /**
         * Flag indicating an IRemoteControlClient makes use of the "previous" media key.
         *
         * @see android.media.IRemoteControlClient#getTransportControlFlags()
         * @see android.view.KeyEvent#KEYCODE_MEDIA_PREVIOUS
         */
        public final static int FLAG_KEY_MEDIA_PREVIOUS = 1 << 0;
        /**
         * Flag indicating an IRemoteControlClient makes use of the "rewing" media key.
         *
         * @see android.media.IRemoteControlClient#getTransportControlFlags()
         * @see android.view.KeyEvent#KEYCODE_MEDIA_REWIND
         */
        public final static int FLAG_KEY_MEDIA_REWIND = 1 << 1;
        /**
         * Flag indicating an IRemoteControlClient makes use of the "play" media key.
         *
         * @see android.media.IRemoteControlClient#getTransportControlFlags()
         * @see android.view.KeyEvent#KEYCODE_MEDIA_PLAY
         */
        public final static int FLAG_KEY_MEDIA_PLAY = 1 << 2;
        /**
         * Flag indicating an IRemoteControlClient makes use of the "play/pause" media key.
         *
         * @see android.media.IRemoteControlClient#getTransportControlFlags()
         * @see android.view.KeyEvent#KEYCODE_MEDIA_PLAY_PAUSE
         */
        public final static int FLAG_KEY_MEDIA_PLAY_PAUSE = 1 << 3;
        /**
         * Flag indicating an IRemoteControlClient makes use of the "pause" media key.
         *
         * @see android.media.IRemoteControlClient#getTransportControlFlags()
         * @see android.view.KeyEvent#KEYCODE_MEDIA_PAUSE
         */
        public final static int FLAG_KEY_MEDIA_PAUSE = 1 << 4;
        /**
         * Flag indicating an IRemoteControlClient makes use of the "stop" media key.
         *
         * @see android.media.IRemoteControlClient#getTransportControlFlags()
         * @see android.view.KeyEvent#KEYCODE_MEDIA_STOP
         */
        public final static int FLAG_KEY_MEDIA_STOP = 1 << 5;
        /**
         * Flag indicating an IRemoteControlClient makes use of the "fast forward" media key.
         *
         * @see android.media.IRemoteControlClient#getTransportControlFlags()
         * @see android.view.KeyEvent#KEYCODE_MEDIA_FAST_FORWARD
         */
        public final static int FLAG_KEY_MEDIA_FAST_FORWARD = 1 << 6;
        /**
         * Flag indicating an IRemoteControlClient makes use of the "next" media key.
         *
         * @see android.media.IRemoteControlClient#getTransportControlFlags()
         * @see android.view.KeyEvent#KEYCODE_MEDIA_NEXT
         */
        public final static int FLAG_KEY_MEDIA_NEXT = 1 << 7;

        /**
         * Flag used to signal that the metadata exposed by the IRemoteControlClient has changed.
         *
         * @see #notifyRemoteControlInformationChanged(ComponentName, int)
         */
        public final static int FLAG_INFORMATION_CHANGED_METADATA = 1 << 0;
        /**
         * Flag used to signal that the transport control buttons supported by the
         * IRemoteControlClient have changed.
         * This can for instance happen when playback is at the end of a playlist, and the "next"
         * operation is not supported anymore.
         *
         * @see #notifyRemoteControlInformationChanged(ComponentName, int)
         */
        public final static int FLAG_INFORMATION_CHANGED_KEY_MEDIA = 1 << 1;
        /**
         * Flag used to signal that the playback state of the IRemoteControlClient has changed.
         *
         * @see #notifyRemoteControlInformationChanged(ComponentName, int)
         */
        public final static int FLAG_INFORMATION_CHANGED_PLAYSTATE = 1 << 2;
        /**
         * Flag used to signal that the album art for the IRemoteControlClient has changed.
         *
         * @see #notifyRemoteControlInformationChanged(ComponentName, int)
         */
        public final static int FLAG_INFORMATION_CHANGED_ALBUM_ART = 1 << 3;
    }

+39 −21
Original line number Diff line number Diff line
@@ -19,7 +19,12 @@ package android.media;
import android.graphics.Bitmap;

/**
 * {@hide}
 * @hide
 * Interface for an object that exposes information meant to be consumed by remote controls
 * capable of displaying metadata, album art and media transport control buttons.
 * Such a remote control client object is associated with a media button event receiver
 * when registered through
 * {@link AudioManager#registerRemoteControlClient(ComponentName, IRemoteControlClient)}.
 */
interface IRemoteControlClient
{
@@ -41,36 +46,49 @@ interface IRemoteControlClient
     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_TITLE},
     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_WRITER},
     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_YEAR}.
     * @return null if the given field is not supported, or the String matching the metadata field.
     * @return null if the requested field is not supported, or the String matching the
     *       metadata field.
     */
    String getMetadataString(int field);

    /**
     * Returns the current playback state.
     * Called by a remote control to retrieve the current playback state.
     * @return one of the following values:
     *       {@link android.media.AudioManager.RemoteControl#PLAYSTATE_STOPPED},
     *       {@link android.media.AudioManager.RemoteControl#PLAYSTATE_PAUSED},
     *       {@link android.media.AudioManager.RemoteControl#PLAYSTATE_PLAYING},
     *       {@link android.media.AudioManager.RemoteControl#PLAYSTATE_FAST_FORWARDING},
     *       {@link android.media.AudioManager.RemoteControl#PLAYSTATE_REWINDING},
     *       {@link android.media.AudioManager.RemoteControl#PLAYSTATE_SKIPPING_FORWARDS},
     *       {@link android.media.AudioManager.RemoteControl#PLAYSTATE_SKIPPING_BACKWARDS},
     *       {@link android.media.AudioManager.RemoteControl#PLAYSTATE_BUFFERING}.
     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_STOPPED},
     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_PAUSED},
     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_PLAYING},
     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_FAST_FORWARDING},
     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_REWINDING},
     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_SKIPPING_FORWARDS},
     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_SKIPPING_BACKWARDS},
     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_BUFFERING},
     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_ERROR}.
     */
    int getPlaybackState();

    /**
     * Returns the flags for the media transport control buttons this client supports.
     * @see {@link android.media.AudioManager.RemoteControl#FLAG_KEY_MEDIA_PREVIOUS},
     *      {@link android.media.AudioManager.RemoteControl#FLAG_KEY_MEDIA_REWIND},
     *      {@link android.media.AudioManager.RemoteControl#FLAG_KEY_MEDIA_PLAY},
     *      {@link android.media.AudioManager.RemoteControl#FLAG_KEY_MEDIA_PLAY_PAUSE},
     *      {@link android.media.AudioManager.RemoteControl#FLAG_KEY_MEDIA_PAUSE},
     *      {@link android.media.AudioManager.RemoteControl#FLAG_KEY_MEDIA_STOP},
     *      {@link android.media.AudioManager.RemoteControl#FLAG_KEY_MEDIA_FAST_FORWARD},
     *      {@link android.media.AudioManager.RemoteControl#FLAG_KEY_MEDIA_NEXT}
     * Called by a remote control to retrieve the flags for the media transport control buttons
     * that this client supports.
     * @see {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_PREVIOUS},
     *      {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_REWIND},
     *      {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_PLAY},
     *      {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_PLAY_PAUSE},
     *      {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_PAUSE},
     *      {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_STOP},
     *      {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_FAST_FORWARD},
     *      {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_NEXT}
     */
    int getTransportControlFlags();

    Bitmap getAlbumArt(int width, int height);
    /**
     * Called by a remote control to retrieve the album art picture at the requested size.
     * Note that returning a bitmap smaller than the maximum requested dimension is accepted
     * and it will be scaled as needed, but exceeding the maximum dimensions may produce
     * unspecified results, such as the image being cropped or simply not being displayed.
     * @param maxWidth the maximum width of the requested bitmap expressed in pixels.
     * @param maxHeight the maximum height of the requested bitmap expressed in pixels.
     * @return the bitmap for the album art, or null if there isn't any.
     * @see android.graphics.Bitmap
     */
    Bitmap getAlbumArt(int maxWidth, int maxHeight);
}