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.AudioFocusInfo; 24 import android.media.AudioPlaybackConfiguration; 25 import android.media.AudioRecordingConfiguration; 26 import android.media.AudioRoutesInfo; 27 import android.media.IAudioFocusDispatcher; 28 import android.media.IAudioRoutesObserver; 29 import android.media.IPlaybackConfigDispatcher; 30 import android.media.IRecordingConfigDispatcher; 31 import android.media.IRingtonePlayer; 32 import android.media.IVolumeController; 33 import android.media.PlayerBase; 34 import android.media.Rating; 35 import android.media.VolumePolicy; 36 import android.media.audiopolicy.AudioPolicyConfig; 37 import android.media.audiopolicy.IAudioPolicyCallback; 38 import android.net.Uri; 39 import android.view.KeyEvent; 40 41 /** 42 * {@hide} 43 */ 44 interface IAudioService { 45 46 // WARNING: When methods are inserted or deleted, the transaction IDs in 47 // frameworks/native/include/audiomanager/IAudioManager.h must be updated to match the order 48 // in this file. 49 // 50 // When a method's argument list is changed, BpAudioManager's corresponding serialization code 51 // (if any) in frameworks/native/services/audiomanager/IAudioManager.cpp must be updated. 52 adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags, String callingPackage, String caller)53 oneway void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags, 54 String callingPackage, String caller); 55 adjustStreamVolume(int streamType, int direction, int flags, String callingPackage)56 void adjustStreamVolume(int streamType, int direction, int flags, String callingPackage); 57 setStreamVolume(int streamType, int index, int flags, String callingPackage)58 void setStreamVolume(int streamType, int index, int flags, String callingPackage); 59 isStreamMute(int streamType)60 boolean isStreamMute(int streamType); 61 forceRemoteSubmixFullVolume(boolean startForcing, IBinder cb)62 void forceRemoteSubmixFullVolume(boolean startForcing, IBinder cb); 63 isMasterMute()64 boolean isMasterMute(); 65 setMasterMute(boolean mute, int flags, String callingPackage, int userId)66 void setMasterMute(boolean mute, int flags, String callingPackage, int userId); 67 getStreamVolume(int streamType)68 int getStreamVolume(int streamType); 69 getStreamMinVolume(int streamType)70 int getStreamMinVolume(int streamType); 71 getStreamMaxVolume(int streamType)72 int getStreamMaxVolume(int streamType); 73 getLastAudibleStreamVolume(int streamType)74 int getLastAudibleStreamVolume(int streamType); 75 setMicrophoneMute(boolean on, String callingPackage, int userId)76 void setMicrophoneMute(boolean on, String callingPackage, int userId); 77 setRingerModeExternal(int ringerMode, String caller)78 void setRingerModeExternal(int ringerMode, String caller); 79 setRingerModeInternal(int ringerMode, String caller)80 void setRingerModeInternal(int ringerMode, String caller); 81 getRingerModeExternal()82 int getRingerModeExternal(); 83 getRingerModeInternal()84 int getRingerModeInternal(); 85 isValidRingerMode(int ringerMode)86 boolean isValidRingerMode(int ringerMode); 87 setVibrateSetting(int vibrateType, int vibrateSetting)88 void setVibrateSetting(int vibrateType, int vibrateSetting); 89 getVibrateSetting(int vibrateType)90 int getVibrateSetting(int vibrateType); 91 shouldVibrate(int vibrateType)92 boolean shouldVibrate(int vibrateType); 93 setMode(int mode, IBinder cb, String callingPackage)94 void setMode(int mode, IBinder cb, String callingPackage); 95 getMode()96 int getMode(); 97 playSoundEffect(int effectType)98 oneway void playSoundEffect(int effectType); 99 playSoundEffectVolume(int effectType, float volume)100 oneway void playSoundEffectVolume(int effectType, float volume); 101 loadSoundEffects()102 boolean loadSoundEffects(); 103 unloadSoundEffects()104 oneway void unloadSoundEffects(); 105 reloadAudioSettings()106 oneway void reloadAudioSettings(); 107 avrcpSupportsAbsoluteVolume(String address, boolean support)108 oneway void avrcpSupportsAbsoluteVolume(String address, boolean support); 109 setSpeakerphoneOn(boolean on)110 void setSpeakerphoneOn(boolean on); 111 isSpeakerphoneOn()112 boolean isSpeakerphoneOn(); 113 setBluetoothScoOn(boolean on)114 void setBluetoothScoOn(boolean on); 115 isBluetoothScoOn()116 boolean isBluetoothScoOn(); 117 setBluetoothA2dpOn(boolean on)118 void setBluetoothA2dpOn(boolean on); 119 isBluetoothA2dpOn()120 boolean isBluetoothA2dpOn(); 121 requestAudioFocus(in AudioAttributes aa, int durationHint, IBinder cb, IAudioFocusDispatcher fd, String clientId, String callingPackageName, int flags, IAudioPolicyCallback pcb, int sdk)122 int requestAudioFocus(in AudioAttributes aa, int durationHint, IBinder cb, 123 IAudioFocusDispatcher fd, String clientId, String callingPackageName, int flags, 124 IAudioPolicyCallback pcb, int sdk); 125 abandonAudioFocus(IAudioFocusDispatcher fd, String clientId, in AudioAttributes aa, in String callingPackageName)126 int abandonAudioFocus(IAudioFocusDispatcher fd, String clientId, in AudioAttributes aa, 127 in String callingPackageName); 128 unregisterAudioFocusClient(String clientId)129 void unregisterAudioFocusClient(String clientId); 130 getCurrentAudioFocus()131 int getCurrentAudioFocus(); 132 startBluetoothSco(IBinder cb, int targetSdkVersion)133 void startBluetoothSco(IBinder cb, int targetSdkVersion); startBluetoothScoVirtualCall(IBinder cb)134 void startBluetoothScoVirtualCall(IBinder cb); stopBluetoothSco(IBinder cb)135 void stopBluetoothSco(IBinder cb); 136 forceVolumeControlStream(int streamType, IBinder cb)137 void forceVolumeControlStream(int streamType, IBinder cb); 138 setRingtonePlayer(IRingtonePlayer player)139 void setRingtonePlayer(IRingtonePlayer player); getRingtonePlayer()140 IRingtonePlayer getRingtonePlayer(); getUiSoundsStreamType()141 int getUiSoundsStreamType(); 142 setWiredDeviceConnectionState(int type, int state, String address, String name, String caller)143 void setWiredDeviceConnectionState(int type, int state, String address, String name, 144 String caller); 145 setBluetoothA2dpDeviceConnectionState(in BluetoothDevice device, int state, int profile)146 int setBluetoothA2dpDeviceConnectionState(in BluetoothDevice device, int state, int profile); 147 handleBluetoothA2dpDeviceConfigChange(in BluetoothDevice device)148 void handleBluetoothA2dpDeviceConfigChange(in BluetoothDevice device); 149 startWatchingRoutes(in IAudioRoutesObserver observer)150 AudioRoutesInfo startWatchingRoutes(in IAudioRoutesObserver observer); 151 isCameraSoundForced()152 boolean isCameraSoundForced(); 153 setVolumeController(in IVolumeController controller)154 void setVolumeController(in IVolumeController controller); 155 notifyVolumeControllerVisible(in IVolumeController controller, boolean visible)156 void notifyVolumeControllerVisible(in IVolumeController controller, boolean visible); 157 isStreamAffectedByRingerMode(int streamType)158 boolean isStreamAffectedByRingerMode(int streamType); 159 isStreamAffectedByMute(int streamType)160 boolean isStreamAffectedByMute(int streamType); 161 disableSafeMediaVolume(String callingPackage)162 void disableSafeMediaVolume(String callingPackage); 163 setHdmiSystemAudioSupported(boolean on)164 int setHdmiSystemAudioSupported(boolean on); 165 isHdmiSystemAudioSupported()166 boolean isHdmiSystemAudioSupported(); 167 registerAudioPolicy(in AudioPolicyConfig policyConfig, in IAudioPolicyCallback pcb, boolean hasFocusListener, boolean isFocusPolicy)168 String registerAudioPolicy(in AudioPolicyConfig policyConfig, 169 in IAudioPolicyCallback pcb, boolean hasFocusListener, boolean isFocusPolicy); 170 unregisterAudioPolicyAsync(in IAudioPolicyCallback pcb)171 oneway void unregisterAudioPolicyAsync(in IAudioPolicyCallback pcb); 172 setFocusPropertiesForPolicy(int duckingBehavior, in IAudioPolicyCallback pcb)173 int setFocusPropertiesForPolicy(int duckingBehavior, in IAudioPolicyCallback pcb); 174 setVolumePolicy(in VolumePolicy policy)175 void setVolumePolicy(in VolumePolicy policy); 176 registerRecordingCallback(in IRecordingConfigDispatcher rcdb)177 void registerRecordingCallback(in IRecordingConfigDispatcher rcdb); 178 unregisterRecordingCallback(in IRecordingConfigDispatcher rcdb)179 oneway void unregisterRecordingCallback(in IRecordingConfigDispatcher rcdb); 180 getActiveRecordingConfigurations()181 List<AudioRecordingConfiguration> getActiveRecordingConfigurations(); 182 registerPlaybackCallback(in IPlaybackConfigDispatcher pcdb)183 void registerPlaybackCallback(in IPlaybackConfigDispatcher pcdb); 184 unregisterPlaybackCallback(in IPlaybackConfigDispatcher pcdb)185 oneway void unregisterPlaybackCallback(in IPlaybackConfigDispatcher pcdb); 186 getActivePlaybackConfigurations()187 List<AudioPlaybackConfiguration> getActivePlaybackConfigurations(); 188 trackPlayer(in PlayerBase.PlayerIdCard pic)189 int trackPlayer(in PlayerBase.PlayerIdCard pic); 190 playerAttributes(in int piid, in AudioAttributes attr)191 oneway void playerAttributes(in int piid, in AudioAttributes attr); 192 playerEvent(in int piid, in int event)193 oneway void playerEvent(in int piid, in int event); 194 releasePlayer(in int piid)195 oneway void releasePlayer(in int piid); 196 disableRingtoneSync(in int userId)197 void disableRingtoneSync(in int userId); 198 getFocusRampTimeMs(in int focusGain, in AudioAttributes attr)199 int getFocusRampTimeMs(in int focusGain, in AudioAttributes attr); 200 dispatchFocusChange(in AudioFocusInfo afi, in int focusChange, in IAudioPolicyCallback pcb)201 int dispatchFocusChange(in AudioFocusInfo afi, in int focusChange, 202 in IAudioPolicyCallback pcb); 203 204 // WARNING: read warning at top of file, it is recommended to add new methods at the end 205 } 206