| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 The Android Open Source Project |
| Mingming Yin | 84f109b | 2012-12-27 17:43:05 -0800 | [diff] [blame] | 3 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 4 | * |
| 5 | * Not a Contribution, Apache license notifications and license are retained |
| 6 | * for attribution purposes only |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 7 | * |
| 8 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | * you may not use this file except in compliance with the License. |
| 10 | * You may obtain a copy of the License at |
| 11 | * |
| 12 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | * |
| 14 | * Unless required by applicable law or agreed to in writing, software |
| 15 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | * See the License for the specific language governing permissions and |
| 18 | * limitations under the License. |
| 19 | */ |
| 20 | |
| 21 | #ifndef ANDROID_AUDIOPOLICYSERVICE_H |
| 22 | #define ANDROID_AUDIOPOLICYSERVICE_H |
| 23 | |
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 24 | #include <cutils/misc.h> |
| 25 | #include <cutils/config_utils.h> |
| Glenn Kasten | d1d8f23 | 2011-07-08 09:34:50 -0700 | [diff] [blame] | 26 | #include <utils/String8.h> |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 27 | #include <utils/Vector.h> |
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 28 | #include <utils/SortedVector.h> |
| Glenn Kasten | d2dcb08 | 2011-02-03 16:55:26 -0800 | [diff] [blame] | 29 | #include <binder/BinderService.h> |
| Dima Zavin | 6476024 | 2011-05-11 14:15:23 -0700 | [diff] [blame] | 30 | #include <system/audio.h> |
| Dima Zavin | 7394a4f | 2011-06-13 18:16:26 -0700 | [diff] [blame] | 31 | #include <system/audio_policy.h> |
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 32 | #include <hardware/audio_policy.h> |
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 33 | #include <media/IAudioPolicyService.h> |
| 34 | #include <media/ToneGenerator.h> |
| 35 | #include <media/AudioEffect.h> |
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 36 | |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 37 | namespace android { |
| 38 | |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 39 | // ---------------------------------------------------------------------------- |
| 40 | |
| Glenn Kasten | d2dcb08 | 2011-02-03 16:55:26 -0800 | [diff] [blame] | 41 | class AudioPolicyService : |
| 42 | public BinderService<AudioPolicyService>, |
| 43 | public BnAudioPolicyService, |
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 44 | // public AudioPolicyClientInterface, |
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 45 | public IBinder::DeathRecipient |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 46 | { |
| Glenn Kasten | d2dcb08 | 2011-02-03 16:55:26 -0800 | [diff] [blame] | 47 | friend class BinderService<AudioPolicyService>; |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 48 | |
| 49 | public: |
| Glenn Kasten | d2dcb08 | 2011-02-03 16:55:26 -0800 | [diff] [blame] | 50 | // for BinderService |
| 51 | static const char *getServiceName() { return "media.audio_policy"; } |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 52 | |
| 53 | virtual status_t dump(int fd, const Vector<String16>& args); |
| 54 | |
| 55 | // |
| 56 | // BnAudioPolicyService (see AudioPolicyInterface for method descriptions) |
| 57 | // |
| 58 | |
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 59 | virtual status_t setDeviceConnectionState(audio_devices_t device, |
| 60 | audio_policy_dev_state_t state, |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 61 | const char *device_address); |
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 62 | virtual audio_policy_dev_state_t getDeviceConnectionState( |
| 63 | audio_devices_t device, |
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 64 | const char *device_address); |
| Glenn Kasten | f78aee7 | 2012-01-04 11:00:47 -0800 | [diff] [blame] | 65 | virtual status_t setPhoneState(audio_mode_t state); |
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 66 | virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config); |
| 67 | virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage); |
| 68 | virtual audio_io_handle_t getOutput(audio_stream_type_t stream, |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 69 | uint32_t samplingRate = 0, |
| Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 70 | audio_format_t format = AUDIO_FORMAT_DEFAULT, |
| Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 71 | audio_channel_mask_t channelMask = 0, |
| Eric Laurent | 0ca3cf9 | 2012-04-18 09:24:29 -0700 | [diff] [blame] | 72 | audio_output_flags_t flags = |
| 73 | AUDIO_OUTPUT_FLAG_NONE); |
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 74 | virtual status_t startOutput(audio_io_handle_t output, |
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 75 | audio_stream_type_t stream, |
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 76 | int session = 0); |
| 77 | virtual status_t stopOutput(audio_io_handle_t output, |
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 78 | audio_stream_type_t stream, |
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 79 | int session = 0); |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 80 | virtual void releaseOutput(audio_io_handle_t output); |
| Glenn Kasten | eba51fb | 2012-01-23 13:58:49 -0800 | [diff] [blame] | 81 | virtual audio_io_handle_t getInput(audio_source_t inputSource, |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 82 | uint32_t samplingRate = 0, |
| Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 83 | audio_format_t format = AUDIO_FORMAT_DEFAULT, |
| Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 84 | audio_channel_mask_t channelMask = 0, |
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 85 | int audioSession = 0); |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 86 | virtual status_t startInput(audio_io_handle_t input); |
| 87 | virtual status_t stopInput(audio_io_handle_t input); |
| 88 | virtual void releaseInput(audio_io_handle_t input); |
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 89 | virtual status_t initStreamVolume(audio_stream_type_t stream, |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 90 | int indexMin, |
| 91 | int indexMax); |
| Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 92 | virtual status_t setStreamVolumeIndex(audio_stream_type_t stream, |
| 93 | int index, |
| 94 | audio_devices_t device); |
| 95 | virtual status_t getStreamVolumeIndex(audio_stream_type_t stream, |
| 96 | int *index, |
| 97 | audio_devices_t device); |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 98 | |
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 99 | virtual uint32_t getStrategyForStream(audio_stream_type_t stream); |
| Eric Laurent | 6374252 | 2012-03-08 13:42:42 -0800 | [diff] [blame] | 100 | virtual audio_devices_t getDevicesForStream(audio_stream_type_t stream); |
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 101 | |
| Glenn Kasten | 58e5aa3 | 2012-06-20 14:08:14 -0700 | [diff] [blame] | 102 | virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t *desc); |
| 103 | virtual status_t registerEffect(const effect_descriptor_t *desc, |
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 104 | audio_io_handle_t io, |
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 105 | uint32_t strategy, |
| 106 | int session, |
| 107 | int id); |
| 108 | virtual status_t unregisterEffect(int id); |
| Eric Laurent | db7c079 | 2011-08-10 10:37:50 -0700 | [diff] [blame] | 109 | virtual status_t setEffectEnabled(int id, bool enabled); |
| Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 110 | virtual bool isStreamActive(audio_stream_type_t stream, uint32_t inPastMs = 0) const; |
| Jean-Michel Trivi | d708603 | 2012-10-10 12:11:16 -0700 | [diff] [blame] | 111 | virtual bool isSourceActive(audio_source_t source) const; |
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 112 | |
| Eric Laurent | 57dae99 | 2011-07-24 13:36:09 -0700 | [diff] [blame] | 113 | virtual status_t queryDefaultPreProcessing(int audioSession, |
| 114 | effect_descriptor_t *descriptors, |
| 115 | uint32_t *count); |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 116 | virtual status_t onTransact( |
| 117 | uint32_t code, |
| 118 | const Parcel& data, |
| 119 | Parcel* reply, |
| 120 | uint32_t flags); |
| 121 | |
| 122 | // IBinder::DeathRecipient |
| 123 | virtual void binderDied(const wp<IBinder>& who); |
| 124 | |
| 125 | // |
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 126 | // Helpers for the struct audio_policy_service_ops implementation. |
| 127 | // This is used by the audio policy manager for certain operations that |
| 128 | // are implemented by the policy service. |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 129 | // |
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 130 | virtual void setParameters(audio_io_handle_t ioHandle, |
| 131 | const char *keyValuePairs, |
| 132 | int delayMs); |
| 133 | |
| 134 | virtual status_t setStreamVolume(audio_stream_type_t stream, |
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 135 | float volume, |
| 136 | audio_io_handle_t output, |
| 137 | int delayMs = 0); |
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 138 | virtual status_t startTone(audio_policy_tone_t tone, audio_stream_type_t stream); |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 139 | virtual status_t stopTone(); |
| 140 | virtual status_t setVoiceVolume(float volume, int delayMs = 0); |
| Mingming Yin | 84f109b | 2012-12-27 17:43:05 -0800 | [diff] [blame] | 141 | #ifdef QCOM_FM_ENABLED |
| 142 | virtual status_t setFmVolume(float volume, int delayMs = 0); |
| 143 | #endif |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 144 | |
| 145 | private: |
| 146 | AudioPolicyService(); |
| 147 | virtual ~AudioPolicyService(); |
| 148 | |
| 149 | status_t dumpInternals(int fd); |
| 150 | |
| 151 | // Thread used for tone playback and to send audio config commands to audio flinger |
| 152 | // For tone playback, using a separate thread is necessary to avoid deadlock with mLock because startTone() |
| 153 | // and stopTone() are normally called with mLock locked and requesting a tone start or stop will cause |
| 154 | // calls to AudioPolicyService and an attempt to lock mLock. |
| 155 | // For audio config commands, it is necessary because audio flinger requires that the calling process (user) |
| 156 | // has permission to modify audio settings. |
| 157 | class AudioCommandThread : public Thread { |
| 158 | class AudioCommand; |
| 159 | public: |
| 160 | |
| 161 | // commands for tone AudioCommand |
| 162 | enum { |
| 163 | START_TONE, |
| 164 | STOP_TONE, |
| 165 | SET_VOLUME, |
| 166 | SET_PARAMETERS, |
| Mingming Yin | 84f109b | 2012-12-27 17:43:05 -0800 | [diff] [blame] | 167 | SET_VOICE_VOLUME, |
| 168 | #ifdef QCOM_FM_ENABLED |
| 169 | SET_FM_VOLUME |
| 170 | #endif |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 171 | }; |
| 172 | |
| 173 | AudioCommandThread (String8 name); |
| 174 | virtual ~AudioCommandThread(); |
| 175 | |
| 176 | status_t dump(int fd); |
| 177 | |
| 178 | // Thread virtuals |
| 179 | virtual void onFirstRef(); |
| 180 | virtual bool threadLoop(); |
| 181 | |
| 182 | void exit(); |
| Glenn Kasten | 3d2f877 | 2012-01-27 15:25:25 -0800 | [diff] [blame] | 183 | void startToneCommand(ToneGenerator::tone_type type, |
| 184 | audio_stream_type_t stream); |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 185 | void stopToneCommand(); |
| Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 186 | status_t volumeCommand(audio_stream_type_t stream, float volume, |
| 187 | audio_io_handle_t output, int delayMs = 0); |
| 188 | status_t parametersCommand(audio_io_handle_t ioHandle, |
| 189 | const char *keyValuePairs, int delayMs = 0); |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 190 | status_t voiceVolumeCommand(float volume, int delayMs = 0); |
| Mingming Yin | 84f109b | 2012-12-27 17:43:05 -0800 | [diff] [blame] | 191 | #ifdef QCOM_FM_ENABLED |
| 192 | status_t fmVolumeCommand(float volume, int delayMs = 0); |
| 193 | #endif |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 194 | void insertCommand_l(AudioCommand *command, int delayMs = 0); |
| 195 | |
| 196 | private: |
| 197 | // descriptor for requested tone playback event |
| 198 | class AudioCommand { |
| 199 | |
| 200 | public: |
| 201 | AudioCommand() |
| 202 | : mCommand(-1) {} |
| 203 | |
| 204 | void dump(char* buffer, size_t size); |
| 205 | |
| 206 | int mCommand; // START_TONE, STOP_TONE ... |
| 207 | nsecs_t mTime; // time stamp |
| 208 | Condition mCond; // condition for status return |
| 209 | status_t mStatus; // command status |
| 210 | bool mWaitStatus; // true if caller is waiting for status |
| 211 | void *mParam; // command parameter (ToneData, VolumeData, ParametersData) |
| 212 | }; |
| 213 | |
| 214 | class ToneData { |
| 215 | public: |
| Glenn Kasten | 3d2f877 | 2012-01-27 15:25:25 -0800 | [diff] [blame] | 216 | ToneGenerator::tone_type mType; // tone type (START_TONE only) |
| Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 217 | audio_stream_type_t mStream; // stream type (START_TONE only) |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 218 | }; |
| 219 | |
| 220 | class VolumeData { |
| 221 | public: |
| Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 222 | audio_stream_type_t mStream; |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 223 | float mVolume; |
| Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 224 | audio_io_handle_t mIO; |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 225 | }; |
| 226 | |
| 227 | class ParametersData { |
| 228 | public: |
| Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 229 | audio_io_handle_t mIO; |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 230 | String8 mKeyValuePairs; |
| 231 | }; |
| 232 | |
| 233 | class VoiceVolumeData { |
| 234 | public: |
| 235 | float mVolume; |
| 236 | }; |
| 237 | |
| Mingming Yin | 84f109b | 2012-12-27 17:43:05 -0800 | [diff] [blame] | 238 | #ifdef QCOM_FM_ENABLED |
| 239 | class FmVolumeData { |
| 240 | public: |
| 241 | float mVolume; |
| 242 | }; |
| 243 | #endif |
| 244 | |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 245 | Mutex mLock; |
| 246 | Condition mWaitWorkCV; |
| 247 | Vector <AudioCommand *> mAudioCommands; // list of pending commands |
| 248 | ToneGenerator *mpToneGenerator; // the tone generator |
| 249 | AudioCommand mLastCommand; // last processed command (used by dump) |
| 250 | String8 mName; // string used by wake lock fo delayed commands |
| 251 | }; |
| 252 | |
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 253 | class EffectDesc { |
| 254 | public: |
| Glenn Kasten | 9fda4b8 | 2012-02-02 14:04:37 -0800 | [diff] [blame] | 255 | EffectDesc(const char *name, const effect_uuid_t& uuid) : |
| 256 | mName(strdup(name)), |
| 257 | mUuid(uuid) { } |
| 258 | EffectDesc(const EffectDesc& orig) : |
| 259 | mName(strdup(orig.mName)), |
| 260 | mUuid(orig.mUuid) { |
| 261 | // deep copy mParams |
| 262 | for (size_t k = 0; k < orig.mParams.size(); k++) { |
| 263 | effect_param_t *origParam = orig.mParams[k]; |
| 264 | // psize and vsize are rounded up to an int boundary for allocation |
| 265 | size_t origSize = sizeof(effect_param_t) + |
| 266 | ((origParam->psize + 3) & ~3) + |
| 267 | ((origParam->vsize + 3) & ~3); |
| 268 | effect_param_t *dupParam = (effect_param_t *) malloc(origSize); |
| 269 | memcpy(dupParam, origParam, origSize); |
| 270 | // This works because the param buffer allocation is also done by |
| 271 | // multiples of 4 bytes originally. In theory we should memcpy only |
| 272 | // the actual param size, that is without rounding vsize. |
| 273 | mParams.add(dupParam); |
| 274 | } |
| 275 | } |
| 276 | /*virtual*/ ~EffectDesc() { |
| 277 | free(mName); |
| 278 | for (size_t k = 0; k < mParams.size(); k++) { |
| 279 | free(mParams[k]); |
| 280 | } |
| 281 | } |
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 282 | char *mName; |
| 283 | effect_uuid_t mUuid; |
| 284 | Vector <effect_param_t *> mParams; |
| 285 | }; |
| 286 | |
| 287 | class InputSourceDesc { |
| 288 | public: |
| 289 | InputSourceDesc() {} |
| Glenn Kasten | 9fda4b8 | 2012-02-02 14:04:37 -0800 | [diff] [blame] | 290 | /*virtual*/ ~InputSourceDesc() { |
| 291 | for (size_t j = 0; j < mEffects.size(); j++) { |
| 292 | delete mEffects[j]; |
| 293 | } |
| 294 | } |
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 295 | Vector <EffectDesc *> mEffects; |
| 296 | }; |
| 297 | |
| 298 | |
| 299 | class InputDesc { |
| 300 | public: |
| Glenn Kasten | 81872a2 | 2012-03-07 16:49:22 -0800 | [diff] [blame] | 301 | InputDesc(int session) : mSessionId(session) {} |
| 302 | /*virtual*/ ~InputDesc() {} |
| 303 | const int mSessionId; |
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 304 | Vector< sp<AudioEffect> >mEffects; |
| 305 | }; |
| 306 | |
| Glenn Kasten | 8dad0e3 | 2012-01-09 08:41:22 -0800 | [diff] [blame] | 307 | static const char * const kInputSourceNames[AUDIO_SOURCE_CNT -1]; |
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 308 | |
| Glenn Kasten | 81872a2 | 2012-03-07 16:49:22 -0800 | [diff] [blame] | 309 | void setPreProcessorEnabled(const InputDesc *inputDesc, bool enabled); |
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 310 | status_t loadPreProcessorConfig(const char *path); |
| 311 | status_t loadEffects(cnode *root, Vector <EffectDesc *>& effects); |
| 312 | EffectDesc *loadEffect(cnode *root); |
| 313 | status_t loadInputSources(cnode *root, const Vector <EffectDesc *>& effects); |
| 314 | audio_source_t inputSourceNameToEnum(const char *name); |
| 315 | InputSourceDesc *loadInputSource(cnode *root, const Vector <EffectDesc *>& effects); |
| 316 | void loadEffectParameters(cnode *root, Vector <effect_param_t *>& params); |
| 317 | effect_param_t *loadEffectParameter(cnode *root); |
| 318 | size_t readParamValue(cnode *node, |
| 319 | char *param, |
| 320 | size_t *curSize, |
| 321 | size_t *totSize); |
| 322 | size_t growParamSize(char *param, |
| 323 | size_t size, |
| 324 | size_t *curSize, |
| 325 | size_t *totSize); |
| 326 | |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 327 | // Internal dump utilities. |
| 328 | status_t dumpPermissionDenial(int fd); |
| 329 | |
| 330 | |
| Eric Laurent | eda6c36 | 2011-02-02 09:33:30 -0800 | [diff] [blame] | 331 | mutable Mutex mLock; // prevents concurrent access to AudioPolicy manager functions changing |
| 332 | // device connection state or routing |
| Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 333 | sp<AudioCommandThread> mAudioCommandThread; // audio commands thread |
| 334 | sp<AudioCommandThread> mTonePlaybackThread; // tone playback thread |
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 335 | struct audio_policy_device *mpAudioPolicyDev; |
| 336 | struct audio_policy *mpAudioPolicy; |
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 337 | KeyedVector< audio_source_t, InputSourceDesc* > mInputSources; |
| 338 | KeyedVector< audio_io_handle_t, InputDesc* > mInputs; |
| Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 339 | }; |
| 340 | |
| 341 | }; // namespace android |
| 342 | |
| 343 | #endif // ANDROID_AUDIOPOLICYSERVICE_H |