blob: 347641904ef8dc23997956482fe8e24242f6ecdf [file] [log] [blame]
François Gaffie2110e042015-03-24 08:41:51 +01001/*
2 * Copyright (C) 2015 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#define LOG_TAG "APM::AudioPolicyEngine"
18//#define LOG_NDEBUG 0
19
20//#define VERY_VERBOSE_LOGGING
21#ifdef VERY_VERBOSE_LOGGING
22#define ALOGVV ALOGV
23#else
24#define ALOGVV(a...) do { } while(0)
25#endif
26
27#include "Engine.h"
Chih-Hung Hsieh2b487032018-09-13 14:16:02 -070028#include <android-base/macros.h>
François Gaffie2110e042015-03-24 08:41:51 +010029#include <AudioPolicyManagerObserver.h>
30#include <AudioPort.h>
31#include <IOProfile.h>
32#include <policy.h>
33#include <utils/String8.h>
34#include <utils/Log.h>
35
36namespace android
37{
38namespace audio_policy
39{
40
41Engine::Engine()
42 : mManagerInterface(this),
43 mPhoneState(AUDIO_MODE_NORMAL),
44 mApmObserver(NULL)
45{
46 for (int i = 0; i < AUDIO_POLICY_FORCE_USE_CNT; i++) {
47 mForceUse[i] = AUDIO_POLICY_FORCE_NONE;
48 }
49}
50
51Engine::~Engine()
52{
53}
54
55void Engine::setObserver(AudioPolicyManagerObserver *observer)
56{
57 ALOG_ASSERT(observer != NULL, "Invalid Audio Policy Manager observer");
58 mApmObserver = observer;
59}
60
61status_t Engine::initCheck()
62{
63 return (mApmObserver != NULL) ? NO_ERROR : NO_INIT;
64}
65
François Gaffie2110e042015-03-24 08:41:51 +010066status_t Engine::setPhoneState(audio_mode_t state)
67{
68 ALOGV("setPhoneState() state %d", state);
69
70 if (state < 0 || state >= AUDIO_MODE_CNT) {
71 ALOGW("setPhoneState() invalid state %d", state);
72 return BAD_VALUE;
73 }
74
75 if (state == mPhoneState ) {
76 ALOGW("setPhoneState() setting same state %d", state);
77 return BAD_VALUE;
78 }
79
80 // store previous phone state for management of sonification strategy below
81 int oldState = mPhoneState;
82 mPhoneState = state;
François Gaffied1ab2bd2015-12-02 18:20:06 +010083
François Gaffie2110e042015-03-24 08:41:51 +010084 if (!is_state_in_call(oldState) && is_state_in_call(state)) {
85 ALOGV(" Entering call in setPhoneState()");
François Gaffied1ab2bd2015-12-02 18:20:06 +010086 mApmObserver->getVolumeCurves().switchVolumeCurve(AUDIO_STREAM_VOICE_CALL,
87 AUDIO_STREAM_DTMF);
François Gaffie2110e042015-03-24 08:41:51 +010088 } else if (is_state_in_call(oldState) && !is_state_in_call(state)) {
89 ALOGV(" Exiting call in setPhoneState()");
François Gaffied1ab2bd2015-12-02 18:20:06 +010090 mApmObserver->getVolumeCurves().restoreOriginVolumeCurve(AUDIO_STREAM_DTMF);
François Gaffie2110e042015-03-24 08:41:51 +010091 }
92 return NO_ERROR;
93}
94
95status_t Engine::setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config)
96{
97 switch(usage) {
98 case AUDIO_POLICY_FORCE_FOR_COMMUNICATION:
99 if (config != AUDIO_POLICY_FORCE_SPEAKER && config != AUDIO_POLICY_FORCE_BT_SCO &&
100 config != AUDIO_POLICY_FORCE_NONE) {
101 ALOGW("setForceUse() invalid config %d for FOR_COMMUNICATION", config);
102 return BAD_VALUE;
103 }
104 mForceUse[usage] = config;
105 break;
106 case AUDIO_POLICY_FORCE_FOR_MEDIA:
107 if (config != AUDIO_POLICY_FORCE_HEADPHONES && config != AUDIO_POLICY_FORCE_BT_A2DP &&
108 config != AUDIO_POLICY_FORCE_WIRED_ACCESSORY &&
109 config != AUDIO_POLICY_FORCE_ANALOG_DOCK &&
110 config != AUDIO_POLICY_FORCE_DIGITAL_DOCK && config != AUDIO_POLICY_FORCE_NONE &&
111 config != AUDIO_POLICY_FORCE_NO_BT_A2DP && config != AUDIO_POLICY_FORCE_SPEAKER ) {
112 ALOGW("setForceUse() invalid config %d for FOR_MEDIA", config);
113 return BAD_VALUE;
114 }
115 mForceUse[usage] = config;
116 break;
117 case AUDIO_POLICY_FORCE_FOR_RECORD:
118 if (config != AUDIO_POLICY_FORCE_BT_SCO && config != AUDIO_POLICY_FORCE_WIRED_ACCESSORY &&
119 config != AUDIO_POLICY_FORCE_NONE) {
120 ALOGW("setForceUse() invalid config %d for FOR_RECORD", config);
121 return BAD_VALUE;
122 }
123 mForceUse[usage] = config;
124 break;
125 case AUDIO_POLICY_FORCE_FOR_DOCK:
126 if (config != AUDIO_POLICY_FORCE_NONE && config != AUDIO_POLICY_FORCE_BT_CAR_DOCK &&
127 config != AUDIO_POLICY_FORCE_BT_DESK_DOCK &&
128 config != AUDIO_POLICY_FORCE_WIRED_ACCESSORY &&
129 config != AUDIO_POLICY_FORCE_ANALOG_DOCK &&
130 config != AUDIO_POLICY_FORCE_DIGITAL_DOCK) {
131 ALOGW("setForceUse() invalid config %d for FOR_DOCK", config);
132 }
133 mForceUse[usage] = config;
134 break;
135 case AUDIO_POLICY_FORCE_FOR_SYSTEM:
136 if (config != AUDIO_POLICY_FORCE_NONE &&
137 config != AUDIO_POLICY_FORCE_SYSTEM_ENFORCED) {
138 ALOGW("setForceUse() invalid config %d for FOR_SYSTEM", config);
139 }
140 mForceUse[usage] = config;
141 break;
142 case AUDIO_POLICY_FORCE_FOR_HDMI_SYSTEM_AUDIO:
143 if (config != AUDIO_POLICY_FORCE_NONE &&
144 config != AUDIO_POLICY_FORCE_HDMI_SYSTEM_AUDIO_ENFORCED) {
Phil Burk09bc4612016-02-24 15:58:15 -0800145 ALOGW("setForceUse() invalid config %d for HDMI_SYSTEM_AUDIO", config);
146 }
147 mForceUse[usage] = config;
148 break;
149 case AUDIO_POLICY_FORCE_FOR_ENCODED_SURROUND:
150 if (config != AUDIO_POLICY_FORCE_NONE &&
151 config != AUDIO_POLICY_FORCE_ENCODED_SURROUND_NEVER &&
jiabin81772902018-04-02 17:52:27 -0700152 config != AUDIO_POLICY_FORCE_ENCODED_SURROUND_ALWAYS &&
153 config != AUDIO_POLICY_FORCE_ENCODED_SURROUND_MANUAL) {
Phil Burk09bc4612016-02-24 15:58:15 -0800154 ALOGW("setForceUse() invalid config %d for ENCODED_SURROUND", config);
155 return BAD_VALUE;
François Gaffie2110e042015-03-24 08:41:51 +0100156 }
157 mForceUse[usage] = config;
158 break;
Jack He96117ae2018-02-12 20:52:53 -0800159 case AUDIO_POLICY_FORCE_FOR_VIBRATE_RINGING:
160 if (config != AUDIO_POLICY_FORCE_BT_SCO && config != AUDIO_POLICY_FORCE_NONE) {
161 ALOGW("setForceUse() invalid config %d for FOR_VIBRATE_RINGING", config);
162 return BAD_VALUE;
163 }
164 mForceUse[usage] = config;
165 break;
François Gaffie2110e042015-03-24 08:41:51 +0100166 default:
167 ALOGW("setForceUse() invalid usage %d", usage);
Phil Burk09bc4612016-02-24 15:58:15 -0800168 break; // TODO return BAD_VALUE?
François Gaffie2110e042015-03-24 08:41:51 +0100169 }
170 return NO_ERROR;
171}
172
173routing_strategy Engine::getStrategyForStream(audio_stream_type_t stream)
174{
175 // stream to strategy mapping
176 switch (stream) {
177 case AUDIO_STREAM_VOICE_CALL:
178 case AUDIO_STREAM_BLUETOOTH_SCO:
179 return STRATEGY_PHONE;
180 case AUDIO_STREAM_RING:
181 case AUDIO_STREAM_ALARM:
182 return STRATEGY_SONIFICATION;
183 case AUDIO_STREAM_NOTIFICATION:
184 return STRATEGY_SONIFICATION_RESPECTFUL;
185 case AUDIO_STREAM_DTMF:
186 return STRATEGY_DTMF;
187 default:
188 ALOGE("unknown stream type %d", stream);
189 case AUDIO_STREAM_SYSTEM:
190 // NOTE: SYSTEM stream uses MEDIA strategy because muting music and switching outputs
191 // while key clicks are played produces a poor result
192 case AUDIO_STREAM_MUSIC:
193 return STRATEGY_MEDIA;
194 case AUDIO_STREAM_ENFORCED_AUDIBLE:
195 return STRATEGY_ENFORCED_AUDIBLE;
196 case AUDIO_STREAM_TTS:
197 return STRATEGY_TRANSMITTED_THROUGH_SPEAKER;
198 case AUDIO_STREAM_ACCESSIBILITY:
199 return STRATEGY_ACCESSIBILITY;
200 case AUDIO_STREAM_REROUTING:
201 return STRATEGY_REROUTING;
202 }
203}
204
205routing_strategy Engine::getStrategyForUsage(audio_usage_t usage)
206{
François Gaffie2110e042015-03-24 08:41:51 +0100207 // usage to strategy mapping
208 switch (usage) {
209 case AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY:
François Gaffie2110e042015-03-24 08:41:51 +0100210 return STRATEGY_ACCESSIBILITY;
211
212 case AUDIO_USAGE_MEDIA:
213 case AUDIO_USAGE_GAME:
Jean-Michel Trivi36867762016-12-29 12:03:28 -0800214 case AUDIO_USAGE_ASSISTANT:
François Gaffie2110e042015-03-24 08:41:51 +0100215 case AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE:
216 case AUDIO_USAGE_ASSISTANCE_SONIFICATION:
217 return STRATEGY_MEDIA;
218
219 case AUDIO_USAGE_VOICE_COMMUNICATION:
220 return STRATEGY_PHONE;
221
222 case AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING:
223 return STRATEGY_DTMF;
224
225 case AUDIO_USAGE_ALARM:
226 case AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE:
227 return STRATEGY_SONIFICATION;
228
229 case AUDIO_USAGE_NOTIFICATION:
230 case AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST:
231 case AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT:
232 case AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED:
233 case AUDIO_USAGE_NOTIFICATION_EVENT:
234 return STRATEGY_SONIFICATION_RESPECTFUL;
235
236 case AUDIO_USAGE_UNKNOWN:
237 default:
238 return STRATEGY_MEDIA;
239 }
240}
241
242audio_devices_t Engine::getDeviceForStrategy(routing_strategy strategy) const
243{
Eric Laurent0f928fa2016-03-21 12:06:20 -0700244 DeviceVector availableOutputDevices = mApmObserver->getAvailableOutputDevices();
245 DeviceVector availableInputDevices = mApmObserver->getAvailableInputDevices();
François Gaffie2110e042015-03-24 08:41:51 +0100246
Eric Laurentc75307b2015-03-17 15:29:32 -0700247 const SwAudioOutputCollection &outputs = mApmObserver->getOutputs();
François Gaffie2110e042015-03-24 08:41:51 +0100248
Eric Laurent0f928fa2016-03-21 12:06:20 -0700249 return getDeviceForStrategyInt(strategy, availableOutputDevices,
Jean-Michel Trivi61309522018-01-23 09:58:17 -0800250 availableInputDevices, outputs, (uint32_t)AUDIO_DEVICE_NONE);
Eric Laurent28d09f02016-03-08 10:43:05 -0800251}
252
253
Eric Laurent28d09f02016-03-08 10:43:05 -0800254audio_devices_t Engine::getDeviceForStrategyInt(routing_strategy strategy,
Jean-Michel Trivi61309522018-01-23 09:58:17 -0800255 DeviceVector availableOutputDevices,
256 DeviceVector availableInputDevices,
257 const SwAudioOutputCollection &outputs,
258 uint32_t outputDeviceTypesToIgnore) const
Eric Laurent28d09f02016-03-08 10:43:05 -0800259{
François Gaffie2110e042015-03-24 08:41:51 +0100260 uint32_t device = AUDIO_DEVICE_NONE;
Jean-Michel Trivi61309522018-01-23 09:58:17 -0800261 uint32_t availableOutputDevicesType =
262 availableOutputDevices.types() & ~outputDeviceTypesToIgnore;
François Gaffie2110e042015-03-24 08:41:51 +0100263
264 switch (strategy) {
265
266 case STRATEGY_TRANSMITTED_THROUGH_SPEAKER:
267 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_SPEAKER;
François Gaffie2110e042015-03-24 08:41:51 +0100268 break;
269
270 case STRATEGY_SONIFICATION_RESPECTFUL:
Eric Laurent7731b5a2018-04-06 15:47:22 -0700271 if (isInCall() || outputs.isStreamActiveLocally(AUDIO_STREAM_VOICE_CALL)) {
Eric Laurent28d09f02016-03-08 10:43:05 -0800272 device = getDeviceForStrategyInt(
Jean-Michel Trivi61309522018-01-23 09:58:17 -0800273 STRATEGY_SONIFICATION, availableOutputDevices, availableInputDevices, outputs,
274 outputDeviceTypesToIgnore);
François Gaffie2110e042015-03-24 08:41:51 +0100275 } else {
Jean-Michel Trivi61309522018-01-23 09:58:17 -0800276 bool media_active_locally =
277 outputs.isStreamActiveLocally(
278 AUDIO_STREAM_MUSIC, SONIFICATION_RESPECTFUL_AFTER_MUSIC_DELAY)
279 || outputs.isStreamActiveLocally(
280 AUDIO_STREAM_ACCESSIBILITY, SONIFICATION_RESPECTFUL_AFTER_MUSIC_DELAY);
281 // routing is same as media without the "remote" device
282 device = getDeviceForStrategyInt(STRATEGY_MEDIA,
283 availableOutputDevices,
284 availableInputDevices, outputs,
285 AUDIO_DEVICE_OUT_REMOTE_SUBMIX | outputDeviceTypesToIgnore);
286 // if no media is playing on the device, check for mandatory use of "safe" speaker
287 // when media would have played on speaker, and the safe speaker path is available
288 if (!media_active_locally
289 && (device & AUDIO_DEVICE_OUT_SPEAKER)
290 && (availableOutputDevicesType & AUDIO_DEVICE_OUT_SPEAKER_SAFE)) {
Eric Laurent9a7d9222015-07-02 15:30:23 -0700291 device |= AUDIO_DEVICE_OUT_SPEAKER_SAFE;
292 device &= ~AUDIO_DEVICE_OUT_SPEAKER;
293 }
François Gaffie2110e042015-03-24 08:41:51 +0100294 }
295 break;
296
297 case STRATEGY_DTMF:
298 if (!isInCall()) {
299 // when off call, DTMF strategy follows the same rules as MEDIA strategy
Eric Laurent28d09f02016-03-08 10:43:05 -0800300 device = getDeviceForStrategyInt(
Jean-Michel Trivi61309522018-01-23 09:58:17 -0800301 STRATEGY_MEDIA, availableOutputDevices, availableInputDevices, outputs,
302 outputDeviceTypesToIgnore);
François Gaffie2110e042015-03-24 08:41:51 +0100303 break;
304 }
305 // when in call, DTMF and PHONE strategies follow the same rules
Chih-Hung Hsieh2b487032018-09-13 14:16:02 -0700306 FALLTHROUGH_INTENDED;
François Gaffie2110e042015-03-24 08:41:51 +0100307
308 case STRATEGY_PHONE:
309 // Force use of only devices on primary output if:
310 // - in call AND
311 // - cannot route from voice call RX OR
312 // - audio HAL version is < 3.0 and TX device is on the primary HW module
313 if (getPhoneState() == AUDIO_MODE_IN_CALL) {
314 audio_devices_t txDevice = getDeviceForInputSource(AUDIO_SOURCE_VOICE_COMMUNICATION);
315 sp<AudioOutputDescriptor> primaryOutput = outputs.getPrimaryOutput();
316 audio_devices_t availPrimaryInputDevices =
317 availableInputDevices.getDevicesFromHwModule(primaryOutput->getModuleHandle());
Eric Laurent58a73fc2018-02-21 18:46:13 -0800318
319 // TODO: getPrimaryOutput return only devices from first module in
320 // audio_policy_configuration.xml, hearing aid is not there, but it's
321 // a primary device
322 // FIXME: this is not the right way of solving this problem
François Gaffie2110e042015-03-24 08:41:51 +0100323 audio_devices_t availPrimaryOutputDevices =
Eric Laurent58a73fc2018-02-21 18:46:13 -0800324 (primaryOutput->supportedDevices() | AUDIO_DEVICE_OUT_HEARING_AID) &
325 availableOutputDevices.types();
François Gaffie2110e042015-03-24 08:41:51 +0100326
327 if (((availableInputDevices.types() &
328 AUDIO_DEVICE_IN_TELEPHONY_RX & ~AUDIO_DEVICE_BIT_IN) == 0) ||
329 (((txDevice & availPrimaryInputDevices & ~AUDIO_DEVICE_BIT_IN) != 0) &&
Mikhail Naganov9ee05402016-10-13 15:58:17 -0700330 (primaryOutput->getAudioPort()->getModuleVersionMajor() < 3))) {
François Gaffie2110e042015-03-24 08:41:51 +0100331 availableOutputDevicesType = availPrimaryOutputDevices;
332 }
333 }
Eric Laurent28d09f02016-03-08 10:43:05 -0800334 // for phone strategy, we first consider the forced use and then the available devices by
335 // order of priority
François Gaffie2110e042015-03-24 08:41:51 +0100336 switch (mForceUse[AUDIO_POLICY_FORCE_FOR_COMMUNICATION]) {
337 case AUDIO_POLICY_FORCE_BT_SCO:
338 if (!isInCall() || strategy != STRATEGY_DTMF) {
339 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT;
340 if (device) break;
341 }
342 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET;
343 if (device) break;
344 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_SCO;
345 if (device) break;
346 // if SCO device is requested but no SCO device is available, fall back to default case
Chih-Hung Hsieh2b487032018-09-13 14:16:02 -0700347 FALLTHROUGH_INTENDED;
François Gaffie2110e042015-03-24 08:41:51 +0100348
349 default: // FORCE_NONE
Eric Laurent58a73fc2018-02-21 18:46:13 -0800350 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_HEARING_AID;
351 if (device) break;
François Gaffie2110e042015-03-24 08:41:51 +0100352 // when not in a phone call, phone strategy should route STREAM_VOICE_CALL to A2DP
353 if (!isInCall() &&
354 (mForceUse[AUDIO_POLICY_FORCE_FOR_MEDIA] != AUDIO_POLICY_FORCE_NO_BT_A2DP) &&
Aniket Kumar Lataa8ee9962018-01-31 20:24:23 -0800355 outputs.isA2dpSupported()) {
François Gaffie2110e042015-03-24 08:41:51 +0100356 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_A2DP;
357 if (device) break;
358 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES;
359 if (device) break;
360 }
361 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_WIRED_HEADPHONE;
362 if (device) break;
363 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_WIRED_HEADSET;
364 if (device) break;
Eric Laurenta0b18ce2016-03-08 11:05:00 -0800365 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_LINE;
366 if (device) break;
Eric Laurent904d6322017-03-17 17:20:47 -0700367 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_USB_HEADSET;
368 if (device) break;
François Gaffie2110e042015-03-24 08:41:51 +0100369 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_USB_DEVICE;
370 if (device) break;
371 if (!isInCall()) {
372 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_USB_ACCESSORY;
373 if (device) break;
374 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET;
375 if (device) break;
376 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_AUX_DIGITAL;
377 if (device) break;
378 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET;
379 if (device) break;
380 }
381 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_EARPIECE;
François Gaffie2110e042015-03-24 08:41:51 +0100382 break;
383
384 case AUDIO_POLICY_FORCE_SPEAKER:
385 // when not in a phone call, phone strategy should route STREAM_VOICE_CALL to
386 // A2DP speaker when forcing to speaker output
387 if (!isInCall() &&
388 (mForceUse[AUDIO_POLICY_FORCE_FOR_MEDIA] != AUDIO_POLICY_FORCE_NO_BT_A2DP) &&
Aniket Kumar Lataa8ee9962018-01-31 20:24:23 -0800389 outputs.isA2dpSupported()) {
François Gaffie2110e042015-03-24 08:41:51 +0100390 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER;
391 if (device) break;
392 }
393 if (!isInCall()) {
394 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_USB_ACCESSORY;
395 if (device) break;
396 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_USB_DEVICE;
397 if (device) break;
398 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET;
399 if (device) break;
400 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_AUX_DIGITAL;
401 if (device) break;
402 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET;
403 if (device) break;
404 }
François Gaffie2110e042015-03-24 08:41:51 +0100405 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_SPEAKER;
François Gaffie2110e042015-03-24 08:41:51 +0100406 break;
407 }
408 break;
409
410 case STRATEGY_SONIFICATION:
411
412 // If incall, just select the STRATEGY_PHONE device: The rest of the behavior is handled by
413 // handleIncallSonification().
Eric Laurent7731b5a2018-04-06 15:47:22 -0700414 if (isInCall() || outputs.isStreamActiveLocally(AUDIO_STREAM_VOICE_CALL)) {
Eric Laurent28d09f02016-03-08 10:43:05 -0800415 device = getDeviceForStrategyInt(
Jean-Michel Trivi61309522018-01-23 09:58:17 -0800416 STRATEGY_PHONE, availableOutputDevices, availableInputDevices, outputs,
417 outputDeviceTypesToIgnore);
François Gaffie2110e042015-03-24 08:41:51 +0100418 break;
419 }
Chih-Hung Hsieh2b487032018-09-13 14:16:02 -0700420 FALLTHROUGH_INTENDED;
François Gaffie2110e042015-03-24 08:41:51 +0100421
422 case STRATEGY_ENFORCED_AUDIBLE:
423 // strategy STRATEGY_ENFORCED_AUDIBLE uses same routing policy as STRATEGY_SONIFICATION
424 // except:
425 // - when in call where it doesn't default to STRATEGY_PHONE behavior
426 // - in countries where not enforced in which case it follows STRATEGY_MEDIA
427
428 if ((strategy == STRATEGY_SONIFICATION) ||
429 (mForceUse[AUDIO_POLICY_FORCE_FOR_SYSTEM] == AUDIO_POLICY_FORCE_SYSTEM_ENFORCED)) {
430 device = availableOutputDevicesType & AUDIO_DEVICE_OUT_SPEAKER;
François Gaffie2110e042015-03-24 08:41:51 +0100431 }
Eric Laurenta8e0f022017-01-27 17:41:53 -0800432
433 // if SCO headset is connected and we are told to use it, play ringtone over
434 // speaker and BT SCO
Jack He96117ae2018-02-12 20:52:53 -0800435 if ((availableOutputDevicesType & AUDIO_DEVICE_OUT_ALL_SCO) != 0) {
Eric Laurenta8e0f022017-01-27 17:41:53 -0800436 uint32_t device2 = AUDIO_DEVICE_NONE;
437 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT;
438 if (device2 == AUDIO_DEVICE_NONE) {
439 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET;
440 }
441 if (device2 == AUDIO_DEVICE_NONE) {
442 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_SCO;
443 }
Jack He96117ae2018-02-12 20:52:53 -0800444 // Use ONLY Bluetooth SCO output when ringing in vibration mode
445 if (!((mForceUse[AUDIO_POLICY_FORCE_FOR_SYSTEM] == AUDIO_POLICY_FORCE_SYSTEM_ENFORCED)
446 && (strategy == STRATEGY_ENFORCED_AUDIBLE))) {
447 if (mForceUse[AUDIO_POLICY_FORCE_FOR_VIBRATE_RINGING]
448 == AUDIO_POLICY_FORCE_BT_SCO) {
449 if (device2 != AUDIO_DEVICE_NONE) {
450 device = device2;
451 break;
452 }
453 }
454 }
455 // Use both Bluetooth SCO and phone default output when ringing in normal mode
456 if (mForceUse[AUDIO_POLICY_FORCE_FOR_COMMUNICATION] == AUDIO_POLICY_FORCE_BT_SCO) {
juyuchen5fa0aed2018-05-16 10:58:37 +0800457 if ((strategy == STRATEGY_SONIFICATION) &&
458 (device & AUDIO_DEVICE_OUT_SPEAKER) &&
459 (availableOutputDevicesType & AUDIO_DEVICE_OUT_SPEAKER_SAFE)) {
460 device |= AUDIO_DEVICE_OUT_SPEAKER_SAFE;
461 device &= ~AUDIO_DEVICE_OUT_SPEAKER;
462 }
Jack He96117ae2018-02-12 20:52:53 -0800463 if (device2 != AUDIO_DEVICE_NONE) {
464 device |= device2;
465 break;
466 }
Eric Laurenta8e0f022017-01-27 17:41:53 -0800467 }
468 }
François Gaffie2110e042015-03-24 08:41:51 +0100469 // The second device used for sonification is the same as the device used by media strategy
Chih-Hung Hsieh2b487032018-09-13 14:16:02 -0700470 FALLTHROUGH_INTENDED;
François Gaffie2110e042015-03-24 08:41:51 +0100471
François Gaffie2110e042015-03-24 08:41:51 +0100472 case STRATEGY_ACCESSIBILITY:
473 if (strategy == STRATEGY_ACCESSIBILITY) {
474 // do not route accessibility prompts to a digital output currently configured with a
475 // compressed format as they would likely not be mixed and dropped.
476 for (size_t i = 0; i < outputs.size(); i++) {
477 sp<AudioOutputDescriptor> desc = outputs.valueAt(i);
478 audio_devices_t devices = desc->device() &
479 (AUDIO_DEVICE_OUT_HDMI | AUDIO_DEVICE_OUT_SPDIF | AUDIO_DEVICE_OUT_HDMI_ARC);
480 if (desc->isActive() && !audio_is_linear_pcm(desc->mFormat) &&
481 devices != AUDIO_DEVICE_NONE) {
482 availableOutputDevicesType = availableOutputDevices.types() & ~devices;
483 }
484 }
Eric Laurent28d09f02016-03-08 10:43:05 -0800485 availableOutputDevices =
486 availableOutputDevices.getDevicesFromType(availableOutputDevicesType);
487 if (outputs.isStreamActive(AUDIO_STREAM_RING) ||
488 outputs.isStreamActive(AUDIO_STREAM_ALARM)) {
489 return getDeviceForStrategyInt(
Jean-Michel Trivi61309522018-01-23 09:58:17 -0800490 STRATEGY_SONIFICATION, availableOutputDevices, availableInputDevices, outputs,
491 outputDeviceTypesToIgnore);
Eric Laurent28d09f02016-03-08 10:43:05 -0800492 }
493 if (isInCall()) {
494 return getDeviceForStrategyInt(
Jean-Michel Trivi61309522018-01-23 09:58:17 -0800495 STRATEGY_PHONE, availableOutputDevices, availableInputDevices, outputs,
496 outputDeviceTypesToIgnore);
Eric Laurent28d09f02016-03-08 10:43:05 -0800497 }
François Gaffie2110e042015-03-24 08:41:51 +0100498 }
Eric Laurent28d09f02016-03-08 10:43:05 -0800499 // For other cases, STRATEGY_ACCESSIBILITY behaves like STRATEGY_MEDIA
Chih-Hung Hsieh2b487032018-09-13 14:16:02 -0700500 FALLTHROUGH_INTENDED;
François Gaffie2110e042015-03-24 08:41:51 +0100501
Eric Laurent28d09f02016-03-08 10:43:05 -0800502 // FIXME: STRATEGY_REROUTING follow STRATEGY_MEDIA for now
François Gaffie2110e042015-03-24 08:41:51 +0100503 case STRATEGY_REROUTING:
504 case STRATEGY_MEDIA: {
505 uint32_t device2 = AUDIO_DEVICE_NONE;
506 if (strategy != STRATEGY_SONIFICATION) {
507 // no sonification on remote submix (e.g. WFD)
Eric Laurent28d09f02016-03-08 10:43:05 -0800508 if (availableOutputDevices.getDevice(AUDIO_DEVICE_OUT_REMOTE_SUBMIX,
509 String8("0")) != 0) {
François Gaffie2110e042015-03-24 08:41:51 +0100510 device2 = availableOutputDevices.types() & AUDIO_DEVICE_OUT_REMOTE_SUBMIX;
511 }
512 }
Eric Laurenta20d4fa2015-06-04 18:39:28 -0700513 if (isInCall() && (strategy == STRATEGY_MEDIA)) {
Eric Laurent28d09f02016-03-08 10:43:05 -0800514 device = getDeviceForStrategyInt(
Jean-Michel Trivi61309522018-01-23 09:58:17 -0800515 STRATEGY_PHONE, availableOutputDevices, availableInputDevices, outputs,
516 outputDeviceTypesToIgnore);
Eric Laurenta20d4fa2015-06-04 18:39:28 -0700517 break;
518 }
Eric Laurent58a73fc2018-02-21 18:46:13 -0800519 if (device2 == AUDIO_DEVICE_NONE) {
520 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_HEARING_AID;
521 }
François Gaffie2110e042015-03-24 08:41:51 +0100522 if ((device2 == AUDIO_DEVICE_NONE) &&
523 (mForceUse[AUDIO_POLICY_FORCE_FOR_MEDIA] != AUDIO_POLICY_FORCE_NO_BT_A2DP) &&
Aniket Kumar Lataa8ee9962018-01-31 20:24:23 -0800524 outputs.isA2dpSupported()) {
François Gaffie2110e042015-03-24 08:41:51 +0100525 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_A2DP;
526 if (device2 == AUDIO_DEVICE_NONE) {
527 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES;
528 }
529 if (device2 == AUDIO_DEVICE_NONE) {
530 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER;
531 }
532 }
533 if ((device2 == AUDIO_DEVICE_NONE) &&
534 (mForceUse[AUDIO_POLICY_FORCE_FOR_MEDIA] == AUDIO_POLICY_FORCE_SPEAKER)) {
535 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_SPEAKER;
536 }
537 if (device2 == AUDIO_DEVICE_NONE) {
538 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_WIRED_HEADPHONE;
539 }
Jean-Michel Trivi5c233f82015-04-03 09:21:24 -0700540 if (device2 == AUDIO_DEVICE_NONE) {
François Gaffie2110e042015-03-24 08:41:51 +0100541 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_LINE;
542 }
543 if (device2 == AUDIO_DEVICE_NONE) {
544 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_WIRED_HEADSET;
545 }
546 if (device2 == AUDIO_DEVICE_NONE) {
Eric Laurent904d6322017-03-17 17:20:47 -0700547 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_USB_HEADSET;
548 }
549 if (device2 == AUDIO_DEVICE_NONE) {
François Gaffie2110e042015-03-24 08:41:51 +0100550 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_USB_ACCESSORY;
551 }
552 if (device2 == AUDIO_DEVICE_NONE) {
553 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_USB_DEVICE;
554 }
555 if (device2 == AUDIO_DEVICE_NONE) {
556 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET;
557 }
558 if ((device2 == AUDIO_DEVICE_NONE) && (strategy != STRATEGY_SONIFICATION)) {
559 // no sonification on aux digital (e.g. HDMI)
560 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_AUX_DIGITAL;
561 }
562 if ((device2 == AUDIO_DEVICE_NONE) &&
563 (mForceUse[AUDIO_POLICY_FORCE_FOR_DOCK] == AUDIO_POLICY_FORCE_ANALOG_DOCK)) {
564 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET;
565 }
566 if (device2 == AUDIO_DEVICE_NONE) {
567 device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_SPEAKER;
568 }
569 int device3 = AUDIO_DEVICE_NONE;
570 if (strategy == STRATEGY_MEDIA) {
571 // ARC, SPDIF and AUX_LINE can co-exist with others.
572 device3 = availableOutputDevicesType & AUDIO_DEVICE_OUT_HDMI_ARC;
573 device3 |= (availableOutputDevicesType & AUDIO_DEVICE_OUT_SPDIF);
574 device3 |= (availableOutputDevicesType & AUDIO_DEVICE_OUT_AUX_LINE);
575 }
576
577 device2 |= device3;
578 // device is DEVICE_OUT_SPEAKER if we come from case STRATEGY_SONIFICATION or
579 // STRATEGY_ENFORCED_AUDIBLE, AUDIO_DEVICE_NONE otherwise
580 device |= device2;
581
582 // If hdmi system audio mode is on, remove speaker out of output list.
583 if ((strategy == STRATEGY_MEDIA) &&
584 (mForceUse[AUDIO_POLICY_FORCE_FOR_HDMI_SYSTEM_AUDIO] ==
585 AUDIO_POLICY_FORCE_HDMI_SYSTEM_AUDIO_ENFORCED)) {
586 device &= ~AUDIO_DEVICE_OUT_SPEAKER;
587 }
Jean-Michel Trivi654afa02017-05-11 14:12:33 -0700588
589 // for STRATEGY_SONIFICATION:
590 // if SPEAKER was selected, and SPEAKER_SAFE is available, use SPEAKER_SAFE instead
591 if ((strategy == STRATEGY_SONIFICATION) &&
592 (device & AUDIO_DEVICE_OUT_SPEAKER) &&
593 (availableOutputDevicesType & AUDIO_DEVICE_OUT_SPEAKER_SAFE)) {
594 device |= AUDIO_DEVICE_OUT_SPEAKER_SAFE;
595 device &= ~AUDIO_DEVICE_OUT_SPEAKER;
596 }
François Gaffie2110e042015-03-24 08:41:51 +0100597 } break;
598
599 default:
600 ALOGW("getDeviceForStrategy() unknown strategy: %d", strategy);
601 break;
602 }
603
Eric Laurent5a2b6292016-04-14 18:05:57 -0700604 if (device == AUDIO_DEVICE_NONE) {
605 ALOGV("getDeviceForStrategy() no device found for strategy %d", strategy);
606 device = mApmObserver->getDefaultOutputDevice()->type();
607 ALOGE_IF(device == AUDIO_DEVICE_NONE,
608 "getDeviceForStrategy() no default device defined");
609 }
François Gaffie2110e042015-03-24 08:41:51 +0100610 ALOGVV("getDeviceForStrategy() strategy %d, device %x", strategy, device);
611 return device;
612}
613
614
615audio_devices_t Engine::getDeviceForInputSource(audio_source_t inputSource) const
616{
617 const DeviceVector &availableOutputDevices = mApmObserver->getAvailableOutputDevices();
618 const DeviceVector &availableInputDevices = mApmObserver->getAvailableInputDevices();
Eric Laurentc75307b2015-03-17 15:29:32 -0700619 const SwAudioOutputCollection &outputs = mApmObserver->getOutputs();
François Gaffie2110e042015-03-24 08:41:51 +0100620 audio_devices_t availableDeviceTypes = availableInputDevices.types() & ~AUDIO_DEVICE_BIT_IN;
621
622 uint32_t device = AUDIO_DEVICE_NONE;
623
Eric Laurentdc95a252018-04-12 12:46:56 -0700624 // when a call is active, force device selection to match source VOICE_COMMUNICATION
625 // for most other input sources to avoid rerouting call TX audio
626 if (isInCall()) {
627 switch (inputSource) {
628 case AUDIO_SOURCE_DEFAULT:
629 case AUDIO_SOURCE_MIC:
630 case AUDIO_SOURCE_VOICE_RECOGNITION:
631 case AUDIO_SOURCE_UNPROCESSED:
632 case AUDIO_SOURCE_HOTWORD:
633 case AUDIO_SOURCE_CAMCORDER:
634 inputSource = AUDIO_SOURCE_VOICE_COMMUNICATION;
635 break;
636 default:
637 break;
638 }
639 }
640
François Gaffie2110e042015-03-24 08:41:51 +0100641 switch (inputSource) {
642 case AUDIO_SOURCE_VOICE_UPLINK:
643 if (availableDeviceTypes & AUDIO_DEVICE_IN_VOICE_CALL) {
644 device = AUDIO_DEVICE_IN_VOICE_CALL;
645 break;
646 }
647 break;
648
649 case AUDIO_SOURCE_DEFAULT:
650 case AUDIO_SOURCE_MIC:
651 if (availableDeviceTypes & AUDIO_DEVICE_IN_BLUETOOTH_A2DP) {
652 device = AUDIO_DEVICE_IN_BLUETOOTH_A2DP;
653 } else if ((mForceUse[AUDIO_POLICY_FORCE_FOR_RECORD] == AUDIO_POLICY_FORCE_BT_SCO) &&
654 (availableDeviceTypes & AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET)) {
655 device = AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET;
656 } else if (availableDeviceTypes & AUDIO_DEVICE_IN_WIRED_HEADSET) {
657 device = AUDIO_DEVICE_IN_WIRED_HEADSET;
Eric Laurent904d6322017-03-17 17:20:47 -0700658 } else if (availableDeviceTypes & AUDIO_DEVICE_IN_USB_HEADSET) {
659 device = AUDIO_DEVICE_IN_USB_HEADSET;
François Gaffie2110e042015-03-24 08:41:51 +0100660 } else if (availableDeviceTypes & AUDIO_DEVICE_IN_USB_DEVICE) {
661 device = AUDIO_DEVICE_IN_USB_DEVICE;
662 } else if (availableDeviceTypes & AUDIO_DEVICE_IN_BUILTIN_MIC) {
663 device = AUDIO_DEVICE_IN_BUILTIN_MIC;
664 }
665 break;
666
667 case AUDIO_SOURCE_VOICE_COMMUNICATION:
668 // Allow only use of devices on primary input if in call and HAL does not support routing
669 // to voice call path.
670 if ((getPhoneState() == AUDIO_MODE_IN_CALL) &&
671 (availableOutputDevices.types() & AUDIO_DEVICE_OUT_TELEPHONY_TX) == 0) {
672 sp<AudioOutputDescriptor> primaryOutput = outputs.getPrimaryOutput();
673 availableDeviceTypes =
674 availableInputDevices.getDevicesFromHwModule(primaryOutput->getModuleHandle())
675 & ~AUDIO_DEVICE_BIT_IN;
676 }
677
678 switch (mForceUse[AUDIO_POLICY_FORCE_FOR_COMMUNICATION]) {
679 case AUDIO_POLICY_FORCE_BT_SCO:
680 // if SCO device is requested but no SCO device is available, fall back to default case
681 if (availableDeviceTypes & AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET) {
682 device = AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET;
683 break;
684 }
Chih-Hung Hsieh2b487032018-09-13 14:16:02 -0700685 FALLTHROUGH_INTENDED;
François Gaffie2110e042015-03-24 08:41:51 +0100686
687 default: // FORCE_NONE
688 if (availableDeviceTypes & AUDIO_DEVICE_IN_WIRED_HEADSET) {
689 device = AUDIO_DEVICE_IN_WIRED_HEADSET;
Eric Laurent904d6322017-03-17 17:20:47 -0700690 } else if (availableDeviceTypes & AUDIO_DEVICE_IN_USB_HEADSET) {
691 device = AUDIO_DEVICE_IN_USB_HEADSET;
François Gaffie2110e042015-03-24 08:41:51 +0100692 } else if (availableDeviceTypes & AUDIO_DEVICE_IN_USB_DEVICE) {
693 device = AUDIO_DEVICE_IN_USB_DEVICE;
694 } else if (availableDeviceTypes & AUDIO_DEVICE_IN_BUILTIN_MIC) {
695 device = AUDIO_DEVICE_IN_BUILTIN_MIC;
696 }
697 break;
698
699 case AUDIO_POLICY_FORCE_SPEAKER:
700 if (availableDeviceTypes & AUDIO_DEVICE_IN_BACK_MIC) {
701 device = AUDIO_DEVICE_IN_BACK_MIC;
702 } else if (availableDeviceTypes & AUDIO_DEVICE_IN_BUILTIN_MIC) {
703 device = AUDIO_DEVICE_IN_BUILTIN_MIC;
704 }
705 break;
706 }
707 break;
708
709 case AUDIO_SOURCE_VOICE_RECOGNITION:
rago8a397d52015-12-02 11:27:57 -0800710 case AUDIO_SOURCE_UNPROCESSED:
François Gaffie2110e042015-03-24 08:41:51 +0100711 case AUDIO_SOURCE_HOTWORD:
712 if (mForceUse[AUDIO_POLICY_FORCE_FOR_RECORD] == AUDIO_POLICY_FORCE_BT_SCO &&
713 availableDeviceTypes & AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET) {
714 device = AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET;
715 } else if (availableDeviceTypes & AUDIO_DEVICE_IN_WIRED_HEADSET) {
716 device = AUDIO_DEVICE_IN_WIRED_HEADSET;
Eric Laurent904d6322017-03-17 17:20:47 -0700717 } else if (availableDeviceTypes & AUDIO_DEVICE_IN_USB_HEADSET) {
718 device = AUDIO_DEVICE_IN_USB_HEADSET;
François Gaffie2110e042015-03-24 08:41:51 +0100719 } else if (availableDeviceTypes & AUDIO_DEVICE_IN_USB_DEVICE) {
720 device = AUDIO_DEVICE_IN_USB_DEVICE;
721 } else if (availableDeviceTypes & AUDIO_DEVICE_IN_BUILTIN_MIC) {
722 device = AUDIO_DEVICE_IN_BUILTIN_MIC;
723 }
724 break;
725 case AUDIO_SOURCE_CAMCORDER:
726 if (availableDeviceTypes & AUDIO_DEVICE_IN_BACK_MIC) {
727 device = AUDIO_DEVICE_IN_BACK_MIC;
728 } else if (availableDeviceTypes & AUDIO_DEVICE_IN_BUILTIN_MIC) {
729 device = AUDIO_DEVICE_IN_BUILTIN_MIC;
Takeshi Oishi86ad3d12018-07-20 16:13:06 +0900730 } else if (availableDeviceTypes & AUDIO_DEVICE_IN_USB_DEVICE) {
731 // This is specifically for a device without built-in mic
732 device = AUDIO_DEVICE_IN_USB_DEVICE;
François Gaffie2110e042015-03-24 08:41:51 +0100733 }
734 break;
735 case AUDIO_SOURCE_VOICE_DOWNLINK:
736 case AUDIO_SOURCE_VOICE_CALL:
737 if (availableDeviceTypes & AUDIO_DEVICE_IN_VOICE_CALL) {
738 device = AUDIO_DEVICE_IN_VOICE_CALL;
739 }
740 break;
741 case AUDIO_SOURCE_REMOTE_SUBMIX:
742 if (availableDeviceTypes & AUDIO_DEVICE_IN_REMOTE_SUBMIX) {
743 device = AUDIO_DEVICE_IN_REMOTE_SUBMIX;
744 }
745 break;
746 case AUDIO_SOURCE_FM_TUNER:
747 if (availableDeviceTypes & AUDIO_DEVICE_IN_FM_TUNER) {
748 device = AUDIO_DEVICE_IN_FM_TUNER;
749 }
750 break;
751 default:
752 ALOGW("getDeviceForInputSource() invalid input source %d", inputSource);
753 break;
754 }
Eric Laurent5a2b6292016-04-14 18:05:57 -0700755 if (device == AUDIO_DEVICE_NONE) {
756 ALOGV("getDeviceForInputSource() no device found for source %d", inputSource);
757 if (availableDeviceTypes & AUDIO_DEVICE_IN_STUB) {
758 device = AUDIO_DEVICE_IN_STUB;
759 }
760 ALOGE_IF(device == AUDIO_DEVICE_NONE,
761 "getDeviceForInputSource() no default device defined");
762 }
François Gaffie2110e042015-03-24 08:41:51 +0100763 ALOGV("getDeviceForInputSource()input source %d, device %08x", inputSource, device);
764 return device;
765}
766
767template <>
768AudioPolicyManagerInterface *Engine::queryInterface()
769{
770 return &mManagerInterface;
771}
772
773} // namespace audio_policy
774} // namespace android
775
776