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.net.Uri;
30 import android.view.KeyEvent;
35 interface IAudioService {
37 int verifyX509CertChain(int chainsize, in byte[] chain, String host, String authtype);
39 void adjustVolume(int direction, int flags);
41 oneway void adjustLocalOrRemoteStreamVolume(int streamType, int direction);
43 void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags);
45 void adjustStreamVolume(int streamType, int direction, int flags);
47 void adjustMasterVolume(int direction, int flags);
49 void setStreamVolume(int streamType, int index, int flags);
51 oneway void setRemoteStreamVolume(int index);
53 void setMasterVolume(int index, int flags);
55 void setStreamSolo(int streamType, boolean state, IBinder cb);
57 void setStreamMute(int streamType, boolean state, IBinder cb);
59 boolean isStreamMute(int streamType);
61 void setMasterMute(boolean state, int flags, IBinder cb);
63 boolean isMasterMute();
65 int getStreamVolume(int streamType);
67 int getMasterVolume();
69 int getStreamMaxVolume(int streamType);
71 int getMasterMaxVolume();
73 int getLastAudibleStreamVolume(int streamType);
75 int getLastAudibleMasterVolume();
77 void setRingerMode(int ringerMode);
81 void setVibrateSetting(int vibrateType, int vibrateSetting);
83 int getVibrateSetting(int vibrateType);
85 boolean shouldVibrate(int vibrateType);
87 void setMode(int mode, IBinder cb);
91 oneway void playSoundEffect(int effectType);
93 oneway void playSoundEffectVolume(int effectType, float volume);
95 boolean loadSoundEffects();
97 oneway void unloadSoundEffects();
99 oneway void reloadAudioSettings();
101 void setSpeakerphoneOn(boolean on);
103 boolean isSpeakerphoneOn();
105 void setBluetoothScoOn(boolean on);
107 boolean isBluetoothScoOn();
109 void setBluetoothA2dpOn(boolean on);
111 boolean isBluetoothA2dpOn();
113 oneway void setRemoteSubmixOn(boolean on, int address);
115 int requestAudioFocus(int mainStreamType, int durationHint, IBinder cb, IAudioFocusDispatcher l,
116 String clientId, String callingPackageName);
118 int abandonAudioFocus(IAudioFocusDispatcher l, String clientId);
120 void unregisterAudioFocusClient(String clientId);
122 oneway void dispatchMediaKeyEvent(in KeyEvent keyEvent);
123 void dispatchMediaKeyEventUnderWakelock(in KeyEvent keyEvent);
125 void registerMediaButtonIntent(in PendingIntent pi, in ComponentName c, IBinder token);
126 oneway void unregisterMediaButtonIntent(in PendingIntent pi);
128 oneway void registerMediaButtonEventReceiverForCalls(in ComponentName c);
129 oneway void unregisterMediaButtonEventReceiverForCalls();
132 * Register an IRemoteControlDisplay.
133 * Notify all IRemoteControlClient of the new display and cause the RemoteControlClient
134 * at the top of the stack to update the new display with its information.
135 * @param rcd the IRemoteControlDisplay to register. No effect if null.
136 * @param w the maximum width of the expected bitmap. Negative or zero values indicate this
137 * display doesn't need to receive artwork.
138 * @param h the maximum height of the expected bitmap. Negative or zero values indicate this
139 * display doesn't need to receive artwork.
141 oneway void registerRemoteControlDisplay(in IRemoteControlDisplay rcd, int w, int h);
143 * Unregister an IRemoteControlDisplay.
144 * No effect if the IRemoteControlDisplay hasn't been successfully registered.
145 * @param rcd the IRemoteControlDisplay to unregister. No effect if null.
147 oneway void unregisterRemoteControlDisplay(in IRemoteControlDisplay rcd);
149 * Update the size of the artwork used by an IRemoteControlDisplay.
150 * @param rcd the IRemoteControlDisplay with the new artwork size requirement
151 * @param w the maximum width of the expected bitmap. Negative or zero values indicate this
152 * display doesn't need to receive artwork.
153 * @param h the maximum height of the expected bitmap. Negative or zero values indicate this
154 * display doesn't need to receive artwork.
156 oneway void remoteControlDisplayUsesBitmapSize(in IRemoteControlDisplay rcd, int w, int h);
158 * Controls whether a remote control display needs periodic checks of the RemoteControlClient
159 * playback position to verify that the estimated position has not drifted from the actual
160 * position. By default the check is not performed.
161 * The IRemoteControlDisplay must have been previously registered for this to have any effect.
162 * @param rcd the IRemoteControlDisplay for which the anti-drift mechanism will be enabled
163 * or disabled. Not null.
164 * @param wantsSync if true, RemoteControlClient instances which expose their playback position
165 * to the framework will regularly compare the estimated playback position with the actual
166 * position, and will update the IRemoteControlDisplay implementation whenever a drift is
169 oneway void remoteControlDisplayWantsPlaybackPositionSync(in IRemoteControlDisplay rcd,
172 * Request the user of a RemoteControlClient to seek to the given playback position.
173 * @param generationId the RemoteControlClient generation counter for which this request is
174 * issued. Requests for an older generation than current one will be ignored.
175 * @param timeMs the time in ms to seek to, must be positive.
177 void setRemoteControlClientPlaybackPosition(int generationId, long timeMs);
180 * Do not use directly, use instead
181 * {@link android.media.AudioManager#registerRemoteControlClient(RemoteControlClient)}
183 int registerRemoteControlClient(in PendingIntent mediaIntent,
184 in IRemoteControlClient rcClient, in String callingPackageName);
186 * Do not use directly, use instead
187 * {@link android.media.AudioManager#unregisterRemoteControlClient(RemoteControlClient)}
189 oneway void unregisterRemoteControlClient(in PendingIntent mediaIntent,
190 in IRemoteControlClient rcClient);
192 oneway void setPlaybackInfoForRcc(int rccId, int what, int value);
193 void setPlaybackStateForRcc(int rccId, int state, long timeMs, float speed);
194 int getRemoteStreamMaxVolume();
195 int getRemoteStreamVolume();
196 oneway void registerRemoteVolumeObserverForRcc(int rccId, in IRemoteVolumeObserver rvo);
198 void startBluetoothSco(IBinder cb, int targetSdkVersion);
199 void stopBluetoothSco(IBinder cb);
201 void forceVolumeControlStream(int streamType, IBinder cb);
203 void setRingtonePlayer(IRingtonePlayer player);
204 IRingtonePlayer getRingtonePlayer();
205 int getMasterStreamType();
207 void setWiredDeviceConnectionState(int device, int state, String name);
208 int setBluetoothA2dpDeviceConnectionState(in BluetoothDevice device, int state);
210 AudioRoutesInfo startWatchingRoutes(in IAudioRoutesObserver observer);
212 boolean isCameraSoundForced();