Loading system/gd/hci/acl_manager/classic_impl.h +5 −6 Original line number Diff line number Diff line Loading @@ -398,16 +398,15 @@ struct classic_impl { Address address, ErrorCode status, std::string valid_incoming_addresses) { log::assert_that( status == ErrorCode::UNKNOWN_CONNECTION, "No prior connection request for {} expecting:{}", ADDRESS_TO_LOGGABLE_CSTR(address), valid_incoming_addresses); log::warn( "No matching connection to {} ({})", ADDRESS_TO_LOGGABLE_CSTR(address), ErrorCodeText(status)); log::warn("Firmware error after RemoteNameRequestCancel?"); // see b/184239841 log::assert_that( status != ErrorCode::SUCCESS, "No prior connection request for {} expecting:{}", ADDRESS_TO_LOGGABLE_CSTR(address), valid_incoming_addresses.c_str()); remote_name_request_module->ReportRemoteNameRequestCancellation(address); }, common::Unretained(remote_name_request_module_), Loading system/gd/hci/acl_manager_unittest.cc +24 −0 Original line number Diff line number Diff line Loading @@ -663,6 +663,30 @@ TEST_F(AclManagerWithCallbacksTest, two_remote_connection_requests_ABBA) { } } TEST_F(AclManagerWithCallbacksTest, test_disconnection_after_request) { Address remote = *Address::FromString("12:34:56:78:9a:bc"); EXPECT_CALL(mock_connection_callbacks_, OnConnectRequest).Times(1); test_hci_layer_->IncomingEvent(ConnectionRequestBuilder::Create( remote, ClassOfDevice({1, 2, 3}), ConnectionRequestLinkType::ACL)); test_hci_layer_->IncomingEvent(ConnectionCompleteBuilder::Create( ErrorCode::REMOTE_USER_TERMINATED_CONNECTION, 0, remote, LinkType::ACL, Enable::DISABLED)); } TEST_F(AclManagerWithCallbacksTest, test_disconnection_after_request_sync) { std::promise<void> request_promise; auto request_future = request_promise.get_future(); Address remote = *Address::FromString("12:34:56:78:9a:bc"); EXPECT_CALL(mock_connection_callbacks_, OnConnectRequest).WillOnce([&request_promise]() { request_promise.set_value(); }); test_hci_layer_->IncomingEvent(ConnectionRequestBuilder::Create( remote, ClassOfDevice({1, 2, 3}), ConnectionRequestLinkType::ACL)); ASSERT_EQ(std::future_status::ready, request_future.wait_for(std::chrono::seconds(1))); test_hci_layer_->IncomingEvent(ConnectionCompleteBuilder::Create( ErrorCode::REMOTE_USER_TERMINATED_CONNECTION, 0, remote, LinkType::ACL, Enable::DISABLED)); } } // namespace } // namespace acl_manager } // namespace hci Loading Loading
system/gd/hci/acl_manager/classic_impl.h +5 −6 Original line number Diff line number Diff line Loading @@ -398,16 +398,15 @@ struct classic_impl { Address address, ErrorCode status, std::string valid_incoming_addresses) { log::assert_that( status == ErrorCode::UNKNOWN_CONNECTION, "No prior connection request for {} expecting:{}", ADDRESS_TO_LOGGABLE_CSTR(address), valid_incoming_addresses); log::warn( "No matching connection to {} ({})", ADDRESS_TO_LOGGABLE_CSTR(address), ErrorCodeText(status)); log::warn("Firmware error after RemoteNameRequestCancel?"); // see b/184239841 log::assert_that( status != ErrorCode::SUCCESS, "No prior connection request for {} expecting:{}", ADDRESS_TO_LOGGABLE_CSTR(address), valid_incoming_addresses.c_str()); remote_name_request_module->ReportRemoteNameRequestCancellation(address); }, common::Unretained(remote_name_request_module_), Loading
system/gd/hci/acl_manager_unittest.cc +24 −0 Original line number Diff line number Diff line Loading @@ -663,6 +663,30 @@ TEST_F(AclManagerWithCallbacksTest, two_remote_connection_requests_ABBA) { } } TEST_F(AclManagerWithCallbacksTest, test_disconnection_after_request) { Address remote = *Address::FromString("12:34:56:78:9a:bc"); EXPECT_CALL(mock_connection_callbacks_, OnConnectRequest).Times(1); test_hci_layer_->IncomingEvent(ConnectionRequestBuilder::Create( remote, ClassOfDevice({1, 2, 3}), ConnectionRequestLinkType::ACL)); test_hci_layer_->IncomingEvent(ConnectionCompleteBuilder::Create( ErrorCode::REMOTE_USER_TERMINATED_CONNECTION, 0, remote, LinkType::ACL, Enable::DISABLED)); } TEST_F(AclManagerWithCallbacksTest, test_disconnection_after_request_sync) { std::promise<void> request_promise; auto request_future = request_promise.get_future(); Address remote = *Address::FromString("12:34:56:78:9a:bc"); EXPECT_CALL(mock_connection_callbacks_, OnConnectRequest).WillOnce([&request_promise]() { request_promise.set_value(); }); test_hci_layer_->IncomingEvent(ConnectionRequestBuilder::Create( remote, ClassOfDevice({1, 2, 3}), ConnectionRequestLinkType::ACL)); ASSERT_EQ(std::future_status::ready, request_future.wait_for(std::chrono::seconds(1))); test_hci_layer_->IncomingEvent(ConnectionCompleteBuilder::Create( ErrorCode::REMOTE_USER_TERMINATED_CONNECTION, 0, remote, LinkType::ACL, Enable::DISABLED)); } } // namespace } // namespace acl_manager } // namespace hci Loading