Merge "Remove PDL from the HAL" into main am: c9174b9a18 am: 3928787308 am: 4784e6838f

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2729993

Change-Id: I1c686c6c9baa9a00753c6b3d8ae922d810afc0a3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-08-29 02:45:54 +00:00 committed by Automerger Merge Worker
commit d1c6a1cf52
2 changed files with 12 additions and 23 deletions

View file

@ -30,15 +30,8 @@ cc_library_static {
defaults: ["android.hardware.bluetooth-service-build-defaults"], defaults: ["android.hardware.bluetooth-service-build-defaults"],
srcs: [ srcs: [
"BluetoothHci.cpp", "BluetoothHci.cpp",
":BluetoothPacketSources",
"net_bluetooth_mgmt.cpp", "net_bluetooth_mgmt.cpp",
], ],
generated_headers: [
"BluetoothGeneratedPackets_h",
],
include_dirs: [
"packages/modules/Bluetooth/system/gd",
],
} }
cc_binary { cc_binary {

View file

@ -29,11 +29,6 @@
#include "log/log.h" #include "log/log.h"
// TODO: Remove custom logging defines from PDL packets.
#undef LOG_INFO
#undef LOG_DEBUG
#include "hci/hci_packets.h"
namespace { namespace {
int SetTerminalRaw(int fd) { int SetTerminalRaw(int fd) {
termios terminal_settings; termios terminal_settings;
@ -140,9 +135,7 @@ int BluetoothHci::getFdFromDevPath() {
void BluetoothHci::reset() { void BluetoothHci::reset() {
// Send a reset command and wait until the command complete comes back. // Send a reset command and wait until the command complete comes back.
std::vector<uint8_t> reset; std::vector<uint8_t> reset = {0x03, 0x0c, 0x00};
::bluetooth::packet::BitInserter bi{reset};
::bluetooth::hci::ResetBuilder::Create()->Serialize(bi);
auto resetPromise = std::make_shared<std::promise<void>>(); auto resetPromise = std::make_shared<std::promise<void>>();
auto resetFuture = resetPromise->get_future(); auto resetFuture = resetPromise->get_future();
@ -162,13 +155,15 @@ void BluetoothHci::reset() {
static_cast<int>(raw_sco.size())); static_cast<int>(raw_sco.size()));
}, },
[resetPromise](const std::vector<uint8_t>& raw_event) { [resetPromise](const std::vector<uint8_t>& raw_event) {
bool valid = ::bluetooth::hci::ResetCompleteView::Create( std::vector<uint8_t> reset_complete = {0x0e, 0x04, 0x01,
::bluetooth::hci::CommandCompleteView::Create( 0x03, 0x0c, 0x00};
::bluetooth::hci::EventView::Create( bool valid = raw_event.size() == 6 &&
::bluetooth::hci::PacketView<true>( raw_event[0] == reset_complete[0] &&
std::make_shared<std::vector<uint8_t>>( raw_event[1] == reset_complete[1] &&
raw_event))))) // Don't compare the number of packets field.
.IsValid(); raw_event[3] == reset_complete[3] &&
raw_event[4] == reset_complete[4] &&
raw_event[5] == reset_complete[5];
if (valid) { if (valid) {
resetPromise->set_value(); resetPromise->set_value();
} else { } else {
@ -306,7 +301,8 @@ ndk::ScopedAStatus BluetoothHci::close() {
{ {
std::lock_guard<std::mutex> guard(mStateMutex); std::lock_guard<std::mutex> guard(mStateMutex);
if (mState != HalState::ONE_CLIENT) { if (mState != HalState::ONE_CLIENT) {
ASSERT(mState != HalState::INITIALIZING); LOG_ALWAYS_FATAL_IF(mState == HalState::INITIALIZING,
"mState is INITIALIZING");
ALOGI("Already closed"); ALOGI("Already closed");
return ndk::ScopedAStatus::ok(); return ndk::ScopedAStatus::ok();
} }