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.AudioRecordingConfiguration; 24 import android.media.AudioRoutesInfo; 25 import android.media.IAudioFocusDispatcher; 26 import android.media.IAudioRoutesObserver; 27 import android.media.IRecordingConfigDispatcher; 28 import android.media.IRingtonePlayer; 29 import android.media.IVolumeController; 30 import android.media.Rating; 31 import android.media.VolumePolicy; 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, String caller)42 oneway void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags, 43 String callingPackage, String caller); 44 adjustStreamVolume(int streamType, int direction, int flags, String callingPackage)45 void adjustStreamVolume(int streamType, int direction, int flags, String callingPackage); 46 setStreamVolume(int streamType, int index, int flags, String callingPackage)47 void setStreamVolume(int streamType, int index, int flags, String callingPackage); 48 isStreamMute(int streamType)49 boolean isStreamMute(int streamType); 50 forceRemoteSubmixFullVolume(boolean startForcing, IBinder cb)51 void forceRemoteSubmixFullVolume(boolean startForcing, IBinder cb); 52 isMasterMute()53 boolean isMasterMute(); 54 setMasterMute(boolean mute, int flags, String callingPackage, int userId)55 void setMasterMute(boolean mute, int flags, String callingPackage, int userId); 56 getStreamVolume(int streamType)57 int getStreamVolume(int streamType); 58 getStreamMinVolume(int streamType)59 int getStreamMinVolume(int streamType); 60 getStreamMaxVolume(int streamType)61 int getStreamMaxVolume(int streamType); 62 getLastAudibleStreamVolume(int streamType)63 int getLastAudibleStreamVolume(int streamType); 64 setMicrophoneMute(boolean on, String callingPackage, int userId)65 void setMicrophoneMute(boolean on, String callingPackage, int userId); 66 setRingerModeExternal(int ringerMode, String caller)67 void setRingerModeExternal(int ringerMode, String caller); 68 setRingerModeInternal(int ringerMode, String caller)69 void setRingerModeInternal(int ringerMode, String caller); 70 getRingerModeExternal()71 int getRingerModeExternal(); 72 getRingerModeInternal()73 int getRingerModeInternal(); 74 isValidRingerMode(int ringerMode)75 boolean isValidRingerMode(int ringerMode); 76 setVibrateSetting(int vibrateType, int vibrateSetting)77 void setVibrateSetting(int vibrateType, int vibrateSetting); 78 getVibrateSetting(int vibrateType)79 int getVibrateSetting(int vibrateType); 80 shouldVibrate(int vibrateType)81 boolean shouldVibrate(int vibrateType); 82 setMode(int mode, IBinder cb, String callingPackage)83 void setMode(int mode, IBinder cb, String callingPackage); 84 getMode()85 int getMode(); 86 playSoundEffect(int effectType)87 oneway void playSoundEffect(int effectType); 88 playSoundEffectVolume(int effectType, float volume)89 oneway void playSoundEffectVolume(int effectType, float volume); 90 loadSoundEffects()91 boolean loadSoundEffects(); 92 unloadSoundEffects()93 oneway void unloadSoundEffects(); 94 reloadAudioSettings()95 oneway void reloadAudioSettings(); 96 avrcpSupportsAbsoluteVolume(String address, boolean support)97 oneway void avrcpSupportsAbsoluteVolume(String address, boolean support); 98 setSpeakerphoneOn(boolean on)99 void setSpeakerphoneOn(boolean on); 100 isSpeakerphoneOn()101 boolean isSpeakerphoneOn(); 102 setBluetoothScoOn(boolean on)103 void setBluetoothScoOn(boolean on); 104 isBluetoothScoOn()105 boolean isBluetoothScoOn(); 106 setBluetoothA2dpOn(boolean on)107 void setBluetoothA2dpOn(boolean on); 108 isBluetoothA2dpOn()109 boolean isBluetoothA2dpOn(); 110 requestAudioFocus(in AudioAttributes aa, int durationHint, IBinder cb, IAudioFocusDispatcher fd, String clientId, String callingPackageName, int flags, IAudioPolicyCallback pcb)111 int requestAudioFocus(in AudioAttributes aa, int durationHint, IBinder cb, 112 IAudioFocusDispatcher fd, String clientId, String callingPackageName, int flags, 113 IAudioPolicyCallback pcb); 114 abandonAudioFocus(IAudioFocusDispatcher fd, String clientId, in AudioAttributes aa)115 int abandonAudioFocus(IAudioFocusDispatcher fd, String clientId, in AudioAttributes aa); 116 unregisterAudioFocusClient(String clientId)117 void unregisterAudioFocusClient(String clientId); 118 getCurrentAudioFocus()119 int getCurrentAudioFocus(); 120 startBluetoothSco(IBinder cb, int targetSdkVersion)121 void startBluetoothSco(IBinder cb, int targetSdkVersion); startBluetoothScoVirtualCall(IBinder cb)122 void startBluetoothScoVirtualCall(IBinder cb); stopBluetoothSco(IBinder cb)123 void stopBluetoothSco(IBinder cb); 124 forceVolumeControlStream(int streamType, IBinder cb)125 void forceVolumeControlStream(int streamType, IBinder cb); 126 setRingtonePlayer(IRingtonePlayer player)127 void setRingtonePlayer(IRingtonePlayer player); getRingtonePlayer()128 IRingtonePlayer getRingtonePlayer(); getUiSoundsStreamType()129 int getUiSoundsStreamType(); 130 setWiredDeviceConnectionState(int type, int state, String address, String name, String caller)131 void setWiredDeviceConnectionState(int type, int state, String address, String name, 132 String caller); 133 setBluetoothA2dpDeviceConnectionState(in BluetoothDevice device, int state, int profile)134 int setBluetoothA2dpDeviceConnectionState(in BluetoothDevice device, int state, int profile); 135 startWatchingRoutes(in IAudioRoutesObserver observer)136 AudioRoutesInfo startWatchingRoutes(in IAudioRoutesObserver observer); 137 isCameraSoundForced()138 boolean isCameraSoundForced(); 139 setVolumeController(in IVolumeController controller)140 void setVolumeController(in IVolumeController controller); 141 notifyVolumeControllerVisible(in IVolumeController controller, boolean visible)142 void notifyVolumeControllerVisible(in IVolumeController controller, boolean visible); 143 isStreamAffectedByRingerMode(int streamType)144 boolean isStreamAffectedByRingerMode(int streamType); 145 isStreamAffectedByMute(int streamType)146 boolean isStreamAffectedByMute(int streamType); 147 disableSafeMediaVolume(String callingPackage)148 void disableSafeMediaVolume(String callingPackage); 149 setHdmiSystemAudioSupported(boolean on)150 int setHdmiSystemAudioSupported(boolean on); 151 isHdmiSystemAudioSupported()152 boolean isHdmiSystemAudioSupported(); 153 registerAudioPolicy(in AudioPolicyConfig policyConfig, in IAudioPolicyCallback pcb, boolean hasFocusListener)154 String registerAudioPolicy(in AudioPolicyConfig policyConfig, 155 in IAudioPolicyCallback pcb, boolean hasFocusListener); 156 unregisterAudioPolicyAsync(in IAudioPolicyCallback pcb)157 oneway void unregisterAudioPolicyAsync(in IAudioPolicyCallback pcb); 158 setFocusPropertiesForPolicy(int duckingBehavior, in IAudioPolicyCallback pcb)159 int setFocusPropertiesForPolicy(int duckingBehavior, in IAudioPolicyCallback pcb); 160 setVolumePolicy(in VolumePolicy policy)161 void setVolumePolicy(in VolumePolicy policy); 162 registerRecordingCallback(in IRecordingConfigDispatcher rcdb)163 void registerRecordingCallback(in IRecordingConfigDispatcher rcdb); 164 unregisterRecordingCallback(in IRecordingConfigDispatcher rcdb)165 oneway void unregisterRecordingCallback(in IRecordingConfigDispatcher rcdb); 166 getActiveRecordingConfigurations()167 List<AudioRecordingConfiguration> getActiveRecordingConfigurations(); 168 } 169