forked from PeterGSI/patches
frameworks/av: Add patch to remove A2DP ports from primary hal
This commit is contained in:
parent
304a11bcfa
commit
2cbf15fc89
|
@ -1,7 +1,7 @@
|
|||
From 51deb8e31ca57f19420277cc92b26375233e9050 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Thu, 18 Aug 2022 15:44:46 -0400
|
||||
Subject: [PATCH 1/2] APM: Restore S, R and Q behavior respectively for
|
||||
Subject: [PATCH 1/3] APM: Restore S, R and Q behavior respectively for
|
||||
telephony audio
|
||||
|
||||
This conditionally reverts part of b2e5cb (T), 51c9cc (S) and afd4ce (R)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From 5def9ad1a26e28d517666e34301dc725c1660e36 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 24 Aug 2022 15:42:39 -0400
|
||||
Subject: [PATCH 2/2] APM: Optionally force-load audio policy for system-side
|
||||
Subject: [PATCH 2/3] APM: Optionally force-load audio policy for system-side
|
||||
bt audio HAL
|
||||
|
||||
Required to support our system-side bt audio implementation, i.e.
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
From e31fc6f3f79848e6f7e7b1b4abe82aa26571cf7b Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Thu, 25 Aug 2022 13:30:29 -0400
|
||||
Subject: [PATCH 3/3] 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 <phh@phh.me>
|
||||
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 <libxml/xinclude.h>
|
||||
#include <media/convert.h>
|
||||
#include <cutils/properties.h>
|
||||
+#include <system/audio.h>
|
||||
#include <utils/Log.h>
|
||||
#include <utils/StrongPointer.h>
|
||||
#include <utils/Errors.h>
|
||||
@@ -334,11 +335,8 @@ status_t PolicySerializer::deserializeCollection(const xmlNode *cur,
|
||||
Trait::collectionTag);
|
||||
return status;
|
||||
}
|
||||
- } else if (mIgnoreVendorExtensions && std::get<status_t>(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<const xmlChar*>(Trait::tag))) {
|
||||
@@ -679,6 +677,7 @@ std::variant<status_t, ModuleTraits::Element> PolicySerializer::deserialize<Modu
|
||||
ALOGE("%s: No %s found", __func__, Attributes::name);
|
||||
return BAD_VALUE;
|
||||
}
|
||||
+
|
||||
uint32_t versionMajor = 0, versionMinor = 0;
|
||||
std::string versionLiteral = getXmlAttribute(cur, Attributes::version);
|
||||
if (!versionLiteral.empty()) {
|
||||
@@ -704,6 +703,25 @@ std::variant<status_t, ModuleTraits::Element> PolicySerializer::deserialize<Modu
|
||||
if (status != NO_ERROR) {
|
||||
return status;
|
||||
}
|
||||
+ bool shouldEraseA2DP = name == "primary" && property_get_bool("persist.bluetooth.system_audio_hal.enabled", false);
|
||||
+ if (shouldEraseA2DP) {
|
||||
+ // Having A2DP ports in the primary audio HAL module will interfere with sysbta
|
||||
+ // so remove them here. Note that we do not need to explicitly remove the
|
||||
+ // corresponding routes below, because routes with invalid sinks will be ignored
|
||||
+ auto iter = devicePorts.begin();
|
||||
+ while (iter != devicePorts.end()) {
|
||||
+ auto port = *iter;
|
||||
+ auto type = port->type();
|
||||
+ 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
|
||||
|
Loading…
Reference in New Issue