2 * Copyright (C) 2007 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package android.media;
19 import android.app.PendingIntent;
20 import android.bluetooth.BluetoothDevice;
21 import android.content.ComponentName;
22 import android.media.AudioRoutesInfo;
23 import android.media.IAudioFocusDispatcher;
24 import android.media.IAudioRoutesObserver;
25 import android.media.IRemoteControlClient;
26 import android.media.IRemoteControlDisplay;
27 import android.media.IRemoteVolumeObserver;
28 import android.media.IRingtonePlayer;
29 import android.media.Rating;
30 import android.net.Uri;
31 import android.view.KeyEvent;
36 interface IAudioService {
38 int verifyX509CertChain(int chainsize, in byte[] chain, String host, String authtype);
40 void adjustVolume(int direction, int flags, String callingPackage);
42 boolean isLocalOrRemoteMusicActive();
44 oneway void adjustLocalOrRemoteStreamVolume(int streamType, int direction,
45 String callingPackage);
47 void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags,
48 String callingPackage);
50 void adjustStreamVolume(int streamType, int direction, int flags, String callingPackage);
52 void adjustMasterVolume(int direction, int flags, String callingPackage);
54 void setStreamVolume(int streamType, int index, int flags, String callingPackage);
56 oneway void setRemoteStreamVolume(int index);
58 void setMasterVolume(int index, int flags, String callingPackage);
60 void setStreamSolo(int streamType, boolean state, IBinder cb);
62 void setStreamMute(int streamType, boolean state, IBinder cb);
64 boolean isStreamMute(int streamType);
66 void setMasterMute(boolean state, int flags, IBinder cb);
68 boolean isMasterMute();
70 int getStreamVolume(int streamType);
72 int getMasterVolume();
74 int getStreamMaxVolume(int streamType);
76 int getMasterMaxVolume();
78 int getLastAudibleStreamVolume(int streamType);
80 int getLastAudibleMasterVolume();
82 void setRingerMode(int ringerMode);
86 void setVibrateSetting(int vibrateType, int vibrateSetting);
88 int getVibrateSetting(int vibrateType);
90 boolean shouldVibrate(int vibrateType);
92 void setMode(int mode, IBinder cb);
96 oneway void playSoundEffect(int effectType);
98 oneway void playSoundEffectVolume(int effectType, float volume);
100 boolean loadSoundEffects();
102 oneway void unloadSoundEffects();
104 oneway void reloadAudioSettings();
106 oneway void avrcpSupportsAbsoluteVolume(String address, boolean support);
108 void setSpeakerphoneOn(boolean on);
110 boolean isSpeakerphoneOn();
112 void setBluetoothScoOn(boolean on);
114 boolean isBluetoothScoOn();
116 void setBluetoothA2dpOn(boolean on);
118 boolean isBluetoothA2dpOn();
120 int requestAudioFocus(int mainStreamType, int durationHint, IBinder cb,
121 IAudioFocusDispatcher fd, String clientId, String callingPackageName);
123 int abandonAudioFocus(IAudioFocusDispatcher fd, String clientId);
125 void unregisterAudioFocusClient(String clientId);
127 int getCurrentAudioFocus();
129 oneway void dispatchMediaKeyEvent(in KeyEvent keyEvent);
130 void dispatchMediaKeyEventUnderWakelock(in KeyEvent keyEvent);
132 void registerMediaButtonIntent(in PendingIntent pi, in ComponentName c, IBinder token);
133 oneway void unregisterMediaButtonIntent(in PendingIntent pi);
135 oneway void registerMediaButtonEventReceiverForCalls(in ComponentName c);
136 oneway void unregisterMediaButtonEventReceiverForCalls();
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.
150 boolean registerRemoteControlDisplay(in IRemoteControlDisplay rcd, int w, int h);
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
158 boolean registerRemoteController(in IRemoteControlDisplay rcd, int w, int h,
159 in ComponentName listenerComp);
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.
166 oneway void unregisterRemoteControlDisplay(in IRemoteControlDisplay rcd);
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.
175 oneway void remoteControlDisplayUsesBitmapSize(in IRemoteControlDisplay rcd, int w, int h);
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
188 oneway void remoteControlDisplayWantsPlaybackPositionSync(in IRemoteControlDisplay rcd,
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.
196 void setRemoteControlClientPlaybackPosition(int generationId, long timeMs);
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
205 void updateRemoteControlClientMetadata(int generationId, int key, in Rating value);
208 * Do not use directly, use instead
209 * {@link android.media.AudioManager#registerRemoteControlClient(RemoteControlClient)}
211 int registerRemoteControlClient(in PendingIntent mediaIntent,
212 in IRemoteControlClient rcClient, in String callingPackageName);
214 * Do not use directly, use instead
215 * {@link android.media.AudioManager#unregisterRemoteControlClient(RemoteControlClient)}
217 oneway void unregisterRemoteControlClient(in PendingIntent mediaIntent,
218 in IRemoteControlClient rcClient);
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);
226 void startBluetoothSco(IBinder cb, int targetSdkVersion);
227 void stopBluetoothSco(IBinder cb);
229 void forceVolumeControlStream(int streamType, IBinder cb);
231 void setRingtonePlayer(IRingtonePlayer player);
232 IRingtonePlayer getRingtonePlayer();
233 int getMasterStreamType();
235 void setWiredDeviceConnectionState(int device, int state, String name);
236 int setBluetoothA2dpDeviceConnectionState(in BluetoothDevice device, int state);
238 AudioRoutesInfo startWatchingRoutes(in IAudioRoutesObserver observer);
240 boolean isCameraSoundForced();