IRemoteControlClient.aidl revision fcd693a21d862ea765006f8987b8dd4b125b28c5
1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.media;
18
19import android.graphics.Bitmap;
20
21/**
22 * @hide
23 * Interface for an object that exposes information meant to be consumed by remote controls
24 * capable of displaying metadata, album art and media transport control buttons.
25 * Such a remote control client object is associated with a media button event receiver
26 * when registered through
27 * {@link AudioManager#registerRemoteControlClient(ComponentName, IRemoteControlClient)}.
28 */
29interface IRemoteControlClient
30{
31    /**
32     * Called by a remote control to retrieve a String of information to display.
33     * @param field the identifier for a metadata field to retrieve. Valid values are
34     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_ALBUM},
35     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_ALBUMARTIST},
36     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_TITLE},
37     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_ARTIST},
38     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_AUTHOR},
39     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_CD_TRACK_NUMBER},
40     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_COMPILATION},
41     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_COMPOSER},
42     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_DATE},
43     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_DISC_NUMBER},
44     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_DURATION},
45     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_GENRE},
46     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_TITLE},
47     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_WRITER},
48     *      {@link android.media.MediaMetadataRetriever#METADATA_KEY_YEAR}.
49     * @return null if the requested field is not supported, or the String matching the
50     *       metadata field.
51     */
52    String getMetadataString(int field);
53
54    /**
55     * Called by a remote control to retrieve the current playback state.
56     * @return one of the following values:
57     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_STOPPED},
58     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_PAUSED},
59     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_PLAYING},
60     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_FAST_FORWARDING},
61     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_REWINDING},
62     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_SKIPPING_FORWARDS},
63     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_SKIPPING_BACKWARDS},
64     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_BUFFERING},
65     *       {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_ERROR}.
66     */
67    int getPlaybackState();
68
69    /**
70     * Called by a remote control to retrieve the flags for the media transport control buttons
71     * that this client supports.
72     * @see {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_PREVIOUS},
73     *      {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_REWIND},
74     *      {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_PLAY},
75     *      {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_PLAY_PAUSE},
76     *      {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_PAUSE},
77     *      {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_STOP},
78     *      {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_FAST_FORWARD},
79     *      {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_NEXT}
80     */
81    int getTransportControlFlags();
82
83    /**
84     * Called by a remote control to retrieve the album art picture at the requested size.
85     * Note that returning a bitmap smaller than the maximum requested dimension is accepted
86     * and it will be scaled as needed, but exceeding the maximum dimensions may produce
87     * unspecified results, such as the image being cropped or simply not being displayed.
88     * @param maxWidth the maximum width of the requested bitmap expressed in pixels.
89     * @param maxHeight the maximum height of the requested bitmap expressed in pixels.
90     * @return the bitmap for the album art, or null if there isn't any.
91     * @see android.graphics.Bitmap
92     */
93    Bitmap getAlbumArt(int maxWidth, int maxHeight);
94}
95