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); 38 39 oneway void adjustLocalOrRemoteStreamVolume(int streamType, int direction); 40 41 void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags); 42 43 void adjustStreamVolume(int streamType, int direction, int flags); 44 45 void adjustMasterVolume(int direction, int flags); 46 47 void setStreamVolume(int streamType, int index, int flags); 48 49 oneway void setRemoteStreamVolume(int index); 50 51 void setMasterVolume(int index, int flags); 52 53 void setStreamSolo(int streamType, boolean state, IBinder cb); 54 55 void setStreamMute(int streamType, boolean state, IBinder cb); 56 57 boolean isStreamMute(int streamType); 58 59 void setMasterMute(boolean state, int flags, IBinder cb); 60 61 boolean isMasterMute(); 62 63 int getStreamVolume(int streamType); 64 65 int getMasterVolume(); 66 67 int getStreamMaxVolume(int streamType); 68 69 int getMasterMaxVolume(); 70 71 int getLastAudibleStreamVolume(int streamType); 72 73 int getLastAudibleMasterVolume(); 74 75 void setRingerMode(int ringerMode); 76 77 int getRingerMode(); 78 79 void setVibrateSetting(int vibrateType, int vibrateSetting); 80 81 int getVibrateSetting(int vibrateType); 82 83 boolean shouldVibrate(int vibrateType); 84 85 void setMode(int mode, IBinder cb); 86 87 int getMode(); 88 89 oneway void playSoundEffect(int effectType); 90 91 oneway void playSoundEffectVolume(int effectType, float volume); 92 93 boolean loadSoundEffects(); 94 95 oneway void unloadSoundEffects(); 96 97 oneway void reloadAudioSettings(); 98 99 void setSpeakerphoneOn(boolean on); 100 101 boolean isSpeakerphoneOn(); 102 103 void setBluetoothScoOn(boolean on); 104 105 boolean isBluetoothScoOn(); 106 107 void setBluetoothA2dpOn(boolean on); 108 109 boolean isBluetoothA2dpOn(); 110 111 oneway void setRemoteSubmixOn(boolean on, int address); 112 113 int requestAudioFocus(int mainStreamType, int durationHint, IBinder cb, IAudioFocusDispatcher l, 114 String clientId, String callingPackageName); 115 116 int abandonAudioFocus(IAudioFocusDispatcher l, String clientId); 117 118 void unregisterAudioFocusClient(String clientId); 119 120 oneway void dispatchMediaKeyEvent(in KeyEvent keyEvent); 121 void dispatchMediaKeyEventUnderWakelock(in KeyEvent keyEvent); 122 123 oneway void registerMediaButtonIntent(in PendingIntent pi, in ComponentName c); 124 oneway void unregisterMediaButtonIntent(in PendingIntent pi, in ComponentName c); 125 126 oneway void registerMediaButtonEventReceiverForCalls(in ComponentName c); 127 oneway void unregisterMediaButtonEventReceiverForCalls(); 128 129 int registerRemoteControlClient(in PendingIntent mediaIntent, 130 in IRemoteControlClient rcClient, in String callingPackageName); 131 oneway void unregisterRemoteControlClient(in PendingIntent mediaIntent, 132 in IRemoteControlClient rcClient); 133 134 oneway void registerRemoteControlDisplay(in IRemoteControlDisplay rcd); 135 oneway void unregisterRemoteControlDisplay(in IRemoteControlDisplay rcd); 136 oneway void remoteControlDisplayUsesBitmapSize(in IRemoteControlDisplay rcd, int w, int h); 137 138 oneway void setPlaybackInfoForRcc(int rccId, int what, int value); 139 int getRemoteStreamMaxVolume(); 140 int getRemoteStreamVolume(); 141 oneway void registerRemoteVolumeObserverForRcc(int rccId, in IRemoteVolumeObserver rvo); 142 143 void startBluetoothSco(IBinder cb); 144 void stopBluetoothSco(IBinder cb); 145 146 void forceVolumeControlStream(int streamType, IBinder cb); 147 148 void setRingtonePlayer(IRingtonePlayer player); 149 IRingtonePlayer getRingtonePlayer(); 150 int getMasterStreamType(); 151 152 void setWiredDeviceConnectionState(int device, int state, String name); 153 int setBluetoothA2dpDeviceConnectionState(in BluetoothDevice device, int state); 154 155 AudioRoutesInfo startWatchingRoutes(in IAudioRoutesObserver observer); 156 157 boolean isCameraSoundForced(); 158} 159