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