Loading system/build/Android.bp +5 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,11 @@ fluoride_defaults { fluoride_defaults { name: "fluoride_defaults", defaults: ["fluoride_defaults_fuzzable", "fluoride_types_defaults"], shared_libs: ["libstatslog"], shared_libs: [ "libgrpc++", "libgrpc_wrap", "libstatslog" ], sanitize: { misc_undefined: ["bounds"], }, Loading system/gd/Android.bp +38 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,8 @@ cc_defaults { "libchrome", "libcrypto", "libflatbuffers-cpp", "libgrpc++", "libgrpc_wrap", ], static_libs: [ "libbluetooth-protos", Loading Loading @@ -237,7 +239,9 @@ cc_binary { "libbacktrace", "libchrome", "libcrypto", "libgrpc++", "libgrpc++_unsecure", "libgrpc_wrap", "libprotobuf-cpp-full", ], target: { Loading @@ -248,6 +252,10 @@ cc_binary { "libutils", "libcutils", ], static_libs: [ "libbt_common_sys_prop_cxx", "libbt_hidl_hal_cxx", ], }, host: { required: [ Loading Loading @@ -295,6 +303,10 @@ cc_test { "libutils", "libcutils", ], static_libs: [ "libbt_common_sys_prop_cxx", "libbt_hidl_hal_cxx", ], }, }, srcs: [ Loading Loading @@ -335,6 +347,8 @@ cc_test { shared_libs: [ "libchrome", "libcrypto", "libgrpc++", "libgrpc_wrap", ], sanitize: { address: true, Loading Loading @@ -370,6 +384,24 @@ cc_test { "libcxxbridge05", "libchrome", ], shared_libs: [ "libgrpc++", "libgrpc_wrap", ], target: { android: { shared_libs: [ "android.hardware.bluetooth@1.0", "libhidlbase", "libutils", "libcutils", ], static_libs: [ "libbt_common_sys_prop_cxx", "libbt_hidl_hal_cxx", ], }, }, } cc_defaults { Loading Loading @@ -397,6 +429,8 @@ cc_defaults { shared_libs: [ "libcrypto", "libflatbuffers-cpp", "libgrpc++", "libgrpc_wrap", ], cflags: [ "-DFUZZ_TARGET", Loading @@ -409,6 +443,10 @@ cc_defaults { "libhidlbase", "libutils", ], static_libs: [ "libbt_common_sys_prop_cxx", "libbt_hidl_hal_cxx", ], }, }, } Loading system/main/shim/acl.cc +28 −27 Original line number Diff line number Diff line Loading @@ -18,8 +18,8 @@ #include <base/location.h> #include <base/strings/stringprintf.h> #include <time.h> #include <chrono> #include <cstdint> #include <functional> Loading Loading @@ -588,6 +588,8 @@ struct bluetooth::shim::legacy::Acl::impl { void EnqueueClassicPacket( HciHandle handle, std::unique_ptr<bluetooth::packet::RawBuilder> packet) { ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection", handle); handle_to_classic_connection_map_[handle]->EnqueuePacket(std::move(packet)); } Loading @@ -596,32 +598,30 @@ struct bluetooth::shim::legacy::Acl::impl { handle_to_le_connection_map_.end(); } bool ClassicConnectionExists(HciHandle handle) { return handle_to_classic_connection_map_.find(handle) != handle_to_classic_connection_map_.end(); } void EnqueueLePacket(HciHandle handle, std::unique_ptr<bluetooth::packet::RawBuilder> packet) { if (ClassicConnectionExists(handle)) ASSERT_LOG(IsLeAcl(handle), "handle %d is not a LE connection", handle); handle_to_le_connection_map_[handle]->EnqueuePacket(std::move(packet)); } void HoldMode(HciHandle handle, uint16_t max_interval, uint16_t min_interval) { if (ClassicConnectionExists(handle)) ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection", handle); handle_to_classic_connection_map_[handle]->HoldMode(max_interval, min_interval); } void ExitSniffMode(HciHandle handle) { if (ClassicConnectionExists(handle)) ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection", handle); handle_to_classic_connection_map_[handle]->ExitSniffMode(); } void SniffMode(HciHandle handle, uint16_t max_interval, uint16_t min_interval, uint16_t attempt, uint16_t timeout) { if (ClassicConnectionExists(handle)) ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection", handle); handle_to_classic_connection_map_[handle]->SniffMode( max_interval, min_interval, attempt, timeout); } Loading @@ -629,15 +629,16 @@ struct bluetooth::shim::legacy::Acl::impl { void SniffSubrating(HciHandle handle, uint16_t maximum_latency, uint16_t minimum_remote_timeout, uint16_t minimum_local_timeout) { if (ClassicConnectionExists(handle)) ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection", handle); handle_to_classic_connection_map_[handle]->SniffSubrating( maximum_latency, minimum_remote_timeout, minimum_local_timeout); } void SetConnectionEncryption(HciHandle handle, hci::Enable enable) { if (ClassicConnectionExists(handle)) handle_to_classic_connection_map_[handle]->SetConnectionEncryption( enable); ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection", handle); handle_to_classic_connection_map_[handle]->SetConnectionEncryption(enable); } void DumpConnectionHistory() const { Loading Loading @@ -922,9 +923,9 @@ void bluetooth::shim::legacy::Acl::OnLeLinkDisconnected(HciHandle handle, hci::AddressWithType remote_address_with_type = pimpl_->handle_to_le_connection_map_[handle]->GetRemoteAddressWithType(); CreationTime creation_time = pimpl_->handle_to_classic_connection_map_[handle]->GetCreationTime(); pimpl_->handle_to_le_connection_map_[handle]->GetCreationTime(); bool is_locally_initiated = pimpl_->handle_to_classic_connection_map_[handle]->IsLocallyInitiated(); pimpl_->handle_to_le_connection_map_[handle]->IsLocallyInitiated(); TeardownTime teardown_time = std::chrono::system_clock::now(); Loading system/stack/btm/btm_sco.cc +4 −6 Original line number Diff line number Diff line Loading @@ -683,7 +683,7 @@ void btm_sco_conn_req(const RawAddress& bda, DEV_CLASS dev_class, * Returns void * ******************************************************************************/ void btm_sco_connected(uint8_t hci_status, const RawAddress* bda, void btm_sco_connected(uint8_t hci_status, const RawAddress& bda, uint16_t hci_handle, tBTM_ESCO_DATA* p_esco_data) { tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0]; uint16_t xx; Loading @@ -693,7 +693,7 @@ void btm_sco_connected(uint8_t hci_status, const RawAddress* bda, for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) { if (((p->state == SCO_ST_CONNECTING) || (p->state == SCO_ST_LISTENING) || (p->state == SCO_ST_W4_CONN_RSP)) && (p->rem_bd_known) && (!bda || p->esco.data.bd_addr == *bda)) { (p->rem_bd_known) && (p->esco.data.bd_addr == bda)) { if (hci_status != HCI_SUCCESS) { /* Report the error if originator, otherwise remain in Listen mode */ if (p->is_orig) { Loading Loading @@ -726,15 +726,13 @@ void btm_sco_connected(uint8_t hci_status, const RawAddress* bda, p->state = SCO_ST_CONNECTED; p->hci_handle = hci_handle; RawAddress bd_addr(*bda); if (hci_status == HCI_SUCCESS) { BTM_LogHistory(kBtmLogTag, bd_addr, "Connection success", BTM_LogHistory(kBtmLogTag, bda, "Connection success", base::StringPrintf("handle:0x%04x %s", hci_handle, (spt) ? "listener" : "initiator")); } else { BTM_LogHistory( kBtmLogTag, bd_addr, "Connection failed", kBtmLogTag, bda, "Connection failed", base::StringPrintf( "reason:%s", hci_reason_code_text(static_cast<tHCI_REASON>(hci_status)) Loading system/stack/btu/btu_hcif.cc +2 −4 Original line number Diff line number Diff line Loading @@ -962,7 +962,7 @@ static void btu_hcif_connection_comp_evt(uint8_t* p, uint8_t evt_len) { memset(&esco_data, 0, sizeof(tBTM_ESCO_DATA)); /* esco_data.link_type = HCI_LINK_TYPE_SCO; already zero */ esco_data.bd_addr = bda; btm_sco_connected(status, &bda, handle, &esco_data); btm_sco_connected(status, bda, handle, &esco_data); } } Loading Loading @@ -1178,7 +1178,7 @@ static void btu_hcif_esco_connection_comp_evt(uint8_t* p) { handle = HCID_GET_HANDLE(handle); data.bd_addr = bda; btm_sco_connected(status, &bda, handle, &data); btm_sco_connected(status, bda, handle, &data); } /******************************************************************************* Loading Loading @@ -1437,8 +1437,6 @@ static void btu_hcif_hdl_command_status(uint16_t opcode, uint8_t status, // Determine if initial connection failed or is a change of setup if (btm_is_sco_active(handle)) { btm_esco_proc_conn_chg(status, handle, 0, 0, 0, 0); } else { btm_sco_connected(status, nullptr, handle, nullptr); } } break; Loading Loading
system/build/Android.bp +5 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,11 @@ fluoride_defaults { fluoride_defaults { name: "fluoride_defaults", defaults: ["fluoride_defaults_fuzzable", "fluoride_types_defaults"], shared_libs: ["libstatslog"], shared_libs: [ "libgrpc++", "libgrpc_wrap", "libstatslog" ], sanitize: { misc_undefined: ["bounds"], }, Loading
system/gd/Android.bp +38 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,8 @@ cc_defaults { "libchrome", "libcrypto", "libflatbuffers-cpp", "libgrpc++", "libgrpc_wrap", ], static_libs: [ "libbluetooth-protos", Loading Loading @@ -237,7 +239,9 @@ cc_binary { "libbacktrace", "libchrome", "libcrypto", "libgrpc++", "libgrpc++_unsecure", "libgrpc_wrap", "libprotobuf-cpp-full", ], target: { Loading @@ -248,6 +252,10 @@ cc_binary { "libutils", "libcutils", ], static_libs: [ "libbt_common_sys_prop_cxx", "libbt_hidl_hal_cxx", ], }, host: { required: [ Loading Loading @@ -295,6 +303,10 @@ cc_test { "libutils", "libcutils", ], static_libs: [ "libbt_common_sys_prop_cxx", "libbt_hidl_hal_cxx", ], }, }, srcs: [ Loading Loading @@ -335,6 +347,8 @@ cc_test { shared_libs: [ "libchrome", "libcrypto", "libgrpc++", "libgrpc_wrap", ], sanitize: { address: true, Loading Loading @@ -370,6 +384,24 @@ cc_test { "libcxxbridge05", "libchrome", ], shared_libs: [ "libgrpc++", "libgrpc_wrap", ], target: { android: { shared_libs: [ "android.hardware.bluetooth@1.0", "libhidlbase", "libutils", "libcutils", ], static_libs: [ "libbt_common_sys_prop_cxx", "libbt_hidl_hal_cxx", ], }, }, } cc_defaults { Loading Loading @@ -397,6 +429,8 @@ cc_defaults { shared_libs: [ "libcrypto", "libflatbuffers-cpp", "libgrpc++", "libgrpc_wrap", ], cflags: [ "-DFUZZ_TARGET", Loading @@ -409,6 +443,10 @@ cc_defaults { "libhidlbase", "libutils", ], static_libs: [ "libbt_common_sys_prop_cxx", "libbt_hidl_hal_cxx", ], }, }, } Loading
system/main/shim/acl.cc +28 −27 Original line number Diff line number Diff line Loading @@ -18,8 +18,8 @@ #include <base/location.h> #include <base/strings/stringprintf.h> #include <time.h> #include <chrono> #include <cstdint> #include <functional> Loading Loading @@ -588,6 +588,8 @@ struct bluetooth::shim::legacy::Acl::impl { void EnqueueClassicPacket( HciHandle handle, std::unique_ptr<bluetooth::packet::RawBuilder> packet) { ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection", handle); handle_to_classic_connection_map_[handle]->EnqueuePacket(std::move(packet)); } Loading @@ -596,32 +598,30 @@ struct bluetooth::shim::legacy::Acl::impl { handle_to_le_connection_map_.end(); } bool ClassicConnectionExists(HciHandle handle) { return handle_to_classic_connection_map_.find(handle) != handle_to_classic_connection_map_.end(); } void EnqueueLePacket(HciHandle handle, std::unique_ptr<bluetooth::packet::RawBuilder> packet) { if (ClassicConnectionExists(handle)) ASSERT_LOG(IsLeAcl(handle), "handle %d is not a LE connection", handle); handle_to_le_connection_map_[handle]->EnqueuePacket(std::move(packet)); } void HoldMode(HciHandle handle, uint16_t max_interval, uint16_t min_interval) { if (ClassicConnectionExists(handle)) ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection", handle); handle_to_classic_connection_map_[handle]->HoldMode(max_interval, min_interval); } void ExitSniffMode(HciHandle handle) { if (ClassicConnectionExists(handle)) ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection", handle); handle_to_classic_connection_map_[handle]->ExitSniffMode(); } void SniffMode(HciHandle handle, uint16_t max_interval, uint16_t min_interval, uint16_t attempt, uint16_t timeout) { if (ClassicConnectionExists(handle)) ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection", handle); handle_to_classic_connection_map_[handle]->SniffMode( max_interval, min_interval, attempt, timeout); } Loading @@ -629,15 +629,16 @@ struct bluetooth::shim::legacy::Acl::impl { void SniffSubrating(HciHandle handle, uint16_t maximum_latency, uint16_t minimum_remote_timeout, uint16_t minimum_local_timeout) { if (ClassicConnectionExists(handle)) ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection", handle); handle_to_classic_connection_map_[handle]->SniffSubrating( maximum_latency, minimum_remote_timeout, minimum_local_timeout); } void SetConnectionEncryption(HciHandle handle, hci::Enable enable) { if (ClassicConnectionExists(handle)) handle_to_classic_connection_map_[handle]->SetConnectionEncryption( enable); ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection", handle); handle_to_classic_connection_map_[handle]->SetConnectionEncryption(enable); } void DumpConnectionHistory() const { Loading Loading @@ -922,9 +923,9 @@ void bluetooth::shim::legacy::Acl::OnLeLinkDisconnected(HciHandle handle, hci::AddressWithType remote_address_with_type = pimpl_->handle_to_le_connection_map_[handle]->GetRemoteAddressWithType(); CreationTime creation_time = pimpl_->handle_to_classic_connection_map_[handle]->GetCreationTime(); pimpl_->handle_to_le_connection_map_[handle]->GetCreationTime(); bool is_locally_initiated = pimpl_->handle_to_classic_connection_map_[handle]->IsLocallyInitiated(); pimpl_->handle_to_le_connection_map_[handle]->IsLocallyInitiated(); TeardownTime teardown_time = std::chrono::system_clock::now(); Loading
system/stack/btm/btm_sco.cc +4 −6 Original line number Diff line number Diff line Loading @@ -683,7 +683,7 @@ void btm_sco_conn_req(const RawAddress& bda, DEV_CLASS dev_class, * Returns void * ******************************************************************************/ void btm_sco_connected(uint8_t hci_status, const RawAddress* bda, void btm_sco_connected(uint8_t hci_status, const RawAddress& bda, uint16_t hci_handle, tBTM_ESCO_DATA* p_esco_data) { tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0]; uint16_t xx; Loading @@ -693,7 +693,7 @@ void btm_sco_connected(uint8_t hci_status, const RawAddress* bda, for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) { if (((p->state == SCO_ST_CONNECTING) || (p->state == SCO_ST_LISTENING) || (p->state == SCO_ST_W4_CONN_RSP)) && (p->rem_bd_known) && (!bda || p->esco.data.bd_addr == *bda)) { (p->rem_bd_known) && (p->esco.data.bd_addr == bda)) { if (hci_status != HCI_SUCCESS) { /* Report the error if originator, otherwise remain in Listen mode */ if (p->is_orig) { Loading Loading @@ -726,15 +726,13 @@ void btm_sco_connected(uint8_t hci_status, const RawAddress* bda, p->state = SCO_ST_CONNECTED; p->hci_handle = hci_handle; RawAddress bd_addr(*bda); if (hci_status == HCI_SUCCESS) { BTM_LogHistory(kBtmLogTag, bd_addr, "Connection success", BTM_LogHistory(kBtmLogTag, bda, "Connection success", base::StringPrintf("handle:0x%04x %s", hci_handle, (spt) ? "listener" : "initiator")); } else { BTM_LogHistory( kBtmLogTag, bd_addr, "Connection failed", kBtmLogTag, bda, "Connection failed", base::StringPrintf( "reason:%s", hci_reason_code_text(static_cast<tHCI_REASON>(hci_status)) Loading
system/stack/btu/btu_hcif.cc +2 −4 Original line number Diff line number Diff line Loading @@ -962,7 +962,7 @@ static void btu_hcif_connection_comp_evt(uint8_t* p, uint8_t evt_len) { memset(&esco_data, 0, sizeof(tBTM_ESCO_DATA)); /* esco_data.link_type = HCI_LINK_TYPE_SCO; already zero */ esco_data.bd_addr = bda; btm_sco_connected(status, &bda, handle, &esco_data); btm_sco_connected(status, bda, handle, &esco_data); } } Loading Loading @@ -1178,7 +1178,7 @@ static void btu_hcif_esco_connection_comp_evt(uint8_t* p) { handle = HCID_GET_HANDLE(handle); data.bd_addr = bda; btm_sco_connected(status, &bda, handle, &data); btm_sco_connected(status, bda, handle, &data); } /******************************************************************************* Loading Loading @@ -1437,8 +1437,6 @@ static void btu_hcif_hdl_command_status(uint16_t opcode, uint8_t status, // Determine if initial connection failed or is a change of setup if (btm_is_sco_active(handle)) { btm_esco_proc_conn_chg(status, handle, 0, 0, 0, 0); } else { btm_sco_connected(status, nullptr, handle, nullptr); } } break; Loading