blob: 45d37dc022bfaff572271ef1c7d3d3cedadb6bdd [file] [log] [blame]
Mathias Agopian65ab4712010-07-14 17:59:35 -07001/*
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 Laurent7c7f10b2011-06-17 21:29:58 -070020#include <cutils/misc.h>
21#include <cutils/config_utils.h>
Mathias Agopiane762be92013-05-09 16:26:45 -070022#include <cutils/compiler.h>
Glenn Kastend1d8f232011-07-08 09:34:50 -070023#include <utils/String8.h>
Mathias Agopian65ab4712010-07-14 17:59:35 -070024#include <utils/Vector.h>
Eric Laurent7c7f10b2011-06-17 21:29:58 -070025#include <utils/SortedVector.h>
Glenn Kastend2dcb082011-02-03 16:55:26 -080026#include <binder/BinderService.h>
Svet Ganovf4ddfef2018-01-16 07:37:58 -080027#include <binder/IUidObserver.h>
Dima Zavin64760242011-05-11 14:15:23 -070028#include <system/audio.h>
Dima Zavin7394a4f2011-06-13 18:16:26 -070029#include <system/audio_policy.h>
Eric Laurent7c7f10b2011-06-17 21:29:58 -070030#include <media/IAudioPolicyService.h>
31#include <media/ToneGenerator.h>
32#include <media/AudioEffect.h>
Eric Laurentbaac1832014-12-01 17:52:59 -080033#include <media/AudioPolicy.h>
bryant_liuba2b4392014-06-11 16:49:30 +080034#include "AudioPolicyEffects.h"
Jean-Michel Trivi56ec4ff2015-01-23 16:45:18 -080035#include "managerdefault/AudioPolicyManager.h"
Michael Groovercfd28302018-12-11 19:16:46 -080036#include <android/hardware/BnSensorPrivacyListener.h>
Dima Zavinfce7a472011-04-19 22:30:36 -070037
Svet Ganovf4ddfef2018-01-16 07:37:58 -080038#include <unordered_map>
bryant_liuba2b4392014-06-11 16:49:30 +080039
Mathias Agopian65ab4712010-07-14 17:59:35 -070040namespace android {
41
Mathias Agopian65ab4712010-07-14 17:59:35 -070042// ----------------------------------------------------------------------------
43
Glenn Kastend2dcb082011-02-03 16:55:26 -080044class AudioPolicyService :
45 public BinderService<AudioPolicyService>,
46 public BnAudioPolicyService,
Eric Laurentde070132010-07-13 04:45:46 -070047 public IBinder::DeathRecipient
Mathias Agopian65ab4712010-07-14 17:59:35 -070048{
Glenn Kastend2dcb082011-02-03 16:55:26 -080049 friend class BinderService<AudioPolicyService>;
Mathias Agopian65ab4712010-07-14 17:59:35 -070050
51public:
Glenn Kastend2dcb082011-02-03 16:55:26 -080052 // for BinderService
Mathias Agopiane762be92013-05-09 16:26:45 -070053 static const char *getServiceName() ANDROID_API { return "media.audio_policy"; }
Mathias Agopian65ab4712010-07-14 17:59:35 -070054
55 virtual status_t dump(int fd, const Vector<String16>& args);
56
57 //
58 // BnAudioPolicyService (see AudioPolicyInterface for method descriptions)
59 //
60
Dima Zavinfce7a472011-04-19 22:30:36 -070061 virtual status_t setDeviceConnectionState(audio_devices_t device,
62 audio_policy_dev_state_t state,
Paul McLeane743a472015-01-28 11:07:31 -080063 const char *device_address,
64 const char *device_name);
Dima Zavinfce7a472011-04-19 22:30:36 -070065 virtual audio_policy_dev_state_t getDeviceConnectionState(
66 audio_devices_t device,
Eric Laurentde070132010-07-13 04:45:46 -070067 const char *device_address);
Pavlin Radoslavovf862bc62016-12-26 18:57:22 -080068 virtual status_t handleDeviceConfigChange(audio_devices_t device,
69 const char *device_address,
70 const char *device_name);
Glenn Kastenf78aee72012-01-04 11:00:47 -080071 virtual status_t setPhoneState(audio_mode_t state);
Dima Zavinfce7a472011-04-19 22:30:36 -070072 virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config);
73 virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage);
Eric Laurentf4e63452017-11-06 19:31:46 +000074 virtual audio_io_handle_t getOutput(audio_stream_type_t stream);
Eric Laurente83b55d2014-11-14 10:06:21 -080075 virtual status_t getOutputForAttr(const audio_attributes_t *attr,
76 audio_io_handle_t *output,
77 audio_session_t session,
78 audio_stream_type_t *stream,
Nadav Bar766fb022018-01-07 12:18:03 +020079 pid_t pid,
Eric Laurent8c7e6da2015-04-21 17:37:00 -070080 uid_t uid,
Eric Laurent20b9ef02016-12-05 11:03:16 -080081 const audio_config_t *config,
82 audio_output_flags_t flags,
Eric Laurent9ae8c592017-06-22 17:17:09 -070083 audio_port_handle_t *selectedDeviceId,
Eric Laurent20b9ef02016-12-05 11:03:16 -080084 audio_port_handle_t *portId);
Eric Laurentd7fe0862018-07-14 16:48:01 -070085 virtual status_t startOutput(audio_port_handle_t portId);
86 virtual status_t stopOutput(audio_port_handle_t portId);
87 virtual void releaseOutput(audio_port_handle_t portId);
Eric Laurentcaf7f482014-11-25 17:50:47 -080088 virtual status_t getInputForAttr(const audio_attributes_t *attr,
89 audio_io_handle_t *input,
90 audio_session_t session,
Eric Laurentb2379ba2016-05-23 17:42:12 -070091 pid_t pid,
Eric Laurent8c7e6da2015-04-21 17:37:00 -070092 uid_t uid,
Eric Laurentfee19762018-01-29 18:44:13 -080093 const String16& opPackageName,
Eric Laurent20b9ef02016-12-05 11:03:16 -080094 const audio_config_base_t *config,
Paul McLean466dc8e2015-04-17 13:15:36 -060095 audio_input_flags_t flags,
Eric Laurent9ae8c592017-06-22 17:17:09 -070096 audio_port_handle_t *selectedDeviceId = NULL,
Eric Laurent20b9ef02016-12-05 11:03:16 -080097 audio_port_handle_t *portId = NULL);
Eric Laurent4eb58f12018-12-07 16:41:02 -080098 virtual status_t startInput(audio_port_handle_t portId);
Eric Laurentfee19762018-01-29 18:44:13 -080099 virtual status_t stopInput(audio_port_handle_t portId);
100 virtual void releaseInput(audio_port_handle_t portId);
Dima Zavinfce7a472011-04-19 22:30:36 -0700101 virtual status_t initStreamVolume(audio_stream_type_t stream,
Mathias Agopian65ab4712010-07-14 17:59:35 -0700102 int indexMin,
103 int indexMax);
Eric Laurent83844cc2011-11-18 16:43:31 -0800104 virtual status_t setStreamVolumeIndex(audio_stream_type_t stream,
105 int index,
106 audio_devices_t device);
107 virtual status_t getStreamVolumeIndex(audio_stream_type_t stream,
108 int *index,
109 audio_devices_t device);
Mathias Agopian65ab4712010-07-14 17:59:35 -0700110
Dima Zavinfce7a472011-04-19 22:30:36 -0700111 virtual uint32_t getStrategyForStream(audio_stream_type_t stream);
Eric Laurent63742522012-03-08 13:42:42 -0800112 virtual audio_devices_t getDevicesForStream(audio_stream_type_t stream);
Eric Laurentde070132010-07-13 04:45:46 -0700113
Glenn Kasten58e5aa32012-06-20 14:08:14 -0700114 virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t *desc);
115 virtual status_t registerEffect(const effect_descriptor_t *desc,
Eric Laurent7c7f10b2011-06-17 21:29:58 -0700116 audio_io_handle_t io,
Eric Laurentde070132010-07-13 04:45:46 -0700117 uint32_t strategy,
Glenn Kastend848eb42016-03-08 13:42:11 -0800118 audio_session_t session,
Eric Laurentde070132010-07-13 04:45:46 -0700119 int id);
120 virtual status_t unregisterEffect(int id);
Eric Laurentdb7c0792011-08-10 10:37:50 -0700121 virtual status_t setEffectEnabled(int id, bool enabled);
Glenn Kastenfff6d712012-01-12 16:38:12 -0800122 virtual bool isStreamActive(audio_stream_type_t stream, uint32_t inPastMs = 0) const;
Jean-Michel Trivi272ab542013-02-04 16:26:02 -0800123 virtual bool isStreamActiveRemotely(audio_stream_type_t stream, uint32_t inPastMs = 0) const;
Jean-Michel Trivid7086032012-10-10 12:11:16 -0700124 virtual bool isSourceActive(audio_source_t source) const;
Eric Laurentde070132010-07-13 04:45:46 -0700125
Glenn Kastend848eb42016-03-08 13:42:11 -0800126 virtual status_t queryDefaultPreProcessing(audio_session_t audioSession,
Eric Laurent57dae992011-07-24 13:36:09 -0700127 effect_descriptor_t *descriptors,
128 uint32_t *count);
Ari Hausman-Cohen24628312018-08-13 15:01:09 -0700129 virtual status_t addSourceDefaultEffect(const effect_uuid_t *type,
130 const String16& opPackageName,
131 const effect_uuid_t *uuid,
132 int32_t priority,
133 audio_source_t source,
134 audio_unique_id_t* id);
Ari Hausman-Cohen433722e2018-04-24 14:25:22 -0700135 virtual status_t addStreamDefaultEffect(const effect_uuid_t *type,
136 const String16& opPackageName,
137 const effect_uuid_t *uuid,
138 int32_t priority,
139 audio_usage_t usage,
140 audio_unique_id_t* id);
Ari Hausman-Cohen24628312018-08-13 15:01:09 -0700141 virtual status_t removeSourceDefaultEffect(audio_unique_id_t id);
Ari Hausman-Cohen433722e2018-04-24 14:25:22 -0700142 virtual status_t removeStreamDefaultEffect(audio_unique_id_t id);
143
Mathias Agopian65ab4712010-07-14 17:59:35 -0700144 virtual status_t onTransact(
145 uint32_t code,
146 const Parcel& data,
147 Parcel* reply,
148 uint32_t flags);
149
150 // IBinder::DeathRecipient
151 virtual void binderDied(const wp<IBinder>& who);
152
Eric Laurentf5ada6e2014-10-09 17:49:00 -0700153 // RefBase
154 virtual void onFirstRef();
155
Mathias Agopian65ab4712010-07-14 17:59:35 -0700156 //
Dima Zavinfce7a472011-04-19 22:30:36 -0700157 // Helpers for the struct audio_policy_service_ops implementation.
158 // This is used by the audio policy manager for certain operations that
159 // are implemented by the policy service.
Mathias Agopian65ab4712010-07-14 17:59:35 -0700160 //
Dima Zavinfce7a472011-04-19 22:30:36 -0700161 virtual void setParameters(audio_io_handle_t ioHandle,
162 const char *keyValuePairs,
163 int delayMs);
164
165 virtual status_t setStreamVolume(audio_stream_type_t stream,
Eric Laurentde070132010-07-13 04:45:46 -0700166 float volume,
167 audio_io_handle_t output,
168 int delayMs = 0);
Mathias Agopian65ab4712010-07-14 17:59:35 -0700169 virtual status_t setVoiceVolume(float volume, int delayMs = 0);
Richard Fitzgeraldad3af332013-03-25 16:54:37 +0000170 virtual bool isOffloadSupported(const audio_offload_info_t &config);
Michael Chana94fbb22018-04-24 14:31:19 +1000171 virtual bool isDirectOutputSupported(const audio_config_base_t& config,
172 const audio_attributes_t& attributes);
Mathias Agopian65ab4712010-07-14 17:59:35 -0700173
Eric Laurent203b1a12014-04-01 10:34:16 -0700174 virtual status_t listAudioPorts(audio_port_role_t role,
175 audio_port_type_t type,
176 unsigned int *num_ports,
177 struct audio_port *ports,
178 unsigned int *generation);
179 virtual status_t getAudioPort(struct audio_port *port);
180 virtual status_t createAudioPatch(const struct audio_patch *patch,
181 audio_patch_handle_t *handle);
182 virtual status_t releaseAudioPatch(audio_patch_handle_t handle);
183 virtual status_t listAudioPatches(unsigned int *num_patches,
184 struct audio_patch *patches,
185 unsigned int *generation);
186 virtual status_t setAudioPortConfig(const struct audio_port_config *config);
187
Eric Laurentb52c1522014-05-20 11:27:36 -0700188 virtual void registerClient(const sp<IAudioPolicyServiceClient>& client);
189
Eric Laurente8726fe2015-06-26 09:39:24 -0700190 virtual void setAudioPortCallbacksEnabled(bool enabled);
191
Eric Laurentdf3dc7e2014-07-27 18:39:40 -0700192 virtual status_t acquireSoundTriggerSession(audio_session_t *session,
193 audio_io_handle_t *ioHandle,
194 audio_devices_t *device);
195
196 virtual status_t releaseSoundTriggerSession(audio_session_t session);
197
Eric Laurentbb6c9a02014-09-25 14:11:47 -0700198 virtual audio_mode_t getPhoneState();
199
Chih-Hung Hsiehe964d4e2016-08-09 14:31:32 -0700200 virtual status_t registerPolicyMixes(const Vector<AudioMix>& mixes, bool registration);
Eric Laurentbaac1832014-12-01 17:52:59 -0800201
Eric Laurent554a2772015-04-10 11:29:24 -0700202 virtual status_t startAudioSource(const struct audio_port_config *source,
203 const audio_attributes_t *attributes,
Eric Laurent3e6c7e12018-07-27 17:09:23 -0700204 audio_port_handle_t *portId);
205 virtual status_t stopAudioSource(audio_port_handle_t portId);
Eric Laurent554a2772015-04-10 11:29:24 -0700206
Andy Hung2ddee192015-12-18 17:34:44 -0800207 virtual status_t setMasterMono(bool mono);
208 virtual status_t getMasterMono(bool *mono);
209
Eric Laurentac9cef52017-06-09 15:46:26 -0700210 virtual float getStreamVolumeDB(
211 audio_stream_type_t stream, int index, audio_devices_t device);
212
jiabin81772902018-04-02 17:52:27 -0700213 virtual status_t getSurroundFormats(unsigned int *numSurroundFormats,
214 audio_format_t *surroundFormats,
215 bool *surroundFormatsEnabled,
216 bool reported);
217 virtual status_t setSurroundFormatEnabled(audio_format_t audioFormat, bool enabled);
218
Eric Laurentb78763e2018-10-17 10:08:02 -0700219 virtual status_t setAssistantUid(uid_t uid);
220 virtual status_t setA11yServicesUids(const std::vector<uid_t>& uids);
221
jiabin6012f912018-11-02 17:06:30 -0700222 virtual bool isHapticPlaybackSupported();
223
Eric Laurentd7fe0862018-07-14 16:48:01 -0700224 status_t doStopOutput(audio_port_handle_t portId);
225 void doReleaseOutput(audio_port_handle_t portId);
Eric Laurentbfb1b832013-01-07 09:53:42 -0800226
Eric Laurent951f4552014-05-20 10:48:17 -0700227 status_t clientCreateAudioPatch(const struct audio_patch *patch,
228 audio_patch_handle_t *handle,
229 int delayMs);
230 status_t clientReleaseAudioPatch(audio_patch_handle_t handle,
231 int delayMs);
Eric Laurente1715a42014-05-20 11:30:42 -0700232 virtual status_t clientSetAudioPortConfig(const struct audio_port_config *config,
233 int delayMs);
234
luochaojiang908c7d72018-06-21 14:58:04 +0800235 void removeNotificationClient(uid_t uid, pid_t pid);
Eric Laurentb52c1522014-05-20 11:27:36 -0700236 void onAudioPortListUpdate();
237 void doOnAudioPortListUpdate();
238 void onAudioPatchListUpdate();
239 void doOnAudioPatchListUpdate();
Eric Laurent951f4552014-05-20 10:48:17 -0700240
Chih-Hung Hsiehe964d4e2016-08-09 14:31:32 -0700241 void onDynamicPolicyMixStateUpdate(const String8& regId, int32_t state);
242 void doOnDynamicPolicyMixStateUpdate(const String8& regId, int32_t state);
Jean-Michel Triviac4e4292016-12-22 11:39:31 -0800243 void onRecordingConfigurationUpdate(int event, const record_client_info_t *clientInfo,
244 const audio_config_base_t *clientConfig,
Jean-Michel Trivi8c7cf3b2016-02-25 17:08:24 -0800245 const audio_config_base_t *deviceConfig, audio_patch_handle_t patchHandle);
Jean-Michel Triviac4e4292016-12-22 11:39:31 -0800246 void doOnRecordingConfigurationUpdate(int event, const record_client_info_t *clientInfo,
247 const audio_config_base_t *clientConfig,
Jean-Michel Trivi8c7cf3b2016-02-25 17:08:24 -0800248 const audio_config_base_t *deviceConfig, audio_patch_handle_t patchHandle);
Jean-Michel Trivide801052015-04-14 19:10:14 -0700249
Mathias Agopian65ab4712010-07-14 17:59:35 -0700250private:
Mathias Agopiane762be92013-05-09 16:26:45 -0700251 AudioPolicyService() ANDROID_API;
Mathias Agopian65ab4712010-07-14 17:59:35 -0700252 virtual ~AudioPolicyService();
253
254 status_t dumpInternals(int fd);
255
Svet Ganovf4ddfef2018-01-16 07:37:58 -0800256 // Handles binder shell commands
257 virtual status_t shellCommand(int in, int out, int err, Vector<String16>& args);
258
259 // Sets whether the given UID records only silence
Eric Laurente8c8b432018-10-17 10:08:02 -0700260 virtual void setAppState_l(uid_t uid, app_state_t state);
Svet Ganovf4ddfef2018-01-16 07:37:58 -0800261
262 // Overrides the UID state as if it is idle
263 status_t handleSetUidState(Vector<String16>& args, int err);
264
265 // Clears the override for the UID state
266 status_t handleResetUidState(Vector<String16>& args, int err);
267
268 // Gets the UID state
269 status_t handleGetUidState(Vector<String16>& args, int out, int err);
270
271 // Prints the shell command help
272 status_t printHelp(int out);
273
Eric Laurent99fcae42018-05-17 16:59:18 -0700274 std::string getDeviceTypeStrForPortId(audio_port_handle_t portId);
275
Ari Hausman-Cohen24628312018-08-13 15:01:09 -0700276 status_t getAudioPolicyEffects(sp<AudioPolicyEffects>& audioPolicyEffects);
277
Eric Laurente8c8b432018-10-17 10:08:02 -0700278 app_state_t apmStatFromAmState(int amState);
279
280 void updateUidStates();
281 void updateUidStates_l();
282
Michael Groovercfd28302018-12-11 19:16:46 -0800283 void silenceAllRecordings_l();
284
Eric Laurent4eb58f12018-12-07 16:41:02 -0800285 static bool isPrivacySensitive(audio_source_t source);
286
Svet Ganovf4ddfef2018-01-16 07:37:58 -0800287 // If recording we need to make sure the UID is allowed to do that. If the UID is idle
288 // then it cannot record and gets buffers with zeros - silence. As soon as the UID
289 // transitions to an active state we will start reporting buffers with data. This approach
290 // transparently handles recording while the UID transitions between idle/active state
291 // avoiding to get stuck in a state receiving non-empty buffers while idle or in a state
292 // receiving empty buffers while active.
Mikhail Naganoveae73eb2018-04-03 16:57:36 -0700293 class UidPolicy : public BnUidObserver, public virtual IBinder::DeathRecipient {
Svet Ganovf4ddfef2018-01-16 07:37:58 -0800294 public:
295 explicit UidPolicy(wp<AudioPolicyService> service)
Eric Laurentb78763e2018-10-17 10:08:02 -0700296 : mService(service), mObserverRegistered(false), mAssistantUid(0) {}
Svet Ganovf4ddfef2018-01-16 07:37:58 -0800297
298 void registerSelf();
299 void unregisterSelf();
300
Mikhail Naganoveae73eb2018-04-03 16:57:36 -0700301 // IBinder::DeathRecipient implementation
302 void binderDied(const wp<IBinder> &who) override;
303
Svet Ganovf4ddfef2018-01-16 07:37:58 -0800304 bool isUidActive(uid_t uid);
Eric Laurente8c8b432018-10-17 10:08:02 -0700305 int getUidState(uid_t uid);
Eric Laurentb78763e2018-10-17 10:08:02 -0700306 void setAssistantUid(uid_t uid) { mAssistantUid = uid; }
307 bool isAssistantUid(uid_t uid) { return uid == mAssistantUid; }
308 void setA11yUids(const std::vector<uid_t>& uids) { mA11yUids.clear(); mA11yUids = uids; }
309 bool isA11yUid(uid_t uid);
Eric Laurent4eb58f12018-12-07 16:41:02 -0800310 bool isA11yOnTop();
Svet Ganovf4ddfef2018-01-16 07:37:58 -0800311
Mikhail Naganoveae73eb2018-04-03 16:57:36 -0700312 // BnUidObserver implementation
313 void onUidActive(uid_t uid) override;
314 void onUidGone(uid_t uid, bool disabled) override;
315 void onUidIdle(uid_t uid, bool disabled) override;
Eric Laurente8c8b432018-10-17 10:08:02 -0700316 void onUidStateChanged(uid_t uid, int32_t procState, int64_t procStateSeq);
Svet Ganovf4ddfef2018-01-16 07:37:58 -0800317
Mikhail Naganoveae73eb2018-04-03 16:57:36 -0700318 void addOverrideUid(uid_t uid, bool active) { updateOverrideUid(uid, active, true); }
319 void removeOverrideUid(uid_t uid) { updateOverrideUid(uid, false, false); }
Svet Ganovf4ddfef2018-01-16 07:37:58 -0800320
Eric Laurente8c8b432018-10-17 10:08:02 -0700321 void updateUid(std::unordered_map<uid_t, std::pair<bool, int>> *uids,
322 uid_t uid, bool active, int state, bool insert);
323
324 private:
325 void notifyService();
Svet Ganovf4ddfef2018-01-16 07:37:58 -0800326 void updateOverrideUid(uid_t uid, bool active, bool insert);
Eric Laurente8c8b432018-10-17 10:08:02 -0700327 void updateUidLocked(std::unordered_map<uid_t, std::pair<bool, int>> *uids,
328 uid_t uid, bool active, int state, bool insert);
329 void checkRegistered();
Svet Ganovf4ddfef2018-01-16 07:37:58 -0800330
Svet Ganovf4ddfef2018-01-16 07:37:58 -0800331 wp<AudioPolicyService> mService;
Mikhail Naganoveae73eb2018-04-03 16:57:36 -0700332 Mutex mLock;
333 bool mObserverRegistered;
Eric Laurente8c8b432018-10-17 10:08:02 -0700334 std::unordered_map<uid_t, std::pair<bool, int>> mOverrideUids;
335 std::unordered_map<uid_t, std::pair<bool, int>> mCachedUids;
Eric Laurentb78763e2018-10-17 10:08:02 -0700336 uid_t mAssistantUid;
337 std::vector<uid_t> mA11yUids;
Svet Ganovf4ddfef2018-01-16 07:37:58 -0800338 };
339
Michael Groovercfd28302018-12-11 19:16:46 -0800340 // If sensor privacy is enabled then all apps, including those that are active, should be
341 // prevented from recording. This is handled similar to idle UIDs, any app that attempts
342 // to record while sensor privacy is enabled will receive buffers with zeros. As soon as
343 // sensor privacy is disabled active apps will receive the expected data when recording.
344 class SensorPrivacyPolicy : public hardware::BnSensorPrivacyListener {
345 public:
346 explicit SensorPrivacyPolicy(wp<AudioPolicyService> service)
347 : mService(service) {}
348
349 void registerSelf();
350 void unregisterSelf();
351
352 bool isSensorPrivacyEnabled();
353
354 binder::Status onSensorPrivacyChanged(bool enabled);
355
356 private:
357 wp<AudioPolicyService> mService;
358 std::atomic_bool mSensorPrivacyEnabled;
359 };
360
Eric Laurentdcd4ab12018-06-29 17:45:13 -0700361 // Thread used to send audio config commands to audio flinger
Glenn Kasten85ab62c2012-11-01 11:11:38 -0700362 // For audio config commands, it is necessary because audio flinger requires that the calling
363 // process (user) has permission to modify audio settings.
Mathias Agopian65ab4712010-07-14 17:59:35 -0700364 class AudioCommandThread : public Thread {
365 class AudioCommand;
366 public:
367
368 // commands for tone AudioCommand
369 enum {
Mathias Agopian65ab4712010-07-14 17:59:35 -0700370 SET_VOLUME,
371 SET_PARAMETERS,
Eric Laurentbfb1b832013-01-07 09:53:42 -0800372 SET_VOICE_VOLUME,
373 STOP_OUTPUT,
Eric Laurent951f4552014-05-20 10:48:17 -0700374 RELEASE_OUTPUT,
375 CREATE_AUDIO_PATCH,
376 RELEASE_AUDIO_PATCH,
Eric Laurentb52c1522014-05-20 11:27:36 -0700377 UPDATE_AUDIOPORT_LIST,
Eric Laurente1715a42014-05-20 11:30:42 -0700378 UPDATE_AUDIOPATCH_LIST,
379 SET_AUDIOPORT_CONFIG,
Jean-Michel Trivi2f4fe9f2015-12-04 16:20:59 -0800380 DYN_POLICY_MIX_STATE_UPDATE,
381 RECORDING_CONFIGURATION_UPDATE
Mathias Agopian65ab4712010-07-14 17:59:35 -0700382 };
383
Eric Laurentbfb1b832013-01-07 09:53:42 -0800384 AudioCommandThread (String8 name, const wp<AudioPolicyService>& service);
Mathias Agopian65ab4712010-07-14 17:59:35 -0700385 virtual ~AudioCommandThread();
386
387 status_t dump(int fd);
388
389 // Thread virtuals
390 virtual void onFirstRef();
391 virtual bool threadLoop();
392
393 void exit();
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800394 status_t volumeCommand(audio_stream_type_t stream, float volume,
395 audio_io_handle_t output, int delayMs = 0);
396 status_t parametersCommand(audio_io_handle_t ioHandle,
397 const char *keyValuePairs, int delayMs = 0);
Mathias Agopian65ab4712010-07-14 17:59:35 -0700398 status_t voiceVolumeCommand(float volume, int delayMs = 0);
Eric Laurentd7fe0862018-07-14 16:48:01 -0700399 void stopOutputCommand(audio_port_handle_t portId);
400 void releaseOutputCommand(audio_port_handle_t portId);
Eric Laurent0ede8922014-05-09 18:04:42 -0700401 status_t sendCommand(sp<AudioCommand>& command, int delayMs = 0);
402 void insertCommand_l(sp<AudioCommand>& command, int delayMs = 0);
Eric Laurent951f4552014-05-20 10:48:17 -0700403 status_t createAudioPatchCommand(const struct audio_patch *patch,
404 audio_patch_handle_t *handle,
405 int delayMs);
406 status_t releaseAudioPatchCommand(audio_patch_handle_t handle,
407 int delayMs);
Eric Laurentb52c1522014-05-20 11:27:36 -0700408 void updateAudioPortListCommand();
409 void updateAudioPatchListCommand();
Eric Laurente1715a42014-05-20 11:30:42 -0700410 status_t setAudioPortConfigCommand(const struct audio_port_config *config,
411 int delayMs);
Chih-Hung Hsiehe964d4e2016-08-09 14:31:32 -0700412 void dynamicPolicyMixStateUpdateCommand(const String8& regId, int32_t state);
Jean-Michel Trivi2f4fe9f2015-12-04 16:20:59 -0800413 void recordingConfigurationUpdateCommand(
Jean-Michel Triviac4e4292016-12-22 11:39:31 -0800414 int event,
415 const record_client_info_t *clientInfo,
Jean-Michel Trivi7281aa92016-02-17 15:33:40 -0800416 const audio_config_base_t *clientConfig,
Jean-Michel Trivi8c7cf3b2016-02-25 17:08:24 -0800417 const audio_config_base_t *deviceConfig,
418 audio_patch_handle_t patchHandle);
Eric Laurent951f4552014-05-20 10:48:17 -0700419 void insertCommand_l(AudioCommand *command, int delayMs = 0);
Mathias Agopian65ab4712010-07-14 17:59:35 -0700420 private:
Jesper Tragardh48412dc2014-03-24 14:12:43 +0100421 class AudioCommandData;
422
Mathias Agopian65ab4712010-07-14 17:59:35 -0700423 // descriptor for requested tone playback event
Eric Laurent0ede8922014-05-09 18:04:42 -0700424 class AudioCommand: public RefBase {
Mathias Agopian65ab4712010-07-14 17:59:35 -0700425
426 public:
427 AudioCommand()
Eric Laurent0ede8922014-05-09 18:04:42 -0700428 : mCommand(-1), mStatus(NO_ERROR), mWaitStatus(false) {}
Mathias Agopian65ab4712010-07-14 17:59:35 -0700429
430 void dump(char* buffer, size_t size);
431
Eric Laurentdcd4ab12018-06-29 17:45:13 -0700432 int mCommand; // SET_VOLUME, SET_PARAMETERS...
Mathias Agopian65ab4712010-07-14 17:59:35 -0700433 nsecs_t mTime; // time stamp
Eric Laurent0ede8922014-05-09 18:04:42 -0700434 Mutex mLock; // mutex associated to mCond
Mathias Agopian65ab4712010-07-14 17:59:35 -0700435 Condition mCond; // condition for status return
436 status_t mStatus; // command status
437 bool mWaitStatus; // true if caller is waiting for status
Eric Laurent0ede8922014-05-09 18:04:42 -0700438 sp<AudioCommandData> mParam; // command specific parameter data
Mathias Agopian65ab4712010-07-14 17:59:35 -0700439 };
440
Eric Laurent0ede8922014-05-09 18:04:42 -0700441 class AudioCommandData: public RefBase {
Jesper Tragardh48412dc2014-03-24 14:12:43 +0100442 public:
443 virtual ~AudioCommandData() {}
444 protected:
445 AudioCommandData() {}
446 };
447
Jesper Tragardh48412dc2014-03-24 14:12:43 +0100448 class VolumeData : public AudioCommandData {
Mathias Agopian65ab4712010-07-14 17:59:35 -0700449 public:
Glenn Kastenfff6d712012-01-12 16:38:12 -0800450 audio_stream_type_t mStream;
Mathias Agopian65ab4712010-07-14 17:59:35 -0700451 float mVolume;
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800452 audio_io_handle_t mIO;
Mathias Agopian65ab4712010-07-14 17:59:35 -0700453 };
454
Jesper Tragardh48412dc2014-03-24 14:12:43 +0100455 class ParametersData : public AudioCommandData {
Mathias Agopian65ab4712010-07-14 17:59:35 -0700456 public:
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800457 audio_io_handle_t mIO;
Mathias Agopian65ab4712010-07-14 17:59:35 -0700458 String8 mKeyValuePairs;
459 };
460
Jesper Tragardh48412dc2014-03-24 14:12:43 +0100461 class VoiceVolumeData : public AudioCommandData {
Mathias Agopian65ab4712010-07-14 17:59:35 -0700462 public:
463 float mVolume;
464 };
465
Jesper Tragardh48412dc2014-03-24 14:12:43 +0100466 class StopOutputData : public AudioCommandData {
Eric Laurentbfb1b832013-01-07 09:53:42 -0800467 public:
Eric Laurentd7fe0862018-07-14 16:48:01 -0700468 audio_port_handle_t mPortId;
Eric Laurentbfb1b832013-01-07 09:53:42 -0800469 };
470
Jesper Tragardh48412dc2014-03-24 14:12:43 +0100471 class ReleaseOutputData : public AudioCommandData {
Eric Laurentbfb1b832013-01-07 09:53:42 -0800472 public:
Eric Laurentd7fe0862018-07-14 16:48:01 -0700473 audio_port_handle_t mPortId;
Eric Laurentbfb1b832013-01-07 09:53:42 -0800474 };
475
Eric Laurent951f4552014-05-20 10:48:17 -0700476 class CreateAudioPatchData : public AudioCommandData {
477 public:
478 struct audio_patch mPatch;
479 audio_patch_handle_t mHandle;
480 };
481
482 class ReleaseAudioPatchData : public AudioCommandData {
483 public:
484 audio_patch_handle_t mHandle;
485 };
486
Eric Laurente1715a42014-05-20 11:30:42 -0700487 class SetAudioPortConfigData : public AudioCommandData {
488 public:
489 struct audio_port_config mConfig;
490 };
491
Jean-Michel Trivide801052015-04-14 19:10:14 -0700492 class DynPolicyMixStateUpdateData : public AudioCommandData {
493 public:
494 String8 mRegId;
495 int32_t mState;
496 };
497
Jean-Michel Trivi2f4fe9f2015-12-04 16:20:59 -0800498 class RecordingConfigurationUpdateData : public AudioCommandData {
499 public:
500 int mEvent;
Jean-Michel Triviac4e4292016-12-22 11:39:31 -0800501 record_client_info_t mClientInfo;
Jean-Michel Trivi7281aa92016-02-17 15:33:40 -0800502 struct audio_config_base mClientConfig;
503 struct audio_config_base mDeviceConfig;
Jean-Michel Trivi8c7cf3b2016-02-25 17:08:24 -0800504 audio_patch_handle_t mPatchHandle;
Jean-Michel Trivi2f4fe9f2015-12-04 16:20:59 -0800505 };
506
Mathias Agopian65ab4712010-07-14 17:59:35 -0700507 Mutex mLock;
508 Condition mWaitWorkCV;
Eric Laurent0ede8922014-05-09 18:04:42 -0700509 Vector < sp<AudioCommand> > mAudioCommands; // list of pending commands
Eric Laurent0ede8922014-05-09 18:04:42 -0700510 sp<AudioCommand> mLastCommand; // last processed command (used by dump)
Mathias Agopian65ab4712010-07-14 17:59:35 -0700511 String8 mName; // string used by wake lock fo delayed commands
Eric Laurentbfb1b832013-01-07 09:53:42 -0800512 wp<AudioPolicyService> mService;
Mathias Agopian65ab4712010-07-14 17:59:35 -0700513 };
514
Eric Laurentdce54a12014-03-10 12:19:46 -0700515 class AudioPolicyClient : public AudioPolicyClientInterface
516 {
517 public:
Chih-Hung Hsiehe964d4e2016-08-09 14:31:32 -0700518 explicit AudioPolicyClient(AudioPolicyService *service) : mAudioPolicyService(service) {}
Eric Laurentdce54a12014-03-10 12:19:46 -0700519 virtual ~AudioPolicyClient() {}
520
521 //
522 // Audio HW module functions
523 //
524
525 // loads a HW module.
526 virtual audio_module_handle_t loadHwModule(const char *name);
527
528 //
529 // Audio output Control functions
530 //
531
532 // opens an audio output with the requested parameters. The parameter values can indicate to use the default values
533 // in case the audio policy manager has no specific requirements for the output being opened.
534 // When the function returns, the parameter values reflect the actual values used by the audio hardware output stream.
535 // The audio policy manager can check if the proposed parameters are suitable or not and act accordingly.
Eric Laurentcf2c0212014-07-25 16:20:43 -0700536 virtual status_t openOutput(audio_module_handle_t module,
537 audio_io_handle_t *output,
538 audio_config_t *config,
539 audio_devices_t *devices,
540 const String8& address,
541 uint32_t *latencyMs,
542 audio_output_flags_t flags);
Eric Laurentdce54a12014-03-10 12:19:46 -0700543 // creates a special output that is duplicated to the two outputs passed as arguments. The duplication is performed by
544 // a special mixer thread in the AudioFlinger.
545 virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1, audio_io_handle_t output2);
546 // closes the output stream
547 virtual status_t closeOutput(audio_io_handle_t output);
548 // suspends the output. When an output is suspended, the corresponding audio hardware output stream is placed in
549 // standby and the AudioTracks attached to the mixer thread are still processed but the output mix is discarded.
550 virtual status_t suspendOutput(audio_io_handle_t output);
551 // restores a suspended output.
552 virtual status_t restoreOutput(audio_io_handle_t output);
553
554 //
555 // Audio input Control functions
556 //
557
558 // opens an audio input
559 virtual audio_io_handle_t openInput(audio_module_handle_t module,
Eric Laurentcf2c0212014-07-25 16:20:43 -0700560 audio_io_handle_t *input,
561 audio_config_t *config,
562 audio_devices_t *devices,
563 const String8& address,
564 audio_source_t source,
Glenn Kastenec40d282014-07-15 15:31:26 -0700565 audio_input_flags_t flags);
Eric Laurentdce54a12014-03-10 12:19:46 -0700566 // closes an audio input
567 virtual status_t closeInput(audio_io_handle_t input);
568 //
569 // misc control functions
570 //
571
572 // set a stream volume for a particular output. For the same user setting, a given stream type can have different volumes
573 // for each output (destination device) it is attached to.
574 virtual status_t setStreamVolume(audio_stream_type_t stream, float volume, audio_io_handle_t output, int delayMs = 0);
575
576 // invalidate a stream type, causing a reroute to an unspecified new output
577 virtual status_t invalidateStream(audio_stream_type_t stream);
578
579 // function enabling to send proprietary informations directly from audio policy manager to audio hardware interface.
580 virtual void setParameters(audio_io_handle_t ioHandle, const String8& keyValuePairs, int delayMs = 0);
581 // function enabling to receive proprietary informations directly from audio hardware interface to audio policy manager.
582 virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys);
583
Eric Laurentdce54a12014-03-10 12:19:46 -0700584 // set down link audio volume.
585 virtual status_t setVoiceVolume(float volume, int delayMs = 0);
586
587 // move effect to the specified output
Glenn Kastend848eb42016-03-08 13:42:11 -0800588 virtual status_t moveEffects(audio_session_t session,
Eric Laurentdce54a12014-03-10 12:19:46 -0700589 audio_io_handle_t srcOutput,
590 audio_io_handle_t dstOutput);
591
Eric Laurent951f4552014-05-20 10:48:17 -0700592 /* Create a patch between several source and sink ports */
593 virtual status_t createAudioPatch(const struct audio_patch *patch,
594 audio_patch_handle_t *handle,
595 int delayMs);
596
597 /* Release a patch */
598 virtual status_t releaseAudioPatch(audio_patch_handle_t handle,
599 int delayMs);
600
Eric Laurente1715a42014-05-20 11:30:42 -0700601 /* Set audio port configuration */
602 virtual status_t setAudioPortConfig(const struct audio_port_config *config, int delayMs);
603
Eric Laurentb52c1522014-05-20 11:27:36 -0700604 virtual void onAudioPortListUpdate();
605 virtual void onAudioPatchListUpdate();
Jean-Michel Trivide801052015-04-14 19:10:14 -0700606 virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state);
Jean-Michel Trivi2f4fe9f2015-12-04 16:20:59 -0800607 virtual void onRecordingConfigurationUpdate(int event,
Jean-Michel Triviac4e4292016-12-22 11:39:31 -0800608 const record_client_info_t *clientInfo,
Jean-Michel Trivi7281aa92016-02-17 15:33:40 -0800609 const audio_config_base_t *clientConfig,
Jean-Michel Trivi8c7cf3b2016-02-25 17:08:24 -0800610 const audio_config_base_t *deviceConfig, audio_patch_handle_t patchHandle);
Eric Laurentb52c1522014-05-20 11:27:36 -0700611
Glenn Kasteneeecb982016-02-26 10:44:04 -0800612 virtual audio_unique_id_t newAudioUniqueId(audio_unique_id_use_t use);
Eric Laurentde3f8392014-07-27 18:38:22 -0700613
Eric Laurentdce54a12014-03-10 12:19:46 -0700614 private:
615 AudioPolicyService *mAudioPolicyService;
616 };
617
Eric Laurentb52c1522014-05-20 11:27:36 -0700618 // --- Notification Client ---
619 class NotificationClient : public IBinder::DeathRecipient {
620 public:
621 NotificationClient(const sp<AudioPolicyService>& service,
622 const sp<IAudioPolicyServiceClient>& client,
luochaojiang908c7d72018-06-21 14:58:04 +0800623 uid_t uid, pid_t pid);
Eric Laurentb52c1522014-05-20 11:27:36 -0700624 virtual ~NotificationClient();
625
Jean-Michel Trivide801052015-04-14 19:10:14 -0700626 void onAudioPortListUpdate();
627 void onAudioPatchListUpdate();
Chih-Hung Hsiehe964d4e2016-08-09 14:31:32 -0700628 void onDynamicPolicyMixStateUpdate(const String8& regId, int32_t state);
Jean-Michel Trivi2f4fe9f2015-12-04 16:20:59 -0800629 void onRecordingConfigurationUpdate(
Jean-Michel Triviac4e4292016-12-22 11:39:31 -0800630 int event, const record_client_info_t *clientInfo,
Jean-Michel Trivi7281aa92016-02-17 15:33:40 -0800631 const audio_config_base_t *clientConfig,
Jean-Michel Trivi8c7cf3b2016-02-25 17:08:24 -0800632 const audio_config_base_t *deviceConfig,
633 audio_patch_handle_t patchHandle);
Eric Laurente8726fe2015-06-26 09:39:24 -0700634 void setAudioPortCallbacksEnabled(bool enabled);
Eric Laurentb52c1522014-05-20 11:27:36 -0700635
luochaojiang908c7d72018-06-21 14:58:04 +0800636 uid_t uid() {
637 return mUid;
638 }
639
Eric Laurentb52c1522014-05-20 11:27:36 -0700640 // IBinder::DeathRecipient
641 virtual void binderDied(const wp<IBinder>& who);
642
643 private:
644 NotificationClient(const NotificationClient&);
645 NotificationClient& operator = (const NotificationClient&);
646
647 const wp<AudioPolicyService> mService;
648 const uid_t mUid;
luochaojiang908c7d72018-06-21 14:58:04 +0800649 const pid_t mPid;
Eric Laurentb52c1522014-05-20 11:27:36 -0700650 const sp<IAudioPolicyServiceClient> mAudioPolicyServiceClient;
Eric Laurente8726fe2015-06-26 09:39:24 -0700651 bool mAudioPortCallbacksEnabled;
Eric Laurentb52c1522014-05-20 11:27:36 -0700652 };
653
Eric Laurentd7fe0862018-07-14 16:48:01 -0700654 class AudioClient : public virtual RefBase {
655 public:
656 AudioClient(const audio_attributes_t attributes,
657 const audio_io_handle_t io, uid_t uid, pid_t pid,
658 const audio_session_t session, const audio_port_handle_t deviceId) :
659 attributes(attributes), io(io), uid(uid), pid(pid),
660 session(session), deviceId(deviceId), active(false) {}
661 ~AudioClient() override = default;
662
663
664 const audio_attributes_t attributes; // source, flags ...
665 const audio_io_handle_t io; // audio HAL stream IO handle
666 const uid_t uid; // client UID
667 const pid_t pid; // client PID
668 const audio_session_t session; // audio session ID
669 const audio_port_handle_t deviceId; // selected input device port ID
670 bool active; // Playback/Capture is active or inactive
671 };
672
Eric Laurentfee19762018-01-29 18:44:13 -0800673 // --- AudioRecordClient ---
674 // Information about each registered AudioRecord client
675 // (between calls to getInputForAttr() and releaseInput())
Eric Laurentd7fe0862018-07-14 16:48:01 -0700676 class AudioRecordClient : public AudioClient {
Eric Laurentfee19762018-01-29 18:44:13 -0800677 public:
678 AudioRecordClient(const audio_attributes_t attributes,
Eric Laurentd7fe0862018-07-14 16:48:01 -0700679 const audio_io_handle_t io, uid_t uid, pid_t pid,
680 const audio_session_t session, const audio_port_handle_t deviceId,
681 const String16& opPackageName) :
682 AudioClient(attributes, io, uid, pid, session, deviceId),
Eric Laurent4eb58f12018-12-07 16:41:02 -0800683 opPackageName(opPackageName), startTimeNs(0) {}
Eric Laurentd7fe0862018-07-14 16:48:01 -0700684 ~AudioRecordClient() override = default;
Eric Laurentfee19762018-01-29 18:44:13 -0800685
Eric Laurentfee19762018-01-29 18:44:13 -0800686 const String16 opPackageName; // client package name
Eric Laurent4eb58f12018-12-07 16:41:02 -0800687 nsecs_t startTimeNs;
Eric Laurentd7fe0862018-07-14 16:48:01 -0700688 };
689
690 // --- AudioPlaybackClient ---
691 // Information about each registered AudioTrack client
692 // (between calls to getOutputForAttr() and releaseOutput())
693 class AudioPlaybackClient : public AudioClient {
694 public:
695 AudioPlaybackClient(const audio_attributes_t attributes,
696 const audio_io_handle_t io, uid_t uid, pid_t pid,
697 const audio_session_t session, audio_port_handle_t deviceId,
698 audio_stream_type_t stream) :
699 AudioClient(attributes, io, uid, pid, session, deviceId), stream(stream) {}
700 ~AudioPlaybackClient() override = default;
701
702 const audio_stream_type_t stream;
Eric Laurentfee19762018-01-29 18:44:13 -0800703 };
704
Eric Laurent10b71232018-04-13 18:14:44 -0700705 // A class automatically clearing and restoring binder caller identity inside
706 // a code block (scoped variable)
707 // Declare one systematically before calling AudioPolicyManager methods so that they are
708 // executed with the same level of privilege as audioserver process.
709 class AutoCallerClear {
710 public:
711 AutoCallerClear() :
712 mToken(IPCThreadState::self()->clearCallingIdentity()) {}
713 ~AutoCallerClear() {
714 IPCThreadState::self()->restoreCallingIdentity(mToken);
715 }
716
717 private:
718 const int64_t mToken;
719 };
720
Mathias Agopian65ab4712010-07-14 17:59:35 -0700721 // Internal dump utilities.
722 status_t dumpPermissionDenial(int fd);
723
724
Eric Laurenteda6c362011-02-02 09:33:30 -0800725 mutable Mutex mLock; // prevents concurrent access to AudioPolicy manager functions changing
726 // device connection state or routing
Haynes Mathew Georgebab7bf42015-10-30 18:02:23 -0700727 mutable Mutex mEffectsLock; // serialize access to Effect state within APM.
728 // Note: lock acquisition order is always mLock > mEffectsLock:
729 // mLock protects AudioPolicyManager methods that can call into audio flinger
730 // and possibly back in to audio policy service and acquire mEffectsLock.
Glenn Kastene53b9ea2012-03-12 16:29:55 -0700731 sp<AudioCommandThread> mAudioCommandThread; // audio commands thread
Eric Laurentbfb1b832013-01-07 09:53:42 -0800732 sp<AudioCommandThread> mOutputCommandThread; // process stop and release output
Dima Zavinfce7a472011-04-19 22:30:36 -0700733 struct audio_policy_device *mpAudioPolicyDev;
734 struct audio_policy *mpAudioPolicy;
Eric Laurentf269b8e2014-06-09 20:01:29 -0700735 AudioPolicyInterface *mAudioPolicyManager;
Eric Laurentdce54a12014-03-10 12:19:46 -0700736 AudioPolicyClient *mAudioPolicyClient;
737
luochaojiang908c7d72018-06-21 14:58:04 +0800738 DefaultKeyedVector< int64_t, sp<NotificationClient> > mNotificationClients;
Eric Laurent0ebd5f92014-11-19 19:04:52 -0800739 Mutex mNotificationClientsLock; // protects mNotificationClients
bryant_liuba2b4392014-06-11 16:49:30 +0800740 // Manage all effects configured in audio_effects.conf
741 sp<AudioPolicyEffects> mAudioPolicyEffects;
Eric Laurentbb6c9a02014-09-25 14:11:47 -0700742 audio_mode_t mPhoneState;
Svet Ganovf4ddfef2018-01-16 07:37:58 -0800743
744 sp<UidPolicy> mUidPolicy;
Michael Groovercfd28302018-12-11 19:16:46 -0800745 sp<SensorPrivacyPolicy> mSensorPrivacyPolicy;
746
Eric Laurentfee19762018-01-29 18:44:13 -0800747 DefaultKeyedVector< audio_port_handle_t, sp<AudioRecordClient> > mAudioRecordClients;
Eric Laurentd7fe0862018-07-14 16:48:01 -0700748 DefaultKeyedVector< audio_port_handle_t, sp<AudioPlaybackClient> > mAudioPlaybackClients;
Mathias Agopian65ab4712010-07-14 17:59:35 -0700749};
750
Mikhail Naganov1b2a7942017-12-08 10:18:09 -0800751} // namespace android
Mathias Agopian65ab4712010-07-14 17:59:35 -0700752
753#endif // ANDROID_AUDIOPOLICYSERVICE_H