Changes for April 2024
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From 706908e6a63595671e12bd34fb7f6ff2d2892cdb Mon Sep 17 00:00:00 2001
|
||||
From a128ba855ac44962c2bcacbe005dfe10a13ae74a Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 24 Aug 2022 15:45:18 -0400
|
||||
Subject: [PATCH] audio_hal_interface: Optionally use sysbta HAL
|
||||
@@ -7,16 +7,16 @@ Required to support sysbta, our system-side bt audio implementation.
|
||||
|
||||
Change-Id: I59973e6ec84c5923be8a7c67b36b2e237f000860
|
||||
---
|
||||
system/audio_hal_interface/aidl/client_interface_aidl.cc | 8 ++++----
|
||||
system/audio_hal_interface/aidl/client_interface_aidl.h | 7 +++++++
|
||||
system/audio_hal_interface/hal_version_manager.cc | 9 ++++++++-
|
||||
.../audio_hal_interface/aidl/client_interface_aidl.cc | 6 +++---
|
||||
.../audio_hal_interface/aidl/client_interface_aidl.h | 7 +++++++
|
||||
system/audio_hal_interface/hal_version_manager.cc | 11 +++++++++--
|
||||
3 files changed, 19 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/system/audio_hal_interface/aidl/client_interface_aidl.cc b/system/audio_hal_interface/aidl/client_interface_aidl.cc
|
||||
index 897b891aa7..ed41627c3e 100644
|
||||
index 9faa725022..f6706d98f1 100644
|
||||
--- a/system/audio_hal_interface/aidl/client_interface_aidl.cc
|
||||
+++ b/system/audio_hal_interface/aidl/client_interface_aidl.cc
|
||||
@@ -56,7 +56,7 @@ BluetoothAudioClientInterface::BluetoothAudioClientInterface(
|
||||
@@ -58,7 +58,7 @@ BluetoothAudioClientInterface::BluetoothAudioClientInterface(
|
||||
|
||||
bool BluetoothAudioClientInterface::is_aidl_available() {
|
||||
return AServiceManager_isDeclared(
|
||||
@@ -25,7 +25,7 @@ index 897b891aa7..ed41627c3e 100644
|
||||
}
|
||||
|
||||
std::vector<AudioCapabilities>
|
||||
@@ -72,7 +72,7 @@ BluetoothAudioClientInterface::GetAudioCapabilities(SessionType session_type) {
|
||||
@@ -74,7 +74,7 @@ BluetoothAudioClientInterface::GetAudioCapabilities(SessionType session_type) {
|
||||
}
|
||||
auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(
|
||||
::ndk::SpAIBinder(AServiceManager_waitForService(
|
||||
@@ -34,7 +34,7 @@ index 897b891aa7..ed41627c3e 100644
|
||||
|
||||
if (provider_factory == nullptr) {
|
||||
LOG(ERROR) << __func__ << ", can't get capability from unknown factory";
|
||||
@@ -99,7 +99,7 @@ void BluetoothAudioClientInterface::FetchAudioProvider() {
|
||||
@@ -101,7 +101,7 @@ void BluetoothAudioClientInterface::FetchAudioProvider() {
|
||||
}
|
||||
auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(
|
||||
::ndk::SpAIBinder(AServiceManager_waitForService(
|
||||
@@ -43,17 +43,8 @@ index 897b891aa7..ed41627c3e 100644
|
||||
|
||||
if (provider_factory == nullptr) {
|
||||
LOG(ERROR) << __func__ << ", can't get capability from unknown factory";
|
||||
@@ -266,7 +266,7 @@ int BluetoothAudioClientInterface::GetAidlInterfaceVersion() {
|
||||
|
||||
auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(
|
||||
::ndk::SpAIBinder(AServiceManager_waitForService(
|
||||
- kDefaultAudioProviderFactoryInterface.c_str())));
|
||||
+ audioProviderFactoryInterface().c_str())));
|
||||
|
||||
if (provider_factory == nullptr) {
|
||||
LOG(ERROR) << __func__ << ", can't get aidl version from unknown factory";
|
||||
diff --git a/system/audio_hal_interface/aidl/client_interface_aidl.h b/system/audio_hal_interface/aidl/client_interface_aidl.h
|
||||
index 8a40c1d7d7..6d962d3473 100644
|
||||
index 0dd9575acb..d28e8e46fb 100644
|
||||
--- a/system/audio_hal_interface/aidl/client_interface_aidl.h
|
||||
+++ b/system/audio_hal_interface/aidl/client_interface_aidl.h
|
||||
@@ -28,6 +28,7 @@
|
||||
@@ -64,7 +55,7 @@ index 8a40c1d7d7..6d962d3473 100644
|
||||
|
||||
#define BLUETOOTH_AUDIO_HAL_PROP_DISABLED \
|
||||
"persist.bluetooth.bluetooth_audio_hal.disabled"
|
||||
@@ -119,6 +120,12 @@ class BluetoothAudioClientInterface {
|
||||
@@ -160,6 +161,12 @@ class BluetoothAudioClientInterface {
|
||||
// "android.hardware.bluetooth.audio.IBluetoothAudioProviderFactory/default";
|
||||
static inline const std::string kDefaultAudioProviderFactoryInterface =
|
||||
std::string() + IBluetoothAudioProviderFactory::descriptor + "/default";
|
||||
@@ -78,39 +69,48 @@ index 8a40c1d7d7..6d962d3473 100644
|
||||
private:
|
||||
IBluetoothTransportInstance* transport_;
|
||||
diff --git a/system/audio_hal_interface/hal_version_manager.cc b/system/audio_hal_interface/hal_version_manager.cc
|
||||
index a2c192f37d..c3d1cf35c2 100644
|
||||
index 275bbb067e..885e34f188 100644
|
||||
--- a/system/audio_hal_interface/hal_version_manager.cc
|
||||
+++ b/system/audio_hal_interface/hal_version_manager.cc
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <memory>
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "aidl/audio_aidl_interfaces.h"
|
||||
#include "osi/include/log.h"
|
||||
+#include "osi/include/properties.h"
|
||||
|
||||
namespace bluetooth {
|
||||
namespace audio {
|
||||
@@ -33,6 +34,12 @@ using ::aidl::android::hardware::bluetooth::audio::
|
||||
@@ -34,6 +35,12 @@ using ::aidl::android::hardware::bluetooth::audio::
|
||||
|
||||
static const std::string kDefaultAudioProviderFactoryInterface =
|
||||
std::string() + IBluetoothAudioProviderFactory::descriptor + "/default";
|
||||
+static const std::string kSystemAudioProviderFactoryInterface =
|
||||
+ std::string() + IBluetoothAudioProviderFactory::descriptor + "/sysbta";
|
||||
+static inline const std::string audioProviderFactoryInterface() {
|
||||
+static inline const std::string& audioProviderFactoryInterface() {
|
||||
+ return osi_property_get_bool("persist.bluetooth.system_audio_hal.enabled", false)
|
||||
+ ? kSystemAudioProviderFactoryInterface : kDefaultAudioProviderFactoryInterface;
|
||||
+}
|
||||
|
||||
std::unique_ptr<HalVersionManager> HalVersionManager::instance_ptr =
|
||||
std::make_unique<HalVersionManager>();
|
||||
@@ -92,7 +99,7 @@ HalVersionManager::GetProvidersFactory_2_0() {
|
||||
@@ -88,7 +95,7 @@ BluetoothAudioHalVersion GetAidlInterfaceVersion() {
|
||||
|
||||
auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(
|
||||
::ndk::SpAIBinder(AServiceManager_waitForService(
|
||||
- kDefaultAudioProviderFactoryInterface.c_str())));
|
||||
+ audioProviderFactoryInterface().c_str())));
|
||||
|
||||
if (provider_factory == nullptr) {
|
||||
LOG_ERROR("Can't get aidl version from unknown factory");
|
||||
@@ -122,7 +129,7 @@ BluetoothAudioHalVersion GetAidlInterfaceVersion() {
|
||||
HalVersionManager::HalVersionManager() {
|
||||
hal_transport_ = BluetoothAudioHalTransport::UNKNOWN;
|
||||
if (AServiceManager_checkService(
|
||||
- kDefaultAudioProviderFactoryInterface.c_str()) != nullptr) {
|
||||
+ audioProviderFactoryInterface().c_str()) != nullptr) {
|
||||
hal_version_ = BluetoothAudioHalVersion::VERSION_AIDL_V1;
|
||||
hal_version_ = GetAidlInterfaceVersion();
|
||||
hal_transport_ = BluetoothAudioHalTransport::AIDL;
|
||||
return;
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user