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.bluetooth.BluetoothDevice;
20 import android.media.AudioAttributes;
21 import android.media.AudioFocusInfo;
22 import android.media.AudioPlaybackConfiguration;
23 import android.media.AudioRecordingConfiguration;
24 import android.media.AudioRoutesInfo;
25 import android.media.IAudioFocusDispatcher;
26 import android.media.IAudioRoutesObserver;
27 import android.media.IAudioServerStateDispatcher;
28 import android.media.IPlaybackConfigDispatcher;
29 import android.media.IRecordingConfigDispatcher;
30 import android.media.IRingtonePlayer;
31 import android.media.IVolumeController;
32 import android.media.IVolumeController;
33 import android.media.PlayerBase;
34 import android.media.VolumePolicy;
35 import android.media.audiopolicy.AudioPolicyConfig;
36 import android.media.audiopolicy.IAudioPolicyCallback;
41 interface IAudioService {
42 // C++ and Java methods below.
44 // WARNING: When methods are inserted or deleted in this section, the transaction IDs in
45 // frameworks/native/include/audiomanager/IAudioManager.h must be updated to match the order
48 // When a method's argument list is changed, BpAudioManager's corresponding serialization code
49 // (if any) in frameworks/native/services/audiomanager/IAudioManager.cpp must be updated.
51 int trackPlayer(in PlayerBase.PlayerIdCard pic);
53 oneway void playerAttributes(in int piid, in AudioAttributes attr);
55 oneway void playerEvent(in int piid, in int event);
57 oneway void releasePlayer(in int piid);
59 // Java-only methods below.
61 oneway void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags,
62 String callingPackage, String caller);
64 void adjustStreamVolume(int streamType, int direction, int flags, String callingPackage);
66 void setStreamVolume(int streamType, int index, int flags, String callingPackage);
68 boolean isStreamMute(int streamType);
70 void forceRemoteSubmixFullVolume(boolean startForcing, IBinder cb);
72 boolean isMasterMute();
74 void setMasterMute(boolean mute, int flags, String callingPackage, int userId);
76 int getStreamVolume(int streamType);
78 int getStreamMinVolume(int streamType);
80 int getStreamMaxVolume(int streamType);
82 int getLastAudibleStreamVolume(int streamType);
84 void setMicrophoneMute(boolean on, String callingPackage, int userId);
86 void setRingerModeExternal(int ringerMode, String caller);
88 void setRingerModeInternal(int ringerMode, String caller);
90 int getRingerModeExternal();
92 int getRingerModeInternal();
94 boolean isValidRingerMode(int ringerMode);
96 void setVibrateSetting(int vibrateType, int vibrateSetting);
98 int getVibrateSetting(int vibrateType);
100 boolean shouldVibrate(int vibrateType);
102 void setMode(int mode, IBinder cb, String callingPackage);
106 oneway void playSoundEffect(int effectType);
108 oneway void playSoundEffectVolume(int effectType, float volume);
110 boolean loadSoundEffects();
112 oneway void unloadSoundEffects();
114 oneway void reloadAudioSettings();
116 oneway void avrcpSupportsAbsoluteVolume(String address, boolean support);
118 void setSpeakerphoneOn(boolean on);
120 boolean isSpeakerphoneOn();
122 void setBluetoothScoOn(boolean on);
124 boolean isBluetoothScoOn();
126 void setBluetoothA2dpOn(boolean on);
128 boolean isBluetoothA2dpOn();
130 int requestAudioFocus(in AudioAttributes aa, int durationHint, IBinder cb,
131 IAudioFocusDispatcher fd, String clientId, String callingPackageName, int flags,
132 IAudioPolicyCallback pcb, int sdk);
134 int abandonAudioFocus(IAudioFocusDispatcher fd, String clientId, in AudioAttributes aa,
135 in String callingPackageName);
137 void unregisterAudioFocusClient(String clientId);
139 int getCurrentAudioFocus();
141 void startBluetoothSco(IBinder cb, int targetSdkVersion);
142 void startBluetoothScoVirtualCall(IBinder cb);
143 void stopBluetoothSco(IBinder cb);
145 void forceVolumeControlStream(int streamType, IBinder cb);
147 void setRingtonePlayer(IRingtonePlayer player);
148 IRingtonePlayer getRingtonePlayer();
149 int getUiSoundsStreamType();
151 void setWiredDeviceConnectionState(int type, int state, String address, String name,
154 void setHearingAidDeviceConnectionState(in BluetoothDevice device, int state);
156 int setBluetoothA2dpDeviceConnectionState(in BluetoothDevice device, int state, int profile);
158 void handleBluetoothA2dpDeviceConfigChange(in BluetoothDevice device);
160 AudioRoutesInfo startWatchingRoutes(in IAudioRoutesObserver observer);
162 boolean isCameraSoundForced();
164 void setVolumeController(in IVolumeController controller);
166 void notifyVolumeControllerVisible(in IVolumeController controller, boolean visible);
168 boolean isStreamAffectedByRingerMode(int streamType);
170 boolean isStreamAffectedByMute(int streamType);
172 void disableSafeMediaVolume(String callingPackage);
174 int setHdmiSystemAudioSupported(boolean on);
176 boolean isHdmiSystemAudioSupported();
178 String registerAudioPolicy(in AudioPolicyConfig policyConfig,
179 in IAudioPolicyCallback pcb, boolean hasFocusListener, boolean isFocusPolicy,
180 boolean isVolumeController);
182 oneway void unregisterAudioPolicyAsync(in IAudioPolicyCallback pcb);
184 int addMixForPolicy(in AudioPolicyConfig policyConfig, in IAudioPolicyCallback pcb);
186 int removeMixForPolicy(in AudioPolicyConfig policyConfig, in IAudioPolicyCallback pcb);
188 int setFocusPropertiesForPolicy(int duckingBehavior, in IAudioPolicyCallback pcb);
190 void setVolumePolicy(in VolumePolicy policy);
192 void registerRecordingCallback(in IRecordingConfigDispatcher rcdb);
194 oneway void unregisterRecordingCallback(in IRecordingConfigDispatcher rcdb);
196 List<AudioRecordingConfiguration> getActiveRecordingConfigurations();
198 void registerPlaybackCallback(in IPlaybackConfigDispatcher pcdb);
200 oneway void unregisterPlaybackCallback(in IPlaybackConfigDispatcher pcdb);
202 List<AudioPlaybackConfiguration> getActivePlaybackConfigurations();
204 void disableRingtoneSync(in int userId);
206 int getFocusRampTimeMs(in int focusGain, in AudioAttributes attr);
208 int dispatchFocusChange(in AudioFocusInfo afi, in int focusChange,
209 in IAudioPolicyCallback pcb);
211 oneway void playerHasOpPlayAudio(in int piid, in boolean hasOpPlayAudio);
213 int setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(in BluetoothDevice device,
214 int state, int profile, boolean suppressNoisyIntent);
216 oneway void setFocusRequestResultFromExtPolicy(in AudioFocusInfo afi, int requestResult,
217 in IAudioPolicyCallback pcb);
219 void registerAudioServerStateDispatcher(IAudioServerStateDispatcher asd);
221 oneway void unregisterAudioServerStateDispatcher(IAudioServerStateDispatcher asd);
223 boolean isAudioServerRunning();
225 // WARNING: read warning at top of file, new methods that need to be used by native
226 // code via IAudioManager.h need to be added to the top section.