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