• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 package android.media;
18 
19 import android.app.PendingIntent;
20 import android.bluetooth.BluetoothDevice;
21 import android.content.ComponentName;
22 import android.media.AudioAttributes;
23 import android.media.AudioRoutesInfo;
24 import android.media.IAudioFocusDispatcher;
25 import android.media.IAudioRoutesObserver;
26 import android.media.IRemoteControlClient;
27 import android.media.IRemoteControlDisplay;
28 import android.media.IRemoteVolumeObserver;
29 import android.media.IRingtonePlayer;
30 import android.media.IVolumeController;
31 import android.media.Rating;
32 import android.media.audiopolicy.AudioPolicyConfig;
33 import android.media.audiopolicy.IAudioPolicyCallback;
34 import android.net.Uri;
35 import android.view.KeyEvent;
36 
37 /**
38  * {@hide}
39  */
40 interface IAudioService {
41 
adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags, String callingPackage)42     void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags,
43             String callingPackage);
44 
adjustStreamVolume(int streamType, int direction, int flags, String callingPackage)45     void adjustStreamVolume(int streamType, int direction, int flags, String callingPackage);
46 
adjustMasterVolume(int direction, int flags, String callingPackage)47     void adjustMasterVolume(int direction, int flags, String callingPackage);
48 
setStreamVolume(int streamType, int index, int flags, String callingPackage)49     void setStreamVolume(int streamType, int index, int flags, String callingPackage);
50 
setRemoteStreamVolume(int index)51     oneway void setRemoteStreamVolume(int index);
52 
setMasterVolume(int index, int flags, String callingPackage)53     void setMasterVolume(int index, int flags, String callingPackage);
54 
setStreamSolo(int streamType, boolean state, IBinder cb)55     void setStreamSolo(int streamType, boolean state, IBinder cb);
56 
setStreamMute(int streamType, boolean state, IBinder cb)57     void setStreamMute(int streamType, boolean state, IBinder cb);
58 
isStreamMute(int streamType)59     boolean isStreamMute(int streamType);
60 
forceRemoteSubmixFullVolume(boolean startForcing, IBinder cb)61     void forceRemoteSubmixFullVolume(boolean startForcing, IBinder cb);
62 
setMasterMute(boolean state, int flags, String callingPackage, IBinder cb)63     void setMasterMute(boolean state, int flags, String callingPackage, IBinder cb);
64 
isMasterMute()65     boolean isMasterMute();
66 
getStreamVolume(int streamType)67     int getStreamVolume(int streamType);
68 
getMasterVolume()69     int getMasterVolume();
70 
getStreamMaxVolume(int streamType)71     int getStreamMaxVolume(int streamType);
72 
getMasterMaxVolume()73     int getMasterMaxVolume();
74 
getLastAudibleStreamVolume(int streamType)75     int getLastAudibleStreamVolume(int streamType);
76 
getLastAudibleMasterVolume()77     int getLastAudibleMasterVolume();
78 
setMicrophoneMute(boolean on, String callingPackage)79     void setMicrophoneMute(boolean on, String callingPackage);
80 
setRingerModeExternal(int ringerMode, String caller)81     void setRingerModeExternal(int ringerMode, String caller);
82 
setRingerModeInternal(int ringerMode, String caller)83     void setRingerModeInternal(int ringerMode, String caller);
84 
getRingerModeExternal()85     int getRingerModeExternal();
86 
getRingerModeInternal()87     int getRingerModeInternal();
88 
isValidRingerMode(int ringerMode)89     boolean isValidRingerMode(int ringerMode);
90 
setVibrateSetting(int vibrateType, int vibrateSetting)91     void setVibrateSetting(int vibrateType, int vibrateSetting);
92 
getVibrateSetting(int vibrateType)93     int getVibrateSetting(int vibrateType);
94 
shouldVibrate(int vibrateType)95     boolean shouldVibrate(int vibrateType);
96 
setMode(int mode, IBinder cb)97     void setMode(int mode, IBinder cb);
98 
getMode()99     int getMode();
100 
playSoundEffect(int effectType)101     oneway void playSoundEffect(int effectType);
102 
playSoundEffectVolume(int effectType, float volume)103     oneway void playSoundEffectVolume(int effectType, float volume);
104 
loadSoundEffects()105     boolean loadSoundEffects();
106 
unloadSoundEffects()107     oneway void unloadSoundEffects();
108 
reloadAudioSettings()109     oneway void reloadAudioSettings();
110 
avrcpSupportsAbsoluteVolume(String address, boolean support)111     oneway void avrcpSupportsAbsoluteVolume(String address, boolean support);
112 
setSpeakerphoneOn(boolean on)113     void setSpeakerphoneOn(boolean on);
114 
isSpeakerphoneOn()115     boolean isSpeakerphoneOn();
116 
setBluetoothScoOn(boolean on)117     void setBluetoothScoOn(boolean on);
118 
isBluetoothScoOn()119     boolean isBluetoothScoOn();
120 
setBluetoothA2dpOn(boolean on)121     void setBluetoothA2dpOn(boolean on);
122 
isBluetoothA2dpOn()123     boolean isBluetoothA2dpOn();
124 
requestAudioFocus(in AudioAttributes aa, int durationHint, IBinder cb, IAudioFocusDispatcher fd, String clientId, String callingPackageName, int flags, IAudioPolicyCallback pcb)125     int requestAudioFocus(in AudioAttributes aa, int durationHint, IBinder cb,
126             IAudioFocusDispatcher fd, String clientId, String callingPackageName, int flags,
127             IAudioPolicyCallback pcb);
128 
abandonAudioFocus(IAudioFocusDispatcher fd, String clientId, in AudioAttributes aa)129     int abandonAudioFocus(IAudioFocusDispatcher fd, String clientId, in AudioAttributes aa);
130 
unregisterAudioFocusClient(String clientId)131     void unregisterAudioFocusClient(String clientId);
132 
getCurrentAudioFocus()133     int getCurrentAudioFocus();
134 
135     /**
136      * Register an IRemoteControlDisplay.
137      * Success of registration is subject to a check on
138      *   the android.Manifest.permission.MEDIA_CONTENT_CONTROL permission.
139      * Notify all IRemoteControlClient of the new display and cause the RemoteControlClient
140      * at the top of the stack to update the new display with its information.
141      * @param rcd the IRemoteControlDisplay to register. No effect if null.
142      * @param w the maximum width of the expected bitmap. Negative or zero values indicate this
143      *   display doesn't need to receive artwork.
144      * @param h the maximum height of the expected bitmap. Negative or zero values indicate this
145      *   display doesn't need to receive artwork.
146      */
registerRemoteControlDisplay(in IRemoteControlDisplay rcd, int w, int h)147     boolean registerRemoteControlDisplay(in IRemoteControlDisplay rcd, int w, int h);
148 
149     /**
150      * Like registerRemoteControlDisplay, but with success being subject to a check on
151      *   the android.Manifest.permission.MEDIA_CONTENT_CONTROL permission, and if it fails,
152      *   success is subject to listenerComp being one of the ENABLED_NOTIFICATION_LISTENERS
153      *   components.
154      */
registerRemoteController(in IRemoteControlDisplay rcd, int w, int h, in ComponentName listenerComp)155     boolean registerRemoteController(in IRemoteControlDisplay rcd, int w, int h,
156             in ComponentName listenerComp);
157 
158     /**
159      * Unregister an IRemoteControlDisplay.
160      * No effect if the IRemoteControlDisplay hasn't been successfully registered.
161      * @param rcd the IRemoteControlDisplay to unregister. No effect if null.
162      */
unregisterRemoteControlDisplay(in IRemoteControlDisplay rcd)163     oneway void unregisterRemoteControlDisplay(in IRemoteControlDisplay rcd);
164     /**
165      * Update the size of the artwork used by an IRemoteControlDisplay.
166      * @param rcd the IRemoteControlDisplay with the new artwork size requirement
167      * @param w the maximum width of the expected bitmap. Negative or zero values indicate this
168      *   display doesn't need to receive artwork.
169      * @param h the maximum height of the expected bitmap. Negative or zero values indicate this
170      *   display doesn't need to receive artwork.
171      */
remoteControlDisplayUsesBitmapSize(in IRemoteControlDisplay rcd, int w, int h)172     oneway void remoteControlDisplayUsesBitmapSize(in IRemoteControlDisplay rcd, int w, int h);
173     /**
174      * Controls whether a remote control display needs periodic checks of the RemoteControlClient
175      * playback position to verify that the estimated position has not drifted from the actual
176      * position. By default the check is not performed.
177      * The IRemoteControlDisplay must have been previously registered for this to have any effect.
178      * @param rcd the IRemoteControlDisplay for which the anti-drift mechanism will be enabled
179      *     or disabled. Not null.
180      * @param wantsSync if true, RemoteControlClient instances which expose their playback position
181      *     to the framework will regularly compare the estimated playback position with the actual
182      *     position, and will update the IRemoteControlDisplay implementation whenever a drift is
183      *     detected.
184      */
remoteControlDisplayWantsPlaybackPositionSync(in IRemoteControlDisplay rcd, boolean wantsSync)185     oneway void remoteControlDisplayWantsPlaybackPositionSync(in IRemoteControlDisplay rcd,
186             boolean wantsSync);
187 
startBluetoothSco(IBinder cb, int targetSdkVersion)188     void startBluetoothSco(IBinder cb, int targetSdkVersion);
startBluetoothScoVirtualCall(IBinder cb)189     void startBluetoothScoVirtualCall(IBinder cb);
stopBluetoothSco(IBinder cb)190     void stopBluetoothSco(IBinder cb);
191 
forceVolumeControlStream(int streamType, IBinder cb)192     void forceVolumeControlStream(int streamType, IBinder cb);
193 
setRingtonePlayer(IRingtonePlayer player)194     void setRingtonePlayer(IRingtonePlayer player);
getRingtonePlayer()195     IRingtonePlayer getRingtonePlayer();
getMasterStreamType()196     int getMasterStreamType();
197 
setWiredDeviceConnectionState(int device, int state, String name)198     void setWiredDeviceConnectionState(int device, int state, String name);
setBluetoothA2dpDeviceConnectionState(in BluetoothDevice device, int state, int profile)199     int setBluetoothA2dpDeviceConnectionState(in BluetoothDevice device, int state, int profile);
200 
startWatchingRoutes(in IAudioRoutesObserver observer)201     AudioRoutesInfo startWatchingRoutes(in IAudioRoutesObserver observer);
202 
isCameraSoundForced()203     boolean isCameraSoundForced();
204 
setVolumeController(in IVolumeController controller)205     void setVolumeController(in IVolumeController controller);
206 
notifyVolumeControllerVisible(in IVolumeController controller, boolean visible)207     void notifyVolumeControllerVisible(in IVolumeController controller, boolean visible);
208 
isStreamAffectedByRingerMode(int streamType)209     boolean isStreamAffectedByRingerMode(int streamType);
210 
disableSafeMediaVolume()211     void disableSafeMediaVolume();
212 
setHdmiSystemAudioSupported(boolean on)213     int setHdmiSystemAudioSupported(boolean on);
214 
isHdmiSystemAudioSupported()215     boolean isHdmiSystemAudioSupported();
216 
registerAudioPolicy(in AudioPolicyConfig policyConfig, in IAudioPolicyCallback pcb, boolean hasFocusListener)217            String registerAudioPolicy(in AudioPolicyConfig policyConfig,
218                     in IAudioPolicyCallback pcb, boolean hasFocusListener);
unregisterAudioPolicyAsync(in IAudioPolicyCallback pcb)219     oneway void unregisterAudioPolicyAsync(in IAudioPolicyCallback pcb);
220 
setFocusPropertiesForPolicy(int duckingBehavior, in IAudioPolicyCallback pcb)221            int setFocusPropertiesForPolicy(int duckingBehavior, in IAudioPolicyCallback pcb);
222 }
223