[4/n] Android 14 port

Refresh Bluetooth patches
This commit is contained in:
Peter Cai 2023-10-07 20:22:56 -04:00
parent c06b6e26a2
commit c4daf7d004
3 changed files with 16 additions and 73 deletions

View file

@ -1,57 +0,0 @@
From 08cae5289428f6a99f2a6d28145fa542d1288916 Mon Sep 17 00:00:00 2001
From: "tzu-hsien.huang" <tzu-hsien.huang@mediatek.com>
Date: Wed, 20 Jul 2022 15:12:01 +0800
Subject: [PATCH 1/3] Additionally check le_set_event_mask command resturn
status with UNSUPPORTED_LMP_OR_LL_PARAMETER
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In GD BT stack, stack will check each return status of HCI Commands. E.g. reset , le_set_event_mask, set_event_mask …etc.
In BT spec 5.2, SIG add some parameters for le_set_event_mask for le audio, like LE Terminate BIG Complete event: Supported.
However, some legacy chips do not support LE Audio feature, and controller will return Status: Unsupported LMP Parameter Value when it receives this HCI Command
When it checks the return value and find the status is not SUCCESS, it will cause FAIL and cannot be compatible with old legacy chip.
After brushing GSI, Bluetooth will turn off automatically when it is turned on.
So all CTS test will always fail.
Check le_set_event_mask command return status with SUCCESS or UNSUPPORTED_LMP_OR_LL_PARAMETER
Bug: 239662211
Test: CtsBluetoothTestCases
Change-Id: I2b0cede7f47eecd2124a386e958773289eb6f11c
---
system/gd/hci/controller.cc | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/system/gd/hci/controller.cc b/system/gd/hci/controller.cc
index 9dac2b6a84..50342d639e 100644
--- a/system/gd/hci/controller.cc
+++ b/system/gd/hci/controller.cc
@@ -548,7 +548,7 @@ struct Controller::impl {
void le_set_event_mask(uint64_t le_event_mask) {
std::unique_ptr<LeSetEventMaskBuilder> packet = LeSetEventMaskBuilder::Create(le_event_mask);
hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn(
- this, &Controller::impl::check_status<LeSetEventMaskCompleteView>));
+ this, &Controller::impl::check_event_mask_status<LeSetEventMaskCompleteView>));
}
template <class T>
@@ -559,6 +559,15 @@ struct Controller::impl {
ASSERT(status_view.GetStatus() == ErrorCode::SUCCESS);
}
+ template <class T>
+ void check_event_mask_status(CommandCompleteView view) {
+ ASSERT(view.IsValid());
+ auto status_view = T::Create(view);
+ ASSERT(status_view.IsValid());
+ ASSERT(status_view.GetStatus() == ErrorCode::SUCCESS ||
+ status_view.GetStatus() == ErrorCode::UNSUPPORTED_LMP_OR_LL_PARAMETER);
+ }
+
#define OP_CODE_MAPPING(name) \
case OpCode::name: { \
uint16_t index = (uint16_t)OpCodeIndex::name; \
--
2.40.1

View file

@ -1,7 +1,7 @@
From 55a4e7e7158f50f3e8840b526e15d7c9f10423de Mon Sep 17 00:00:00 2001
From 184dbd4770340934511622b0bac58eb45d0cb905 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Wed, 24 Aug 2022 10:41:29 -0400
Subject: [PATCH 2/3] gd: hci: Ignore unexpected status events
Subject: [PATCH 1/2] gd: hci: Ignore unexpected status events
For some reason, on some old devices, the controller will report a
remote to support SNIFF_SUBRATING even when it does not. Just ignore the
@ -13,12 +13,12 @@ Change-Id: Ifb9a65fd77f21d15a8dc1ced9240194d38218ef6
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/system/gd/hci/hci_layer.cc b/system/gd/hci/hci_layer.cc
index 5def729ac8..9c235294bb 100644
index c3312a557c..3e8ab78371 100644
--- a/system/gd/hci/hci_layer.cc
+++ b/system/gd/hci/hci_layer.cc
@@ -195,14 +195,13 @@ struct HciLayer::impl {
EventView::Create(PacketView<kLittleEndian>(std::make_shared<std::vector<uint8_t>>(std::vector<uint8_t>()))));
command_queue_.front().GetCallback<CommandCompleteView>()->Invoke(move(command_complete_view));
@@ -211,14 +211,13 @@ struct HciLayer::impl {
command_queue_.front().GetCallback<CommandCompleteView>()->Invoke(
std::move(command_complete_view));
} else {
- ASSERT_LOG(
- command_queue_.front().waiting_for_status_ == is_status,
@ -27,17 +27,17 @@ index 5def729ac8..9c235294bb 100644
- OpCodeText(op_code).c_str(),
- logging_id.c_str());
-
- command_queue_.front().GetCallback<TResponse>()->Invoke(move(response_view));
- command_queue_.front().GetCallback<TResponse>()->Invoke(std::move(response_view));
+ if (command_queue_.front().waiting_for_status_ == is_status) {
+ command_queue_.front().GetCallback<TResponse>()->Invoke(move(response_view));
+ command_queue_.front().GetCallback<TResponse>()->Invoke(std::move(response_view));
+ } else {
+ CommandCompleteView command_complete_view = CommandCompleteView::Create(
+ EventView::Create(PacketView<kLittleEndian>(std::make_shared<std::vector<uint8_t>>(std::vector<uint8_t>()))));
+ command_queue_.front().GetCallback<CommandCompleteView>()->Invoke(move(command_complete_view));
+ command_queue_.front().GetCallback<CommandCompleteView>()->Invoke(std::move(command_complete_view));
+ }
}
command_queue_.pop_front();
--
2.40.1
2.41.0

View file

@ -1,7 +1,7 @@
From f2d820597f4dcbb08e4e0c9026dc1d56fe7b3bfd Mon Sep 17 00:00:00 2001
From 9524502060facedcba0682c61b4b94340d082f36 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Wed, 24 Aug 2022 15:45:18 -0400
Subject: [PATCH 3/3] audio_hal_interface: Optionally use sysbta HAL
Subject: [PATCH 2/2] audio_hal_interface: Optionally use sysbta HAL
Required to support sysbta, our system-side bt audio implementation.
@ -13,7 +13,7 @@ Change-Id: I59973e6ec84c5923be8a7c67b36b2e237f000860
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/system/audio_hal_interface/aidl/client_interface_aidl.cc b/system/audio_hal_interface/aidl/client_interface_aidl.cc
index 9af28031f7..5a9dbbccad 100644
index 897b891aa7..660a141894 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(
@ -44,7 +44,7 @@ index 9af28031f7..5a9dbbccad 100644
if (provider_factory == nullptr) {
LOG(ERROR) << __func__ << ", can't get capability 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 17abefe8fe..07dd11266f 100644
index 8a40c1d7d7..6d962d3473 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 @@
@ -55,7 +55,7 @@ index 17abefe8fe..07dd11266f 100644
#define BLUETOOTH_AUDIO_HAL_PROP_DISABLED \
"persist.bluetooth.bluetooth_audio_hal.disabled"
@@ -117,6 +118,12 @@ class BluetoothAudioClientInterface {
@@ -119,6 +120,12 @@ class BluetoothAudioClientInterface {
// "android.hardware.bluetooth.audio.IBluetoothAudioProviderFactory/default";
static inline const std::string kDefaultAudioProviderFactoryInterface =
std::string() + IBluetoothAudioProviderFactory::descriptor + "/default";
@ -103,5 +103,5 @@ index a2c192f37d..c3d1cf35c2 100644
return;
}
--
2.40.1
2.41.0