IAudioService.aidl revision 5a0cf7a27f3953a1266af48543ccd9024f4cd89f
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 17package android.media; 18 19import android.app.PendingIntent; 20import android.bluetooth.BluetoothDevice; 21import android.content.ComponentName; 22import android.media.AudioRoutesInfo; 23import android.media.IAudioFocusDispatcher; 24import android.media.IAudioRoutesObserver; 25import android.media.IRemoteControlClient; 26import android.media.IRemoteControlDisplay; 27import android.media.IRemoteVolumeObserver; 28import android.media.IRingtonePlayer; 29import android.net.Uri; 30import android.view.KeyEvent; 31 32/** 33 * {@hide} 34 */ 35interface IAudioService { 36 37 void adjustVolume(int direction, int flags, String callingPackage); 38 39 oneway void adjustLocalOrRemoteStreamVolume(int streamType, int direction, 40 String callingPackage); 41 42 void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags, 43 String callingPackage); 44 45 void adjustStreamVolume(int streamType, int direction, int flags, String callingPackage); 46 47 void adjustMasterVolume(int direction, int flags, String callingPackage); 48 49 void setStreamVolume(int streamType, int index, int flags, String callingPackage); 50 51 oneway void setRemoteStreamVolume(int index); 52 53 void setMasterVolume(int index, int flags, String callingPackage); 54 55 void setStreamSolo(int streamType, boolean state, IBinder cb); 56 57 void setStreamMute(int streamType, boolean state, IBinder cb); 58 59 boolean isStreamMute(int streamType); 60 61 void setMasterMute(boolean state, int flags, IBinder cb); 62 63 boolean isMasterMute(); 64 65 int getStreamVolume(int streamType); 66 67 int getMasterVolume(); 68 69 int getStreamMaxVolume(int streamType); 70 71 int getMasterMaxVolume(); 72 73 int getLastAudibleStreamVolume(int streamType); 74 75 int getLastAudibleMasterVolume(); 76 77 void setRingerMode(int ringerMode); 78 79 int getRingerMode(); 80 81 void setVibrateSetting(int vibrateType, int vibrateSetting); 82 83 int getVibrateSetting(int vibrateType); 84 85 boolean shouldVibrate(int vibrateType); 86 87 void setMode(int mode, IBinder cb); 88 89 int getMode(); 90 91 oneway void playSoundEffect(int effectType); 92 93 oneway void playSoundEffectVolume(int effectType, float volume); 94 95 boolean loadSoundEffects(); 96 97 oneway void unloadSoundEffects(); 98 99 oneway void reloadAudioSettings(); 100 101 oneway void avrcpSupportsAbsoluteVolume(String address, boolean support); 102 103 oneway void avrcpUpdateVolume(int oldVolume, int volume); 104 105 void setSpeakerphoneOn(boolean on); 106 107 boolean isSpeakerphoneOn(); 108 109 void setBluetoothScoOn(boolean on); 110 111 boolean isBluetoothScoOn(); 112 113 void setBluetoothA2dpOn(boolean on); 114 115 boolean isBluetoothA2dpOn(); 116 117 oneway void setRemoteSubmixOn(boolean on, int address); 118 119 int requestAudioFocus(int mainStreamType, int durationHint, IBinder cb, 120 IAudioFocusDispatcher fd, String clientId, String callingPackageName); 121 122 int abandonAudioFocus(IAudioFocusDispatcher fd, String clientId); 123 124 void unregisterAudioFocusClient(String clientId); 125 126 int getCurrentAudioFocus(); 127 128 oneway void dispatchMediaKeyEvent(in KeyEvent keyEvent); 129 void dispatchMediaKeyEventUnderWakelock(in KeyEvent keyEvent); 130 131 void registerMediaButtonIntent(in PendingIntent pi, in ComponentName c, IBinder token); 132 oneway void unregisterMediaButtonIntent(in PendingIntent pi); 133 134 oneway void registerMediaButtonEventReceiverForCalls(in ComponentName c); 135 oneway void unregisterMediaButtonEventReceiverForCalls(); 136 137 /** 138 * Register an IRemoteControlDisplay. 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 */ 147 oneway void registerRemoteControlDisplay(in IRemoteControlDisplay rcd, int w, int h); 148 /** 149 * Unregister an IRemoteControlDisplay. 150 * No effect if the IRemoteControlDisplay hasn't been successfully registered. 151 * @param rcd the IRemoteControlDisplay to unregister. No effect if null. 152 */ 153 oneway void unregisterRemoteControlDisplay(in IRemoteControlDisplay rcd); 154 /** 155 * Update the size of the artwork used by an IRemoteControlDisplay. 156 * @param rcd the IRemoteControlDisplay with the new artwork size requirement 157 * @param w the maximum width of the expected bitmap. Negative or zero values indicate this 158 * display doesn't need to receive artwork. 159 * @param h the maximum height of the expected bitmap. Negative or zero values indicate this 160 * display doesn't need to receive artwork. 161 */ 162 oneway void remoteControlDisplayUsesBitmapSize(in IRemoteControlDisplay rcd, int w, int h); 163 /** 164 * Controls whether a remote control display needs periodic checks of the RemoteControlClient 165 * playback position to verify that the estimated position has not drifted from the actual 166 * position. By default the check is not performed. 167 * The IRemoteControlDisplay must have been previously registered for this to have any effect. 168 * @param rcd the IRemoteControlDisplay for which the anti-drift mechanism will be enabled 169 * or disabled. Not null. 170 * @param wantsSync if true, RemoteControlClient instances which expose their playback position 171 * to the framework will regularly compare the estimated playback position with the actual 172 * position, and will update the IRemoteControlDisplay implementation whenever a drift is 173 * detected. 174 */ 175 oneway void remoteControlDisplayWantsPlaybackPositionSync(in IRemoteControlDisplay rcd, 176 boolean wantsSync); 177 /** 178 * Request the user of a RemoteControlClient to seek to the given playback position. 179 * @param generationId the RemoteControlClient generation counter for which this request is 180 * issued. Requests for an older generation than current one will be ignored. 181 * @param timeMs the time in ms to seek to, must be positive. 182 */ 183 void setRemoteControlClientPlaybackPosition(int generationId, long timeMs); 184 185 /** 186 * Do not use directly, use instead 187 * {@link android.media.AudioManager#registerRemoteControlClient(RemoteControlClient)} 188 */ 189 int registerRemoteControlClient(in PendingIntent mediaIntent, 190 in IRemoteControlClient rcClient, in String callingPackageName); 191 /** 192 * Do not use directly, use instead 193 * {@link android.media.AudioManager#unregisterRemoteControlClient(RemoteControlClient)} 194 */ 195 oneway void unregisterRemoteControlClient(in PendingIntent mediaIntent, 196 in IRemoteControlClient rcClient); 197 198 oneway void setPlaybackInfoForRcc(int rccId, int what, int value); 199 void setPlaybackStateForRcc(int rccId, int state, long timeMs, float speed); 200 int getRemoteStreamMaxVolume(); 201 int getRemoteStreamVolume(); 202 oneway void registerRemoteVolumeObserverForRcc(int rccId, in IRemoteVolumeObserver rvo); 203 204 void startBluetoothSco(IBinder cb, int targetSdkVersion); 205 void stopBluetoothSco(IBinder cb); 206 207 void forceVolumeControlStream(int streamType, IBinder cb); 208 209 void setRingtonePlayer(IRingtonePlayer player); 210 IRingtonePlayer getRingtonePlayer(); 211 int getMasterStreamType(); 212 213 void setWiredDeviceConnectionState(int device, int state, String name); 214 int setBluetoothA2dpDeviceConnectionState(in BluetoothDevice device, int state); 215 216 AudioRoutesInfo startWatchingRoutes(in IAudioRoutesObserver observer); 217 218 boolean isCameraSoundForced(); 219} 220