Loading system/gd/common/metric_id_manager.cc +7 −3 Original line number Diff line number Diff line Loading @@ -69,9 +69,13 @@ bool MetricIdManager::Init( next_id_ = kMinId; for (const auto& p : paired_device_map) { if (p.second < kMinId || p.second > kMaxId) { LOG_ALWAYS_FATAL("Invalid Bluetooth Metric Id in config. " LOG_ALWAYS_FATAL( "Invalid Bluetooth Metric Id in config. " "Id %d of %s is out of range [%d, %d]", p.second, p.first.ToString().c_str(), kMinId, kMaxId); p.second, ADDRESS_TO_LOGGABLE_CSTR(p.first), kMinId, kMaxId); } auto evicted = paired_device_cache_.insert_or_assign(p.first, p.second); if (evicted) { Loading system/gd/hci/acl_manager/acl_scheduler.cc +5 −3 Original line number Diff line number Diff line Loading @@ -102,7 +102,8 @@ struct AclScheduler::impl { [&]() { cancel_connection.Invoke(); }, [&](auto entry) { cancel_connection_completed.Invoke(); }); if (!ok) { LOG_ERROR("Attempted to cancel connection to %s that does not exist", address.ToString().c_str()); LOG_ERROR("Attempted to cancel connection to %s that does not exist", ADDRESS_TO_LOGGABLE_CSTR(address)); } } Loading Loading @@ -149,7 +150,8 @@ struct AclScheduler::impl { [&]() { cancel_request.Invoke(); }, [](auto entry) { std::get<RemoteNameRequestQueueEntry>(entry).callback_when_cancelled.Invoke(); }); if (!ok) { LOG_ERROR("Attempted to cancel remote name request to %s that does not exist", address.ToString().c_str()); LOG_ERROR("Attempted to cancel remote name request " "to %s that does not exist", ADDRESS_TO_LOGGABLE_CSTR(address)); } }; Loading system/gd/hci/acl_manager/assembler.h +2 −1 Original line number Diff line number Diff line Loading @@ -125,7 +125,8 @@ struct assembler { } } if (incoming_queue_.size() > kMaxQueuedPacketsPerConnection) { LOG_ERROR("Dropping packet from %s due to congestion", address_with_type_.ToString().c_str()); LOG_ERROR("Dropping packet from %s due to congestion", ADDRESS_TO_LOGGABLE_CSTR(address_with_type_)); return; } Loading system/gd/hci/acl_manager/classic_impl.h +12 −6 Original line number Diff line number Diff line Loading @@ -307,7 +307,7 @@ struct classic_impl : public security::ISecurityManagerListener { void actually_create_connection(Address address, std::unique_ptr<CreateConnectionBuilder> packet) { if (is_classic_link_already_connected(address)) { LOG_WARN("already connected: %s", address.ToString().c_str()); LOG_WARN("already connected: %s", ADDRESS_TO_LOGGABLE_CSTR(address)); acl_scheduler_->ReportOutgoingAclConnectionFailure(); } acl_connection_interface_->EnqueueCommand( Loading Loading @@ -373,7 +373,8 @@ struct classic_impl : public security::ISecurityManagerListener { if (delayed_role_change_ == nullptr) { callbacks->OnRoleChange(hci::ErrorCode::SUCCESS, current_role); } else if (delayed_role_change_->GetBdAddr() == address) { LOG_INFO("Sending delayed role change for %s", delayed_role_change_->GetBdAddr().ToString().c_str()); LOG_INFO("Sending delayed role change for %s", ADDRESS_TO_LOGGABLE_CSTR(delayed_role_change_->GetBdAddr())); callbacks->OnRoleChange(delayed_role_change_->GetStatus(), delayed_role_change_->GetNewRole()); delayed_role_change_.reset(); } Loading Loading @@ -431,9 +432,12 @@ struct classic_impl : public security::ISecurityManagerListener { ASSERT_LOG( status == ErrorCode::UNKNOWN_CONNECTION, "No prior connection request for %s expecting:%s", address.ToString().c_str(), ADDRESS_TO_LOGGABLE_CSTR(address), valid_incoming_addresses.c_str()); LOG_WARN("No matching connection to %s (%s)", address.ToString().c_str(), ErrorCodeText(status).c_str()); LOG_WARN( "No matching connection to %s (%s)", ADDRESS_TO_LOGGABLE_CSTR(address), ErrorCodeText(status).c_str()); LOG_WARN("Firmware error after RemoteNameRequestCancel?"); // see b/184239841 if (bluetooth::common::init_flags::gd_remote_name_request_is_enabled()) { ASSERT_LOG( Loading Loading @@ -717,11 +721,13 @@ struct classic_impl : public security::ISecurityManagerListener { }); if (!sent) { if (delayed_role_change_ != nullptr) { LOG_WARN("Second delayed role change (@%s dropped)", delayed_role_change_->GetBdAddr().ToString().c_str()); LOG_WARN( "Second delayed role change (@%s dropped)", ADDRESS_TO_LOGGABLE_CSTR(delayed_role_change_->GetBdAddr())); } LOG_INFO( "Role change for %s with no matching connection (new role: %s)", role_change_view.GetBdAddr().ToString().c_str(), ADDRESS_TO_LOGGABLE_CSTR(role_change_view.GetBdAddr()), RoleText(role_change_view.GetNewRole()).c_str()); delayed_role_change_ = std::make_unique<RoleChangeView>(role_change_view); } Loading system/gd/hci/acl_manager/le_impl.h +13 −12 Original line number Diff line number Diff line Loading @@ -42,8 +42,6 @@ using bluetooth::crypto_toolbox::Octet16; #define PRIVATE_ADDRESS_WITH_TYPE(addr) addr.ToString().substr(12U).c_str() namespace bluetooth { namespace hci { namespace acl_manager { Loading Loading @@ -297,7 +295,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { void on_common_le_connection_complete(AddressWithType address_with_type) { auto connecting_addr_with_type = connecting_le_.find(address_with_type); if (connecting_addr_with_type == connecting_le_.end()) { LOG_WARN("No prior connection request for %s", address_with_type.ToString().c_str()); LOG_WARN("No prior connection request for %s", ADDRESS_TO_LOGGABLE_CSTR(address_with_type)); } connecting_le_.clear(); Loading Loading @@ -327,7 +325,8 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { on_common_le_connection_complete(remote_address); if (status == ErrorCode::UNKNOWN_CONNECTION) { if (remote_address.GetAddress() != Address::kEmpty) { LOG_INFO("Controller send non-empty address field:%s", remote_address.GetAddress().ToString().c_str()); LOG_INFO("Controller send non-empty address field:%s", ADDRESS_TO_LOGGABLE_CSTR(remote_address.GetAddress())); } // direct connect canceled due to connection timeout, start background connect create_le_connection(remote_address, false, false); Loading Loading @@ -379,7 +378,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { if (in_filter_accept_list) { LOG_INFO( "Received incoming connection of device in filter accept_list, %s", PRIVATE_ADDRESS_WITH_TYPE(remote_address)); ADDRESS_TO_LOGGABLE_CSTR(remote_address)); remove_device_from_connect_list(remote_address); if (create_connection_timeout_alarms_.find(remote_address) != create_connection_timeout_alarms_.end()) { create_connection_timeout_alarms_.at(remote_address).Cancel(); Loading Loading @@ -451,7 +450,8 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { on_common_le_connection_complete(remote_address); if (status == ErrorCode::UNKNOWN_CONNECTION) { if (remote_address.GetAddress() != Address::kEmpty) { LOG_INFO("Controller send non-empty address field:%s", remote_address.GetAddress().ToString().c_str()); LOG_INFO("Controller send non-empty address field:%s", ADDRESS_TO_LOGGABLE_CSTR(remote_address.GetAddress())); } // direct connect canceled due to connection timeout, start background connect create_le_connection(remote_address, false, false); Loading Loading @@ -504,7 +504,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { if (in_filter_accept_list) { LOG_INFO( "Received incoming connection of device in filter accept_list, %s", PRIVATE_ADDRESS_WITH_TYPE(remote_address)); ADDRESS_TO_LOGGABLE_CSTR(remote_address)); remove_device_from_connect_list(remote_address); if (create_connection_timeout_alarms_.find(remote_address) != create_connection_timeout_alarms_.end()) { create_connection_timeout_alarms_.at(remote_address).Cancel(); Loading Loading @@ -683,7 +683,8 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { if (connect_list.find(address_with_type) != connect_list.end()) { LOG_WARN( "Device already exists in acceptlist and cannot be added:%s", PRIVATE_ADDRESS_WITH_TYPE(address_with_type)); "Device already exists in acceptlist and cannot be added:%s", ADDRESS_TO_LOGGABLE_CSTR(address_with_type)); return; } Loading @@ -699,7 +700,8 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { void remove_device_from_connect_list(AddressWithType address_with_type) { if (connect_list.find(address_with_type) == connect_list.end()) { LOG_WARN("Device not in acceptlist and cannot be removed:%s", PRIVATE_ADDRESS_WITH_TYPE(address_with_type)); LOG_WARN("Device not in acceptlist and cannot be removed:%s", ADDRESS_TO_LOGGABLE_CSTR(address_with_type)); return; } connect_list.erase(address_with_type); Loading Loading @@ -973,7 +975,8 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { } void on_create_connection_timeout(AddressWithType address_with_type) { LOG_INFO("on_create_connection_timeout, address: %s", address_with_type.ToString().c_str()); LOG_INFO("on_create_connection_timeout, address: %s", ADDRESS_TO_LOGGABLE_CSTR(address_with_type)); if (create_connection_timeout_alarms_.find(address_with_type) != create_connection_timeout_alarms_.end()) { create_connection_timeout_alarms_.at(address_with_type).Cancel(); create_connection_timeout_alarms_.erase(address_with_type); Loading Loading @@ -1193,8 +1196,6 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { std::map<AddressWithType, os::Alarm> create_connection_timeout_alarms_; }; #undef PRIVATE_ADDRESS_WITH_TYPE } // namespace acl_manager } // namespace hci } // namespace bluetooth Loading
system/gd/common/metric_id_manager.cc +7 −3 Original line number Diff line number Diff line Loading @@ -69,9 +69,13 @@ bool MetricIdManager::Init( next_id_ = kMinId; for (const auto& p : paired_device_map) { if (p.second < kMinId || p.second > kMaxId) { LOG_ALWAYS_FATAL("Invalid Bluetooth Metric Id in config. " LOG_ALWAYS_FATAL( "Invalid Bluetooth Metric Id in config. " "Id %d of %s is out of range [%d, %d]", p.second, p.first.ToString().c_str(), kMinId, kMaxId); p.second, ADDRESS_TO_LOGGABLE_CSTR(p.first), kMinId, kMaxId); } auto evicted = paired_device_cache_.insert_or_assign(p.first, p.second); if (evicted) { Loading
system/gd/hci/acl_manager/acl_scheduler.cc +5 −3 Original line number Diff line number Diff line Loading @@ -102,7 +102,8 @@ struct AclScheduler::impl { [&]() { cancel_connection.Invoke(); }, [&](auto entry) { cancel_connection_completed.Invoke(); }); if (!ok) { LOG_ERROR("Attempted to cancel connection to %s that does not exist", address.ToString().c_str()); LOG_ERROR("Attempted to cancel connection to %s that does not exist", ADDRESS_TO_LOGGABLE_CSTR(address)); } } Loading Loading @@ -149,7 +150,8 @@ struct AclScheduler::impl { [&]() { cancel_request.Invoke(); }, [](auto entry) { std::get<RemoteNameRequestQueueEntry>(entry).callback_when_cancelled.Invoke(); }); if (!ok) { LOG_ERROR("Attempted to cancel remote name request to %s that does not exist", address.ToString().c_str()); LOG_ERROR("Attempted to cancel remote name request " "to %s that does not exist", ADDRESS_TO_LOGGABLE_CSTR(address)); } }; Loading
system/gd/hci/acl_manager/assembler.h +2 −1 Original line number Diff line number Diff line Loading @@ -125,7 +125,8 @@ struct assembler { } } if (incoming_queue_.size() > kMaxQueuedPacketsPerConnection) { LOG_ERROR("Dropping packet from %s due to congestion", address_with_type_.ToString().c_str()); LOG_ERROR("Dropping packet from %s due to congestion", ADDRESS_TO_LOGGABLE_CSTR(address_with_type_)); return; } Loading
system/gd/hci/acl_manager/classic_impl.h +12 −6 Original line number Diff line number Diff line Loading @@ -307,7 +307,7 @@ struct classic_impl : public security::ISecurityManagerListener { void actually_create_connection(Address address, std::unique_ptr<CreateConnectionBuilder> packet) { if (is_classic_link_already_connected(address)) { LOG_WARN("already connected: %s", address.ToString().c_str()); LOG_WARN("already connected: %s", ADDRESS_TO_LOGGABLE_CSTR(address)); acl_scheduler_->ReportOutgoingAclConnectionFailure(); } acl_connection_interface_->EnqueueCommand( Loading Loading @@ -373,7 +373,8 @@ struct classic_impl : public security::ISecurityManagerListener { if (delayed_role_change_ == nullptr) { callbacks->OnRoleChange(hci::ErrorCode::SUCCESS, current_role); } else if (delayed_role_change_->GetBdAddr() == address) { LOG_INFO("Sending delayed role change for %s", delayed_role_change_->GetBdAddr().ToString().c_str()); LOG_INFO("Sending delayed role change for %s", ADDRESS_TO_LOGGABLE_CSTR(delayed_role_change_->GetBdAddr())); callbacks->OnRoleChange(delayed_role_change_->GetStatus(), delayed_role_change_->GetNewRole()); delayed_role_change_.reset(); } Loading Loading @@ -431,9 +432,12 @@ struct classic_impl : public security::ISecurityManagerListener { ASSERT_LOG( status == ErrorCode::UNKNOWN_CONNECTION, "No prior connection request for %s expecting:%s", address.ToString().c_str(), ADDRESS_TO_LOGGABLE_CSTR(address), valid_incoming_addresses.c_str()); LOG_WARN("No matching connection to %s (%s)", address.ToString().c_str(), ErrorCodeText(status).c_str()); LOG_WARN( "No matching connection to %s (%s)", ADDRESS_TO_LOGGABLE_CSTR(address), ErrorCodeText(status).c_str()); LOG_WARN("Firmware error after RemoteNameRequestCancel?"); // see b/184239841 if (bluetooth::common::init_flags::gd_remote_name_request_is_enabled()) { ASSERT_LOG( Loading Loading @@ -717,11 +721,13 @@ struct classic_impl : public security::ISecurityManagerListener { }); if (!sent) { if (delayed_role_change_ != nullptr) { LOG_WARN("Second delayed role change (@%s dropped)", delayed_role_change_->GetBdAddr().ToString().c_str()); LOG_WARN( "Second delayed role change (@%s dropped)", ADDRESS_TO_LOGGABLE_CSTR(delayed_role_change_->GetBdAddr())); } LOG_INFO( "Role change for %s with no matching connection (new role: %s)", role_change_view.GetBdAddr().ToString().c_str(), ADDRESS_TO_LOGGABLE_CSTR(role_change_view.GetBdAddr()), RoleText(role_change_view.GetNewRole()).c_str()); delayed_role_change_ = std::make_unique<RoleChangeView>(role_change_view); } Loading
system/gd/hci/acl_manager/le_impl.h +13 −12 Original line number Diff line number Diff line Loading @@ -42,8 +42,6 @@ using bluetooth::crypto_toolbox::Octet16; #define PRIVATE_ADDRESS_WITH_TYPE(addr) addr.ToString().substr(12U).c_str() namespace bluetooth { namespace hci { namespace acl_manager { Loading Loading @@ -297,7 +295,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { void on_common_le_connection_complete(AddressWithType address_with_type) { auto connecting_addr_with_type = connecting_le_.find(address_with_type); if (connecting_addr_with_type == connecting_le_.end()) { LOG_WARN("No prior connection request for %s", address_with_type.ToString().c_str()); LOG_WARN("No prior connection request for %s", ADDRESS_TO_LOGGABLE_CSTR(address_with_type)); } connecting_le_.clear(); Loading Loading @@ -327,7 +325,8 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { on_common_le_connection_complete(remote_address); if (status == ErrorCode::UNKNOWN_CONNECTION) { if (remote_address.GetAddress() != Address::kEmpty) { LOG_INFO("Controller send non-empty address field:%s", remote_address.GetAddress().ToString().c_str()); LOG_INFO("Controller send non-empty address field:%s", ADDRESS_TO_LOGGABLE_CSTR(remote_address.GetAddress())); } // direct connect canceled due to connection timeout, start background connect create_le_connection(remote_address, false, false); Loading Loading @@ -379,7 +378,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { if (in_filter_accept_list) { LOG_INFO( "Received incoming connection of device in filter accept_list, %s", PRIVATE_ADDRESS_WITH_TYPE(remote_address)); ADDRESS_TO_LOGGABLE_CSTR(remote_address)); remove_device_from_connect_list(remote_address); if (create_connection_timeout_alarms_.find(remote_address) != create_connection_timeout_alarms_.end()) { create_connection_timeout_alarms_.at(remote_address).Cancel(); Loading Loading @@ -451,7 +450,8 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { on_common_le_connection_complete(remote_address); if (status == ErrorCode::UNKNOWN_CONNECTION) { if (remote_address.GetAddress() != Address::kEmpty) { LOG_INFO("Controller send non-empty address field:%s", remote_address.GetAddress().ToString().c_str()); LOG_INFO("Controller send non-empty address field:%s", ADDRESS_TO_LOGGABLE_CSTR(remote_address.GetAddress())); } // direct connect canceled due to connection timeout, start background connect create_le_connection(remote_address, false, false); Loading Loading @@ -504,7 +504,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { if (in_filter_accept_list) { LOG_INFO( "Received incoming connection of device in filter accept_list, %s", PRIVATE_ADDRESS_WITH_TYPE(remote_address)); ADDRESS_TO_LOGGABLE_CSTR(remote_address)); remove_device_from_connect_list(remote_address); if (create_connection_timeout_alarms_.find(remote_address) != create_connection_timeout_alarms_.end()) { create_connection_timeout_alarms_.at(remote_address).Cancel(); Loading Loading @@ -683,7 +683,8 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { if (connect_list.find(address_with_type) != connect_list.end()) { LOG_WARN( "Device already exists in acceptlist and cannot be added:%s", PRIVATE_ADDRESS_WITH_TYPE(address_with_type)); "Device already exists in acceptlist and cannot be added:%s", ADDRESS_TO_LOGGABLE_CSTR(address_with_type)); return; } Loading @@ -699,7 +700,8 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { void remove_device_from_connect_list(AddressWithType address_with_type) { if (connect_list.find(address_with_type) == connect_list.end()) { LOG_WARN("Device not in acceptlist and cannot be removed:%s", PRIVATE_ADDRESS_WITH_TYPE(address_with_type)); LOG_WARN("Device not in acceptlist and cannot be removed:%s", ADDRESS_TO_LOGGABLE_CSTR(address_with_type)); return; } connect_list.erase(address_with_type); Loading Loading @@ -973,7 +975,8 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { } void on_create_connection_timeout(AddressWithType address_with_type) { LOG_INFO("on_create_connection_timeout, address: %s", address_with_type.ToString().c_str()); LOG_INFO("on_create_connection_timeout, address: %s", ADDRESS_TO_LOGGABLE_CSTR(address_with_type)); if (create_connection_timeout_alarms_.find(address_with_type) != create_connection_timeout_alarms_.end()) { create_connection_timeout_alarms_.at(address_with_type).Cancel(); create_connection_timeout_alarms_.erase(address_with_type); Loading Loading @@ -1193,8 +1196,6 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { std::map<AddressWithType, os::Alarm> create_connection_timeout_alarms_; }; #undef PRIVATE_ADDRESS_WITH_TYPE } // namespace acl_manager } // namespace hci } // namespace bluetooth