Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 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 | #ifndef ANDROID_AUDIOPOLICYSERVICE_H |
| 18 | #define ANDROID_AUDIOPOLICYSERVICE_H |
| 19 | |
Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 20 | #include <cutils/misc.h> |
| 21 | #include <cutils/config_utils.h> |
Mathias Agopian | e762be9 | 2013-05-09 16:26:45 -0700 | [diff] [blame] | 22 | #include <cutils/compiler.h> |
Glenn Kasten | d1d8f23 | 2011-07-08 09:34:50 -0700 | [diff] [blame] | 23 | #include <utils/String8.h> |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 24 | #include <utils/Vector.h> |
Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 25 | #include <utils/SortedVector.h> |
Glenn Kasten | d2dcb08 | 2011-02-03 16:55:26 -0800 | [diff] [blame] | 26 | #include <binder/BinderService.h> |
Dima Zavin | 6476024 | 2011-05-11 14:15:23 -0700 | [diff] [blame] | 27 | #include <system/audio.h> |
Dima Zavin | 7394a4f | 2011-06-13 18:16:26 -0700 | [diff] [blame] | 28 | #include <system/audio_policy.h> |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 29 | #include <hardware/audio_policy.h> |
Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 30 | #include <media/IAudioPolicyService.h> |
| 31 | #include <media/ToneGenerator.h> |
| 32 | #include <media/AudioEffect.h> |
Eric Laurent | baac183 | 2014-12-01 17:52:59 -0800 | [diff] [blame] | 33 | #include <media/AudioPolicy.h> |
Chih-Hung Hsieh | c84d9d2 | 2014-11-14 13:33:34 -0800 | [diff] [blame] | 34 | #ifdef USE_LEGACY_AUDIO_POLICY |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 35 | #include <hardware_legacy/AudioPolicyInterface.h> |
Chih-Hung Hsieh | c84d9d2 | 2014-11-14 13:33:34 -0800 | [diff] [blame] | 36 | #endif |
bryant_liu | ba2b439 | 2014-06-11 16:49:30 +0800 | [diff] [blame] | 37 | #include "AudioPolicyEffects.h" |
Jean-Michel Trivi | 56ec4ff | 2015-01-23 16:45:18 -0800 | [diff] [blame] | 38 | #include "managerdefault/AudioPolicyManager.h" |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 39 | |
bryant_liu | ba2b439 | 2014-06-11 16:49:30 +0800 | [diff] [blame] | 40 | |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 41 | namespace android { |
| 42 | |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 43 | // ---------------------------------------------------------------------------- |
| 44 | |
Glenn Kasten | d2dcb08 | 2011-02-03 16:55:26 -0800 | [diff] [blame] | 45 | class AudioPolicyService : |
| 46 | public BinderService<AudioPolicyService>, |
| 47 | public BnAudioPolicyService, |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 48 | public IBinder::DeathRecipient |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 49 | { |
Glenn Kasten | d2dcb08 | 2011-02-03 16:55:26 -0800 | [diff] [blame] | 50 | friend class BinderService<AudioPolicyService>; |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 51 | |
| 52 | public: |
Glenn Kasten | d2dcb08 | 2011-02-03 16:55:26 -0800 | [diff] [blame] | 53 | // for BinderService |
Mathias Agopian | e762be9 | 2013-05-09 16:26:45 -0700 | [diff] [blame] | 54 | static const char *getServiceName() ANDROID_API { return "media.audio_policy"; } |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 55 | |
| 56 | virtual status_t dump(int fd, const Vector<String16>& args); |
| 57 | |
| 58 | // |
| 59 | // BnAudioPolicyService (see AudioPolicyInterface for method descriptions) |
| 60 | // |
| 61 | |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 62 | virtual status_t setDeviceConnectionState(audio_devices_t device, |
| 63 | audio_policy_dev_state_t state, |
Paul McLean | e743a47 | 2015-01-28 11:07:31 -0800 | [diff] [blame] | 64 | const char *device_address, |
| 65 | const char *device_name); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 66 | virtual audio_policy_dev_state_t getDeviceConnectionState( |
| 67 | audio_devices_t device, |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 68 | const char *device_address); |
Glenn Kasten | f78aee7 | 2012-01-04 11:00:47 -0800 | [diff] [blame] | 69 | virtual status_t setPhoneState(audio_mode_t state); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 70 | virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config); |
| 71 | virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage); |
| 72 | virtual audio_io_handle_t getOutput(audio_stream_type_t stream, |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 73 | uint32_t samplingRate = 0, |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 74 | audio_format_t format = AUDIO_FORMAT_DEFAULT, |
Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 75 | audio_channel_mask_t channelMask = 0, |
Eric Laurent | 0ca3cf9 | 2012-04-18 09:24:29 -0700 | [diff] [blame] | 76 | audio_output_flags_t flags = |
Richard Fitzgerald | ad3af33 | 2013-03-25 16:54:37 +0000 | [diff] [blame] | 77 | AUDIO_OUTPUT_FLAG_NONE, |
| 78 | const audio_offload_info_t *offloadInfo = NULL); |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 79 | virtual status_t getOutputForAttr(const audio_attributes_t *attr, |
| 80 | audio_io_handle_t *output, |
| 81 | audio_session_t session, |
| 82 | audio_stream_type_t *stream, |
Eric Laurent | 8c7e6da | 2015-04-21 17:37:00 -0700 | [diff] [blame] | 83 | uid_t uid, |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 84 | uint32_t samplingRate = 0, |
| 85 | audio_format_t format = AUDIO_FORMAT_DEFAULT, |
| 86 | audio_channel_mask_t channelMask = 0, |
| 87 | audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE, |
Paul McLean | 466dc8e | 2015-04-17 13:15:36 -0600 | [diff] [blame] | 88 | audio_port_handle_t selectedDeviceId = AUDIO_PORT_HANDLE_NONE, |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 89 | const audio_offload_info_t *offloadInfo = NULL); |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 90 | virtual status_t startOutput(audio_io_handle_t output, |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 91 | audio_stream_type_t stream, |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 92 | audio_session_t session); |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 93 | virtual status_t stopOutput(audio_io_handle_t output, |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 94 | audio_stream_type_t stream, |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 95 | audio_session_t session); |
| 96 | virtual void releaseOutput(audio_io_handle_t output, |
| 97 | audio_stream_type_t stream, |
| 98 | audio_session_t session); |
Eric Laurent | caf7f48 | 2014-11-25 17:50:47 -0800 | [diff] [blame] | 99 | virtual status_t getInputForAttr(const audio_attributes_t *attr, |
| 100 | audio_io_handle_t *input, |
| 101 | audio_session_t session, |
Eric Laurent | 8c7e6da | 2015-04-21 17:37:00 -0700 | [diff] [blame] | 102 | uid_t uid, |
Eric Laurent | caf7f48 | 2014-11-25 17:50:47 -0800 | [diff] [blame] | 103 | uint32_t samplingRate, |
| 104 | audio_format_t format, |
| 105 | audio_channel_mask_t channelMask, |
Paul McLean | 466dc8e | 2015-04-17 13:15:36 -0600 | [diff] [blame] | 106 | audio_input_flags_t flags, |
| 107 | audio_port_handle_t selectedDeviceId = AUDIO_PORT_HANDLE_NONE); |
Eric Laurent | 4dc6806 | 2014-07-28 17:26:49 -0700 | [diff] [blame] | 108 | virtual status_t startInput(audio_io_handle_t input, |
| 109 | audio_session_t session); |
| 110 | virtual status_t stopInput(audio_io_handle_t input, |
| 111 | audio_session_t session); |
| 112 | virtual void releaseInput(audio_io_handle_t input, |
| 113 | audio_session_t session); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 114 | virtual status_t initStreamVolume(audio_stream_type_t stream, |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 115 | int indexMin, |
| 116 | int indexMax); |
Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 117 | virtual status_t setStreamVolumeIndex(audio_stream_type_t stream, |
| 118 | int index, |
| 119 | audio_devices_t device); |
| 120 | virtual status_t getStreamVolumeIndex(audio_stream_type_t stream, |
| 121 | int *index, |
| 122 | audio_devices_t device); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 123 | |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 124 | virtual uint32_t getStrategyForStream(audio_stream_type_t stream); |
Eric Laurent | 6374252 | 2012-03-08 13:42:42 -0800 | [diff] [blame] | 125 | virtual audio_devices_t getDevicesForStream(audio_stream_type_t stream); |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 126 | |
Glenn Kasten | 58e5aa3 | 2012-06-20 14:08:14 -0700 | [diff] [blame] | 127 | virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t *desc); |
| 128 | virtual status_t registerEffect(const effect_descriptor_t *desc, |
Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 129 | audio_io_handle_t io, |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 130 | uint32_t strategy, |
| 131 | int session, |
| 132 | int id); |
| 133 | virtual status_t unregisterEffect(int id); |
Eric Laurent | db7c079 | 2011-08-10 10:37:50 -0700 | [diff] [blame] | 134 | virtual status_t setEffectEnabled(int id, bool enabled); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 135 | virtual bool isStreamActive(audio_stream_type_t stream, uint32_t inPastMs = 0) const; |
Jean-Michel Trivi | 272ab54 | 2013-02-04 16:26:02 -0800 | [diff] [blame] | 136 | virtual bool isStreamActiveRemotely(audio_stream_type_t stream, uint32_t inPastMs = 0) const; |
Jean-Michel Trivi | d708603 | 2012-10-10 12:11:16 -0700 | [diff] [blame] | 137 | virtual bool isSourceActive(audio_source_t source) const; |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 138 | |
Eric Laurent | 57dae99 | 2011-07-24 13:36:09 -0700 | [diff] [blame] | 139 | virtual status_t queryDefaultPreProcessing(int audioSession, |
| 140 | effect_descriptor_t *descriptors, |
| 141 | uint32_t *count); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 142 | virtual status_t onTransact( |
| 143 | uint32_t code, |
| 144 | const Parcel& data, |
| 145 | Parcel* reply, |
| 146 | uint32_t flags); |
| 147 | |
| 148 | // IBinder::DeathRecipient |
| 149 | virtual void binderDied(const wp<IBinder>& who); |
| 150 | |
Eric Laurent | f5ada6e | 2014-10-09 17:49:00 -0700 | [diff] [blame] | 151 | // RefBase |
| 152 | virtual void onFirstRef(); |
| 153 | |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 154 | // |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 155 | // Helpers for the struct audio_policy_service_ops implementation. |
| 156 | // This is used by the audio policy manager for certain operations that |
| 157 | // are implemented by the policy service. |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 158 | // |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 159 | virtual void setParameters(audio_io_handle_t ioHandle, |
| 160 | const char *keyValuePairs, |
| 161 | int delayMs); |
| 162 | |
| 163 | virtual status_t setStreamVolume(audio_stream_type_t stream, |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 164 | float volume, |
| 165 | audio_io_handle_t output, |
| 166 | int delayMs = 0); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 167 | 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] | 168 | virtual status_t stopTone(); |
| 169 | virtual status_t setVoiceVolume(float volume, int delayMs = 0); |
Richard Fitzgerald | ad3af33 | 2013-03-25 16:54:37 +0000 | [diff] [blame] | 170 | virtual bool isOffloadSupported(const audio_offload_info_t &config); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 171 | |
Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame] | 172 | virtual status_t listAudioPorts(audio_port_role_t role, |
| 173 | audio_port_type_t type, |
| 174 | unsigned int *num_ports, |
| 175 | struct audio_port *ports, |
| 176 | unsigned int *generation); |
| 177 | virtual status_t getAudioPort(struct audio_port *port); |
| 178 | virtual status_t createAudioPatch(const struct audio_patch *patch, |
| 179 | audio_patch_handle_t *handle); |
| 180 | virtual status_t releaseAudioPatch(audio_patch_handle_t handle); |
| 181 | virtual status_t listAudioPatches(unsigned int *num_patches, |
| 182 | struct audio_patch *patches, |
| 183 | unsigned int *generation); |
| 184 | virtual status_t setAudioPortConfig(const struct audio_port_config *config); |
| 185 | |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 186 | virtual void registerClient(const sp<IAudioPolicyServiceClient>& client); |
| 187 | |
Eric Laurent | e8726fe | 2015-06-26 09:39:24 -0700 | [diff] [blame] | 188 | virtual void setAudioPortCallbacksEnabled(bool enabled); |
| 189 | |
Eric Laurent | df3dc7e | 2014-07-27 18:39:40 -0700 | [diff] [blame] | 190 | virtual status_t acquireSoundTriggerSession(audio_session_t *session, |
| 191 | audio_io_handle_t *ioHandle, |
| 192 | audio_devices_t *device); |
| 193 | |
| 194 | virtual status_t releaseSoundTriggerSession(audio_session_t session); |
| 195 | |
Eric Laurent | bb6c9a0 | 2014-09-25 14:11:47 -0700 | [diff] [blame] | 196 | virtual audio_mode_t getPhoneState(); |
| 197 | |
Eric Laurent | baac183 | 2014-12-01 17:52:59 -0800 | [diff] [blame] | 198 | virtual status_t registerPolicyMixes(Vector<AudioMix> mixes, bool registration); |
| 199 | |
Eric Laurent | 554a277 | 2015-04-10 11:29:24 -0700 | [diff] [blame] | 200 | virtual status_t startAudioSource(const struct audio_port_config *source, |
| 201 | const audio_attributes_t *attributes, |
| 202 | audio_io_handle_t *handle); |
| 203 | virtual status_t stopAudioSource(audio_io_handle_t handle); |
| 204 | |
Andy Hung | 2ddee19 | 2015-12-18 17:34:44 -0800 | [diff] [blame] | 205 | virtual status_t setMasterMono(bool mono); |
| 206 | virtual status_t getMasterMono(bool *mono); |
| 207 | |
Eric Laurent | bfb1b83 | 2013-01-07 09:53:42 -0800 | [diff] [blame] | 208 | status_t doStopOutput(audio_io_handle_t output, |
| 209 | audio_stream_type_t stream, |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 210 | audio_session_t session); |
| 211 | void doReleaseOutput(audio_io_handle_t output, |
| 212 | audio_stream_type_t stream, |
| 213 | audio_session_t session); |
Eric Laurent | bfb1b83 | 2013-01-07 09:53:42 -0800 | [diff] [blame] | 214 | |
Eric Laurent | 951f455 | 2014-05-20 10:48:17 -0700 | [diff] [blame] | 215 | status_t clientCreateAudioPatch(const struct audio_patch *patch, |
| 216 | audio_patch_handle_t *handle, |
| 217 | int delayMs); |
| 218 | status_t clientReleaseAudioPatch(audio_patch_handle_t handle, |
| 219 | int delayMs); |
Eric Laurent | e1715a4 | 2014-05-20 11:30:42 -0700 | [diff] [blame] | 220 | virtual status_t clientSetAudioPortConfig(const struct audio_port_config *config, |
| 221 | int delayMs); |
| 222 | |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 223 | void removeNotificationClient(uid_t uid); |
| 224 | void onAudioPortListUpdate(); |
| 225 | void doOnAudioPortListUpdate(); |
| 226 | void onAudioPatchListUpdate(); |
| 227 | void doOnAudioPatchListUpdate(); |
Eric Laurent | 951f455 | 2014-05-20 10:48:17 -0700 | [diff] [blame] | 228 | |
Jean-Michel Trivi | de80105 | 2015-04-14 19:10:14 -0700 | [diff] [blame] | 229 | void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state); |
| 230 | void doOnDynamicPolicyMixStateUpdate(String8 regId, int32_t state); |
Jean-Michel Trivi | 2f4fe9f | 2015-12-04 16:20:59 -0800 | [diff] [blame] | 231 | void onRecordingConfigurationUpdate(int event, audio_session_t session, |
Jean-Michel Trivi | 7281aa9 | 2016-02-17 15:33:40 -0800 | [diff] [blame^] | 232 | audio_source_t source, const audio_config_base_t *clientConfig, |
| 233 | const audio_config_base_t *deviceConfig); |
Jean-Michel Trivi | 2f4fe9f | 2015-12-04 16:20:59 -0800 | [diff] [blame] | 234 | void doOnRecordingConfigurationUpdate(int event, audio_session_t session, |
Jean-Michel Trivi | 7281aa9 | 2016-02-17 15:33:40 -0800 | [diff] [blame^] | 235 | audio_source_t source, const audio_config_base_t *clientConfig, |
| 236 | const audio_config_base_t *deviceConfig); |
Jean-Michel Trivi | de80105 | 2015-04-14 19:10:14 -0700 | [diff] [blame] | 237 | |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 238 | private: |
Mathias Agopian | e762be9 | 2013-05-09 16:26:45 -0700 | [diff] [blame] | 239 | AudioPolicyService() ANDROID_API; |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 240 | virtual ~AudioPolicyService(); |
| 241 | |
| 242 | status_t dumpInternals(int fd); |
| 243 | |
| 244 | // Thread used for tone playback and to send audio config commands to audio flinger |
Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 245 | // For tone playback, using a separate thread is necessary to avoid deadlock with mLock because |
| 246 | // startTone() and stopTone() are normally called with mLock locked and requesting a tone start |
| 247 | // or stop will cause calls to AudioPolicyService and an attempt to lock mLock. |
| 248 | // For audio config commands, it is necessary because audio flinger requires that the calling |
| 249 | // process (user) has permission to modify audio settings. |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 250 | class AudioCommandThread : public Thread { |
| 251 | class AudioCommand; |
| 252 | public: |
| 253 | |
| 254 | // commands for tone AudioCommand |
| 255 | enum { |
| 256 | START_TONE, |
| 257 | STOP_TONE, |
| 258 | SET_VOLUME, |
| 259 | SET_PARAMETERS, |
Eric Laurent | bfb1b83 | 2013-01-07 09:53:42 -0800 | [diff] [blame] | 260 | SET_VOICE_VOLUME, |
| 261 | STOP_OUTPUT, |
Eric Laurent | 951f455 | 2014-05-20 10:48:17 -0700 | [diff] [blame] | 262 | RELEASE_OUTPUT, |
| 263 | CREATE_AUDIO_PATCH, |
| 264 | RELEASE_AUDIO_PATCH, |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 265 | UPDATE_AUDIOPORT_LIST, |
Eric Laurent | e1715a4 | 2014-05-20 11:30:42 -0700 | [diff] [blame] | 266 | UPDATE_AUDIOPATCH_LIST, |
| 267 | SET_AUDIOPORT_CONFIG, |
Jean-Michel Trivi | 2f4fe9f | 2015-12-04 16:20:59 -0800 | [diff] [blame] | 268 | DYN_POLICY_MIX_STATE_UPDATE, |
| 269 | RECORDING_CONFIGURATION_UPDATE |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 270 | }; |
| 271 | |
Eric Laurent | bfb1b83 | 2013-01-07 09:53:42 -0800 | [diff] [blame] | 272 | AudioCommandThread (String8 name, const wp<AudioPolicyService>& service); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 273 | virtual ~AudioCommandThread(); |
| 274 | |
| 275 | status_t dump(int fd); |
| 276 | |
| 277 | // Thread virtuals |
| 278 | virtual void onFirstRef(); |
| 279 | virtual bool threadLoop(); |
| 280 | |
| 281 | void exit(); |
Glenn Kasten | 3d2f877 | 2012-01-27 15:25:25 -0800 | [diff] [blame] | 282 | void startToneCommand(ToneGenerator::tone_type type, |
| 283 | audio_stream_type_t stream); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 284 | void stopToneCommand(); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 285 | status_t volumeCommand(audio_stream_type_t stream, float volume, |
| 286 | audio_io_handle_t output, int delayMs = 0); |
| 287 | status_t parametersCommand(audio_io_handle_t ioHandle, |
| 288 | const char *keyValuePairs, int delayMs = 0); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 289 | status_t voiceVolumeCommand(float volume, int delayMs = 0); |
Eric Laurent | bfb1b83 | 2013-01-07 09:53:42 -0800 | [diff] [blame] | 290 | void stopOutputCommand(audio_io_handle_t output, |
| 291 | audio_stream_type_t stream, |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 292 | audio_session_t session); |
| 293 | void releaseOutputCommand(audio_io_handle_t output, |
| 294 | audio_stream_type_t stream, |
| 295 | audio_session_t session); |
Eric Laurent | 0ede892 | 2014-05-09 18:04:42 -0700 | [diff] [blame] | 296 | status_t sendCommand(sp<AudioCommand>& command, int delayMs = 0); |
| 297 | void insertCommand_l(sp<AudioCommand>& command, int delayMs = 0); |
Eric Laurent | 951f455 | 2014-05-20 10:48:17 -0700 | [diff] [blame] | 298 | status_t createAudioPatchCommand(const struct audio_patch *patch, |
| 299 | audio_patch_handle_t *handle, |
| 300 | int delayMs); |
| 301 | status_t releaseAudioPatchCommand(audio_patch_handle_t handle, |
| 302 | int delayMs); |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 303 | void updateAudioPortListCommand(); |
| 304 | void updateAudioPatchListCommand(); |
Eric Laurent | e1715a4 | 2014-05-20 11:30:42 -0700 | [diff] [blame] | 305 | status_t setAudioPortConfigCommand(const struct audio_port_config *config, |
| 306 | int delayMs); |
Jean-Michel Trivi | de80105 | 2015-04-14 19:10:14 -0700 | [diff] [blame] | 307 | void dynamicPolicyMixStateUpdateCommand(String8 regId, int32_t state); |
Jean-Michel Trivi | 2f4fe9f | 2015-12-04 16:20:59 -0800 | [diff] [blame] | 308 | void recordingConfigurationUpdateCommand( |
| 309 | int event, audio_session_t session, |
Jean-Michel Trivi | 7281aa9 | 2016-02-17 15:33:40 -0800 | [diff] [blame^] | 310 | audio_source_t source, |
| 311 | const audio_config_base_t *clientConfig, |
| 312 | const audio_config_base_t *deviceConfig); |
Eric Laurent | 951f455 | 2014-05-20 10:48:17 -0700 | [diff] [blame] | 313 | void insertCommand_l(AudioCommand *command, int delayMs = 0); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 314 | |
| 315 | private: |
Jesper Tragardh | 48412dc | 2014-03-24 14:12:43 +0100 | [diff] [blame] | 316 | class AudioCommandData; |
| 317 | |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 318 | // descriptor for requested tone playback event |
Eric Laurent | 0ede892 | 2014-05-09 18:04:42 -0700 | [diff] [blame] | 319 | class AudioCommand: public RefBase { |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 320 | |
| 321 | public: |
| 322 | AudioCommand() |
Eric Laurent | 0ede892 | 2014-05-09 18:04:42 -0700 | [diff] [blame] | 323 | : mCommand(-1), mStatus(NO_ERROR), mWaitStatus(false) {} |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 324 | |
| 325 | void dump(char* buffer, size_t size); |
| 326 | |
| 327 | int mCommand; // START_TONE, STOP_TONE ... |
| 328 | nsecs_t mTime; // time stamp |
Eric Laurent | 0ede892 | 2014-05-09 18:04:42 -0700 | [diff] [blame] | 329 | Mutex mLock; // mutex associated to mCond |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 330 | Condition mCond; // condition for status return |
| 331 | status_t mStatus; // command status |
| 332 | bool mWaitStatus; // true if caller is waiting for status |
Eric Laurent | 0ede892 | 2014-05-09 18:04:42 -0700 | [diff] [blame] | 333 | sp<AudioCommandData> mParam; // command specific parameter data |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 334 | }; |
| 335 | |
Eric Laurent | 0ede892 | 2014-05-09 18:04:42 -0700 | [diff] [blame] | 336 | class AudioCommandData: public RefBase { |
Jesper Tragardh | 48412dc | 2014-03-24 14:12:43 +0100 | [diff] [blame] | 337 | public: |
| 338 | virtual ~AudioCommandData() {} |
| 339 | protected: |
| 340 | AudioCommandData() {} |
| 341 | }; |
| 342 | |
| 343 | class ToneData : public AudioCommandData { |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 344 | public: |
Glenn Kasten | 3d2f877 | 2012-01-27 15:25:25 -0800 | [diff] [blame] | 345 | ToneGenerator::tone_type mType; // tone type (START_TONE only) |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 346 | audio_stream_type_t mStream; // stream type (START_TONE only) |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 347 | }; |
| 348 | |
Jesper Tragardh | 48412dc | 2014-03-24 14:12:43 +0100 | [diff] [blame] | 349 | class VolumeData : public AudioCommandData { |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 350 | public: |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 351 | audio_stream_type_t mStream; |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 352 | float mVolume; |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 353 | audio_io_handle_t mIO; |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 354 | }; |
| 355 | |
Jesper Tragardh | 48412dc | 2014-03-24 14:12:43 +0100 | [diff] [blame] | 356 | class ParametersData : public AudioCommandData { |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 357 | public: |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 358 | audio_io_handle_t mIO; |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 359 | String8 mKeyValuePairs; |
| 360 | }; |
| 361 | |
Jesper Tragardh | 48412dc | 2014-03-24 14:12:43 +0100 | [diff] [blame] | 362 | class VoiceVolumeData : public AudioCommandData { |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 363 | public: |
| 364 | float mVolume; |
| 365 | }; |
| 366 | |
Jesper Tragardh | 48412dc | 2014-03-24 14:12:43 +0100 | [diff] [blame] | 367 | class StopOutputData : public AudioCommandData { |
Eric Laurent | bfb1b83 | 2013-01-07 09:53:42 -0800 | [diff] [blame] | 368 | public: |
| 369 | audio_io_handle_t mIO; |
| 370 | audio_stream_type_t mStream; |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 371 | audio_session_t mSession; |
Eric Laurent | bfb1b83 | 2013-01-07 09:53:42 -0800 | [diff] [blame] | 372 | }; |
| 373 | |
Jesper Tragardh | 48412dc | 2014-03-24 14:12:43 +0100 | [diff] [blame] | 374 | class ReleaseOutputData : public AudioCommandData { |
Eric Laurent | bfb1b83 | 2013-01-07 09:53:42 -0800 | [diff] [blame] | 375 | public: |
| 376 | audio_io_handle_t mIO; |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 377 | audio_stream_type_t mStream; |
| 378 | audio_session_t mSession; |
Eric Laurent | bfb1b83 | 2013-01-07 09:53:42 -0800 | [diff] [blame] | 379 | }; |
| 380 | |
Eric Laurent | 951f455 | 2014-05-20 10:48:17 -0700 | [diff] [blame] | 381 | class CreateAudioPatchData : public AudioCommandData { |
| 382 | public: |
| 383 | struct audio_patch mPatch; |
| 384 | audio_patch_handle_t mHandle; |
| 385 | }; |
| 386 | |
| 387 | class ReleaseAudioPatchData : public AudioCommandData { |
| 388 | public: |
| 389 | audio_patch_handle_t mHandle; |
| 390 | }; |
| 391 | |
Eric Laurent | e1715a4 | 2014-05-20 11:30:42 -0700 | [diff] [blame] | 392 | class SetAudioPortConfigData : public AudioCommandData { |
| 393 | public: |
| 394 | struct audio_port_config mConfig; |
| 395 | }; |
| 396 | |
Jean-Michel Trivi | de80105 | 2015-04-14 19:10:14 -0700 | [diff] [blame] | 397 | class DynPolicyMixStateUpdateData : public AudioCommandData { |
| 398 | public: |
| 399 | String8 mRegId; |
| 400 | int32_t mState; |
| 401 | }; |
| 402 | |
Jean-Michel Trivi | 2f4fe9f | 2015-12-04 16:20:59 -0800 | [diff] [blame] | 403 | class RecordingConfigurationUpdateData : public AudioCommandData { |
| 404 | public: |
| 405 | int mEvent; |
| 406 | audio_session_t mSession; |
| 407 | audio_source_t mSource; |
Jean-Michel Trivi | 7281aa9 | 2016-02-17 15:33:40 -0800 | [diff] [blame^] | 408 | struct audio_config_base mClientConfig; |
| 409 | struct audio_config_base mDeviceConfig; |
Jean-Michel Trivi | 2f4fe9f | 2015-12-04 16:20:59 -0800 | [diff] [blame] | 410 | }; |
| 411 | |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 412 | Mutex mLock; |
| 413 | Condition mWaitWorkCV; |
Eric Laurent | 0ede892 | 2014-05-09 18:04:42 -0700 | [diff] [blame] | 414 | Vector < sp<AudioCommand> > mAudioCommands; // list of pending commands |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 415 | ToneGenerator *mpToneGenerator; // the tone generator |
Eric Laurent | 0ede892 | 2014-05-09 18:04:42 -0700 | [diff] [blame] | 416 | sp<AudioCommand> mLastCommand; // last processed command (used by dump) |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 417 | String8 mName; // string used by wake lock fo delayed commands |
Eric Laurent | bfb1b83 | 2013-01-07 09:53:42 -0800 | [diff] [blame] | 418 | wp<AudioPolicyService> mService; |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 419 | }; |
| 420 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 421 | class AudioPolicyClient : public AudioPolicyClientInterface |
| 422 | { |
| 423 | public: |
| 424 | AudioPolicyClient(AudioPolicyService *service) : mAudioPolicyService(service) {} |
| 425 | virtual ~AudioPolicyClient() {} |
| 426 | |
| 427 | // |
| 428 | // Audio HW module functions |
| 429 | // |
| 430 | |
| 431 | // loads a HW module. |
| 432 | virtual audio_module_handle_t loadHwModule(const char *name); |
| 433 | |
| 434 | // |
| 435 | // Audio output Control functions |
| 436 | // |
| 437 | |
| 438 | // opens an audio output with the requested parameters. The parameter values can indicate to use the default values |
| 439 | // in case the audio policy manager has no specific requirements for the output being opened. |
| 440 | // When the function returns, the parameter values reflect the actual values used by the audio hardware output stream. |
| 441 | // The audio policy manager can check if the proposed parameters are suitable or not and act accordingly. |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 442 | virtual status_t openOutput(audio_module_handle_t module, |
| 443 | audio_io_handle_t *output, |
| 444 | audio_config_t *config, |
| 445 | audio_devices_t *devices, |
| 446 | const String8& address, |
| 447 | uint32_t *latencyMs, |
| 448 | audio_output_flags_t flags); |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 449 | // creates a special output that is duplicated to the two outputs passed as arguments. The duplication is performed by |
| 450 | // a special mixer thread in the AudioFlinger. |
| 451 | virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1, audio_io_handle_t output2); |
| 452 | // closes the output stream |
| 453 | virtual status_t closeOutput(audio_io_handle_t output); |
| 454 | // suspends the output. When an output is suspended, the corresponding audio hardware output stream is placed in |
| 455 | // standby and the AudioTracks attached to the mixer thread are still processed but the output mix is discarded. |
| 456 | virtual status_t suspendOutput(audio_io_handle_t output); |
| 457 | // restores a suspended output. |
| 458 | virtual status_t restoreOutput(audio_io_handle_t output); |
| 459 | |
| 460 | // |
| 461 | // Audio input Control functions |
| 462 | // |
| 463 | |
| 464 | // opens an audio input |
| 465 | virtual audio_io_handle_t openInput(audio_module_handle_t module, |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 466 | audio_io_handle_t *input, |
| 467 | audio_config_t *config, |
| 468 | audio_devices_t *devices, |
| 469 | const String8& address, |
| 470 | audio_source_t source, |
Glenn Kasten | ec40d28 | 2014-07-15 15:31:26 -0700 | [diff] [blame] | 471 | audio_input_flags_t flags); |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 472 | // closes an audio input |
| 473 | virtual status_t closeInput(audio_io_handle_t input); |
| 474 | // |
| 475 | // misc control functions |
| 476 | // |
| 477 | |
| 478 | // set a stream volume for a particular output. For the same user setting, a given stream type can have different volumes |
| 479 | // for each output (destination device) it is attached to. |
| 480 | virtual status_t setStreamVolume(audio_stream_type_t stream, float volume, audio_io_handle_t output, int delayMs = 0); |
| 481 | |
| 482 | // invalidate a stream type, causing a reroute to an unspecified new output |
| 483 | virtual status_t invalidateStream(audio_stream_type_t stream); |
| 484 | |
| 485 | // function enabling to send proprietary informations directly from audio policy manager to audio hardware interface. |
| 486 | virtual void setParameters(audio_io_handle_t ioHandle, const String8& keyValuePairs, int delayMs = 0); |
| 487 | // function enabling to receive proprietary informations directly from audio hardware interface to audio policy manager. |
| 488 | virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys); |
| 489 | |
| 490 | // request the playback of a tone on the specified stream: used for instance to replace notification sounds when playing |
| 491 | // over a telephony device during a phone call. |
| 492 | virtual status_t startTone(audio_policy_tone_t tone, audio_stream_type_t stream); |
| 493 | virtual status_t stopTone(); |
| 494 | |
| 495 | // set down link audio volume. |
| 496 | virtual status_t setVoiceVolume(float volume, int delayMs = 0); |
| 497 | |
| 498 | // move effect to the specified output |
| 499 | virtual status_t moveEffects(int session, |
| 500 | audio_io_handle_t srcOutput, |
| 501 | audio_io_handle_t dstOutput); |
| 502 | |
Eric Laurent | 951f455 | 2014-05-20 10:48:17 -0700 | [diff] [blame] | 503 | /* Create a patch between several source and sink ports */ |
| 504 | virtual status_t createAudioPatch(const struct audio_patch *patch, |
| 505 | audio_patch_handle_t *handle, |
| 506 | int delayMs); |
| 507 | |
| 508 | /* Release a patch */ |
| 509 | virtual status_t releaseAudioPatch(audio_patch_handle_t handle, |
| 510 | int delayMs); |
| 511 | |
Eric Laurent | e1715a4 | 2014-05-20 11:30:42 -0700 | [diff] [blame] | 512 | /* Set audio port configuration */ |
| 513 | virtual status_t setAudioPortConfig(const struct audio_port_config *config, int delayMs); |
| 514 | |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 515 | virtual void onAudioPortListUpdate(); |
| 516 | virtual void onAudioPatchListUpdate(); |
Jean-Michel Trivi | de80105 | 2015-04-14 19:10:14 -0700 | [diff] [blame] | 517 | virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state); |
Jean-Michel Trivi | 2f4fe9f | 2015-12-04 16:20:59 -0800 | [diff] [blame] | 518 | virtual void onRecordingConfigurationUpdate(int event, |
Jean-Michel Trivi | 7281aa9 | 2016-02-17 15:33:40 -0800 | [diff] [blame^] | 519 | audio_session_t session, audio_source_t source, |
| 520 | const audio_config_base_t *clientConfig, |
| 521 | const audio_config_base_t *deviceConfig); |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 522 | |
Eric Laurent | de3f839 | 2014-07-27 18:38:22 -0700 | [diff] [blame] | 523 | virtual audio_unique_id_t newAudioUniqueId(); |
| 524 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 525 | private: |
| 526 | AudioPolicyService *mAudioPolicyService; |
| 527 | }; |
| 528 | |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 529 | // --- Notification Client --- |
| 530 | class NotificationClient : public IBinder::DeathRecipient { |
| 531 | public: |
| 532 | NotificationClient(const sp<AudioPolicyService>& service, |
| 533 | const sp<IAudioPolicyServiceClient>& client, |
| 534 | uid_t uid); |
| 535 | virtual ~NotificationClient(); |
| 536 | |
Jean-Michel Trivi | de80105 | 2015-04-14 19:10:14 -0700 | [diff] [blame] | 537 | void onAudioPortListUpdate(); |
| 538 | void onAudioPatchListUpdate(); |
| 539 | void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state); |
Jean-Michel Trivi | 2f4fe9f | 2015-12-04 16:20:59 -0800 | [diff] [blame] | 540 | void onRecordingConfigurationUpdate( |
| 541 | int event, audio_session_t session, |
Jean-Michel Trivi | 7281aa9 | 2016-02-17 15:33:40 -0800 | [diff] [blame^] | 542 | audio_source_t source, |
| 543 | const audio_config_base_t *clientConfig, |
| 544 | const audio_config_base_t *deviceConfig); |
Eric Laurent | e8726fe | 2015-06-26 09:39:24 -0700 | [diff] [blame] | 545 | void setAudioPortCallbacksEnabled(bool enabled); |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 546 | |
| 547 | // IBinder::DeathRecipient |
| 548 | virtual void binderDied(const wp<IBinder>& who); |
| 549 | |
| 550 | private: |
| 551 | NotificationClient(const NotificationClient&); |
| 552 | NotificationClient& operator = (const NotificationClient&); |
| 553 | |
| 554 | const wp<AudioPolicyService> mService; |
| 555 | const uid_t mUid; |
| 556 | const sp<IAudioPolicyServiceClient> mAudioPolicyServiceClient; |
Eric Laurent | e8726fe | 2015-06-26 09:39:24 -0700 | [diff] [blame] | 557 | bool mAudioPortCallbacksEnabled; |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 558 | }; |
| 559 | |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 560 | // Internal dump utilities. |
| 561 | status_t dumpPermissionDenial(int fd); |
| 562 | |
| 563 | |
Eric Laurent | eda6c36 | 2011-02-02 09:33:30 -0800 | [diff] [blame] | 564 | mutable Mutex mLock; // prevents concurrent access to AudioPolicy manager functions changing |
| 565 | // device connection state or routing |
Haynes Mathew George | bab7bf4 | 2015-10-30 18:02:23 -0700 | [diff] [blame] | 566 | mutable Mutex mEffectsLock; // serialize access to Effect state within APM. |
| 567 | // Note: lock acquisition order is always mLock > mEffectsLock: |
| 568 | // mLock protects AudioPolicyManager methods that can call into audio flinger |
| 569 | // and possibly back in to audio policy service and acquire mEffectsLock. |
Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 570 | sp<AudioCommandThread> mAudioCommandThread; // audio commands thread |
| 571 | sp<AudioCommandThread> mTonePlaybackThread; // tone playback thread |
Eric Laurent | bfb1b83 | 2013-01-07 09:53:42 -0800 | [diff] [blame] | 572 | sp<AudioCommandThread> mOutputCommandThread; // process stop and release output |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 573 | struct audio_policy_device *mpAudioPolicyDev; |
| 574 | struct audio_policy *mpAudioPolicy; |
Eric Laurent | f269b8e | 2014-06-09 20:01:29 -0700 | [diff] [blame] | 575 | AudioPolicyInterface *mAudioPolicyManager; |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 576 | AudioPolicyClient *mAudioPolicyClient; |
| 577 | |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 578 | DefaultKeyedVector< uid_t, sp<NotificationClient> > mNotificationClients; |
Eric Laurent | 0ebd5f9 | 2014-11-19 19:04:52 -0800 | [diff] [blame] | 579 | Mutex mNotificationClientsLock; // protects mNotificationClients |
bryant_liu | ba2b439 | 2014-06-11 16:49:30 +0800 | [diff] [blame] | 580 | // Manage all effects configured in audio_effects.conf |
| 581 | sp<AudioPolicyEffects> mAudioPolicyEffects; |
Eric Laurent | bb6c9a0 | 2014-09-25 14:11:47 -0700 | [diff] [blame] | 582 | audio_mode_t mPhoneState; |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 583 | }; |
| 584 | |
| 585 | }; // namespace android |
| 586 | |
| 587 | #endif // ANDROID_AUDIOPOLICYSERVICE_H |