IAudioService.aidl revision 7e435a011dd519f76a8ec1a8ed99a22bee5c3e26
1/*
2 * Copyright (C) 2007 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.app.PendingIntent;
20import android.bluetooth.BluetoothDevice;
21import android.content.ComponentName;
22import android.media.AudioRoutesInfo;
23import android.media.IAudioFocusDispatcher;
24import android.media.IAudioRoutesObserver;
25import android.media.IRemoteControlClient;
26import android.media.IRemoteControlDisplay;
27import android.media.IRemoteVolumeObserver;
28import android.media.IRingtonePlayer;
29import android.media.Rating;
30import android.net.Uri;
31import android.view.KeyEvent;
32
33/**
34 * {@hide}
35 */
36interface IAudioService {
37
38    int verifyX509CertChain(int chainsize, in byte[] chain, String host, String authtype);
39
40    void adjustVolume(int direction, int flags, String callingPackage);
41
42    boolean isLocalOrRemoteMusicActive();
43
44    oneway void adjustLocalOrRemoteStreamVolume(int streamType, int direction,
45            String callingPackage);
46
47    void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags,
48            String callingPackage);
49
50    void adjustStreamVolume(int streamType, int direction, int flags, String callingPackage);
51
52    void adjustMasterVolume(int direction, int flags, String callingPackage);
53
54    void setStreamVolume(int streamType, int index, int flags, String callingPackage);
55
56    oneway void setRemoteStreamVolume(int index);
57
58    void setMasterVolume(int index, int flags, String callingPackage);
59
60    void setStreamSolo(int streamType, boolean state, IBinder cb);
61
62    void setStreamMute(int streamType, boolean state, IBinder cb);
63
64    boolean isStreamMute(int streamType);
65
66    void setMasterMute(boolean state, int flags, IBinder cb);
67
68    boolean isMasterMute();
69
70    int getStreamVolume(int streamType);
71
72    int getMasterVolume();
73
74    int getStreamMaxVolume(int streamType);
75
76    int getMasterMaxVolume();
77
78    int getLastAudibleStreamVolume(int streamType);
79
80    int getLastAudibleMasterVolume();
81
82    void setRingerMode(int ringerMode);
83
84    int getRingerMode();
85
86    void setVibrateSetting(int vibrateType, int vibrateSetting);
87
88    int getVibrateSetting(int vibrateType);
89
90    boolean shouldVibrate(int vibrateType);
91
92    void setMode(int mode, IBinder cb);
93
94    int getMode();
95
96    oneway void playSoundEffect(int effectType);
97
98    oneway void playSoundEffectVolume(int effectType, float volume);
99
100    boolean loadSoundEffects();
101
102    oneway void unloadSoundEffects();
103
104    oneway void reloadAudioSettings();
105
106    oneway void avrcpSupportsAbsoluteVolume(String address, boolean support);
107
108    void setSpeakerphoneOn(boolean on);
109
110    boolean isSpeakerphoneOn();
111
112    void setBluetoothScoOn(boolean on);
113
114    boolean isBluetoothScoOn();
115
116    void setBluetoothA2dpOn(boolean on);
117
118    boolean isBluetoothA2dpOn();
119
120    int requestAudioFocus(int mainStreamType, int durationHint, IBinder cb,
121            IAudioFocusDispatcher fd, String clientId, String callingPackageName);
122
123    int abandonAudioFocus(IAudioFocusDispatcher fd, String clientId);
124
125    void unregisterAudioFocusClient(String clientId);
126
127    int getCurrentAudioFocus();
128
129    oneway void dispatchMediaKeyEvent(in KeyEvent keyEvent);
130    void dispatchMediaKeyEventUnderWakelock(in KeyEvent keyEvent);
131
132           void registerMediaButtonIntent(in PendingIntent pi, in ComponentName c, IBinder token);
133    oneway void unregisterMediaButtonIntent(in PendingIntent pi);
134
135    oneway void registerMediaButtonEventReceiverForCalls(in ComponentName c);
136    oneway void unregisterMediaButtonEventReceiverForCalls();
137
138    /**
139     * Register an IRemoteControlDisplay.
140     * Success of registration is subject to a check on
141     *   the android.Manifest.permission.MEDIA_CONTENT_CONTROL permission.
142     * Notify all IRemoteControlClient of the new display and cause the RemoteControlClient
143     * at the top of the stack to update the new display with its information.
144     * @param rcd the IRemoteControlDisplay to register. No effect if null.
145     * @param w the maximum width of the expected bitmap. Negative or zero values indicate this
146     *   display doesn't need to receive artwork.
147     * @param h the maximum height of the expected bitmap. Negative or zero values indicate this
148     *   display doesn't need to receive artwork.
149     */
150    boolean registerRemoteControlDisplay(in IRemoteControlDisplay rcd, int w, int h);
151
152    /**
153     * Like registerRemoteControlDisplay, but with success being subject to a check on
154     *   the android.Manifest.permission.MEDIA_CONTENT_CONTROL permission, and if it fails,
155     *   success is subject to listenerComp being one of the ENABLED_NOTIFICATION_LISTENERS
156     *   components.
157     */
158    boolean registerRemoteController(in IRemoteControlDisplay rcd, int w, int h,
159            in ComponentName listenerComp);
160
161    /**
162     * Unregister an IRemoteControlDisplay.
163     * No effect if the IRemoteControlDisplay hasn't been successfully registered.
164     * @param rcd the IRemoteControlDisplay to unregister. No effect if null.
165     */
166    oneway void unregisterRemoteControlDisplay(in IRemoteControlDisplay rcd);
167    /**
168     * Update the size of the artwork used by an IRemoteControlDisplay.
169     * @param rcd the IRemoteControlDisplay with the new artwork size requirement
170     * @param w the maximum width of the expected bitmap. Negative or zero values indicate this
171     *   display doesn't need to receive artwork.
172     * @param h the maximum height of the expected bitmap. Negative or zero values indicate this
173     *   display doesn't need to receive artwork.
174     */
175    oneway void remoteControlDisplayUsesBitmapSize(in IRemoteControlDisplay rcd, int w, int h);
176    /**
177     * Controls whether a remote control display needs periodic checks of the RemoteControlClient
178     * playback position to verify that the estimated position has not drifted from the actual
179     * position. By default the check is not performed.
180     * The IRemoteControlDisplay must have been previously registered for this to have any effect.
181     * @param rcd the IRemoteControlDisplay for which the anti-drift mechanism will be enabled
182     *     or disabled. Not null.
183     * @param wantsSync if true, RemoteControlClient instances which expose their playback position
184     *     to the framework will regularly compare the estimated playback position with the actual
185     *     position, and will update the IRemoteControlDisplay implementation whenever a drift is
186     *     detected.
187     */
188    oneway void remoteControlDisplayWantsPlaybackPositionSync(in IRemoteControlDisplay rcd,
189            boolean wantsSync);
190    /**
191     * Request the user of a RemoteControlClient to seek to the given playback position.
192     * @param generationId the RemoteControlClient generation counter for which this request is
193     *         issued. Requests for an older generation than current one will be ignored.
194     * @param timeMs the time in ms to seek to, must be positive.
195     */
196     void setRemoteControlClientPlaybackPosition(int generationId, long timeMs);
197     /**
198      * Notify the user of a RemoteControlClient that it should update its metadata with the
199      * new value for the given key.
200      * @param generationId the RemoteControlClient generation counter for which this request is
201      *         issued. Requests for an older generation than current one will be ignored.
202      * @param key the metadata key for which a new value exists
203      * @param value the new metadata value
204      */
205     void updateRemoteControlClientMetadata(int generationId, int key, in Rating value);
206
207    /**
208     * Do not use directly, use instead
209     *     {@link android.media.AudioManager#registerRemoteControlClient(RemoteControlClient)}
210     */
211    int registerRemoteControlClient(in PendingIntent mediaIntent,
212            in IRemoteControlClient rcClient, in String callingPackageName);
213    /**
214     * Do not use directly, use instead
215     *     {@link android.media.AudioManager#unregisterRemoteControlClient(RemoteControlClient)}
216     */
217    oneway void unregisterRemoteControlClient(in PendingIntent mediaIntent,
218            in IRemoteControlClient rcClient);
219
220    oneway void setPlaybackInfoForRcc(int rccId, int what, int value);
221    void setPlaybackStateForRcc(int rccId, int state, long timeMs, float speed);
222           int  getRemoteStreamMaxVolume();
223           int  getRemoteStreamVolume();
224    oneway void registerRemoteVolumeObserverForRcc(int rccId, in IRemoteVolumeObserver rvo);
225
226    void startBluetoothSco(IBinder cb, int targetSdkVersion);
227    void stopBluetoothSco(IBinder cb);
228
229    void forceVolumeControlStream(int streamType, IBinder cb);
230
231    void setRingtonePlayer(IRingtonePlayer player);
232    IRingtonePlayer getRingtonePlayer();
233    int getMasterStreamType();
234
235    void setWiredDeviceConnectionState(int device, int state, String name);
236    int setBluetoothA2dpDeviceConnectionState(in BluetoothDevice device, int state);
237
238    AudioRoutesInfo startWatchingRoutes(in IAudioRoutesObserver observer);
239
240    boolean isCameraSoundForced();
241
242}
243