From e31fc6f3f79848e6f7e7b1b4abe82aa26571cf7b Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Thu, 25 Aug 2022 13:30:29 -0400 Subject: [PATCH 3/5] APM: Remove A2DP audio ports from the primary HAL These ports defined in the primary HAL are intended for A2DP offloading, however they do not work in general on GSIs, and will interfere with sysbta, the system-side generic bluetooth audio implementation. Remove them as we parse the policy XML. Co-authored-by: Pierre-Hugues Husson Change-Id: I3305594a17285da113167b419543543f0ef71122 --- .../managerdefinitions/src/Serializer.cpp | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp index f5233f2a42..6630d06f6d 100644 --- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp +++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -334,11 +335,8 @@ status_t PolicySerializer::deserializeCollection(const xmlNode *cur, Trait::collectionTag); return status; } - } else if (mIgnoreVendorExtensions && std::get(maybeElement) == NO_INIT) { - // Skip a vendor extension element. - } else { - return BAD_VALUE; } + // Ignore elements that failed to parse, e.g. routes with invalid sinks } } if (!xmlStrcmp(cur->name, reinterpret_cast(Trait::tag))) { @@ -679,6 +677,7 @@ std::variant PolicySerializer::deserialize PolicySerializer::deserializetype(); + if (type == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP + || type == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES + || type == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER) { + ALOGE("Erasing A2DP device port %s", port->getTagName().c_str()); + iter = devicePorts.erase(iter); + } else { + iter++; + } + } + } module->setDeclaredDevices(devicePorts); RouteTraits::Collection routes; -- 2.37.2