audiopolicy: use profile flags during opening an input
During the device connection and new module availability, when inputs
are opened, use port specific flags so, HAL can open related mix port
otherwise every request opens the primary input profile.
Flag: EXEMPT bugfix
Bug: 345692843
Test: connect an external device, check opened inputs, verify logs.
Change-Id: I1493ccdd61d33cd1b257afde4d083a73c6410361
Merged-In: I1493ccdd61d33cd1b257afde4d083a73c6410361
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 8561a9d..679f0ee 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -6452,7 +6452,7 @@
status_t status = inputDesc->open(nullptr,
availProfileDevices.itemAt(0),
AUDIO_SOURCE_MIC,
- AUDIO_INPUT_FLAG_NONE,
+ (audio_input_flags_t) inProfile->getFlags(),
&input);
if (status != NO_ERROR) {
ALOGW("Cannot open input stream for device %s on hw module %s",
@@ -6758,7 +6758,8 @@
desc = new AudioInputDescriptor(profile, mpClientInterface);
audio_io_handle_t input = AUDIO_IO_HANDLE_NONE;
- status = desc->open(nullptr, device, AUDIO_SOURCE_MIC, AUDIO_INPUT_FLAG_NONE, &input);
+ status = desc->open(nullptr, device, AUDIO_SOURCE_MIC,
+ (audio_input_flags_t) profile->getFlags(), &input);
if (status == NO_ERROR) {
const String8& address = String8(device->address().c_str());