Loading system/gd/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -609,6 +609,7 @@ cc_defaults { "libcrypto", "libgrpc++", "libgrpc_wrap", "liblog", "server_configurable_flags", ], cflags: [ Loading Loading @@ -680,9 +681,12 @@ cc_benchmark { "benchmark.cc", ], static_libs: [ "libbase", "libbluetooth_gd", "libbluetooth_log", "libbt_shim_bridge", "libchrome", "liblog", ], } Loading system/gd/l2cap/classic/facade.cc +10 −8 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #include "l2cap/classic/facade.h" #include <bluetooth/log.h> #include <condition_variable> #include <cstdint> #include <unordered_map> Loading Loading @@ -186,7 +188,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service ASSERT(hci::Address::FromString(request->address(), peer)); auto entry = security_link_map_.find(peer); if (entry == security_link_map_.end()) { LOG_WARN("Unknown address '%s'", ADDRESS_TO_LOGGABLE_CSTR(peer)); log::warn("Unknown address '{}'", ADDRESS_TO_LOGGABLE_CSTR(peer)); } else { entry->second->Hold(); } Loading @@ -201,7 +203,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service ASSERT(hci::Address::FromString(request->address(), peer)); auto entry = security_link_map_.find(peer); if (entry == security_link_map_.end()) { LOG_WARN("Unknown address '%s'", ADDRESS_TO_LOGGABLE_CSTR(peer)); log::warn("Unknown address '{}'", ADDRESS_TO_LOGGABLE_CSTR(peer)); } else { entry->second->EnsureAuthenticated(); } Loading @@ -217,7 +219,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service outgoing_pairing_remote_devices_.erase(peer); auto entry = security_link_map_.find(peer); if (entry == security_link_map_.end()) { LOG_WARN("Unknown address '%s'", ADDRESS_TO_LOGGABLE_CSTR(peer)); log::warn("Unknown address '{}'", ADDRESS_TO_LOGGABLE_CSTR(peer)); } else { entry->second->Release(); } Loading @@ -233,7 +235,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service outgoing_pairing_remote_devices_.erase(peer); auto entry = security_link_map_.find(peer); if (entry == security_link_map_.end()) { LOG_WARN("Unknown address '%s'", ADDRESS_TO_LOGGABLE_CSTR(peer)); log::warn("Unknown address '{}'", ADDRESS_TO_LOGGABLE_CSTR(peer)); } else { entry->second->Disconnect(); } Loading @@ -255,7 +257,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service void OnLinkDisconnected(hci::Address remote) override { auto entry = security_link_map_.find(remote); if (entry == security_link_map_.end()) { LOG_WARN("Unknown address '%s'", ADDRESS_TO_LOGGABLE_CSTR(remote)); log::warn("Unknown address '{}'", ADDRESS_TO_LOGGABLE_CSTR(remote)); return; } entry->second.reset(); Loading Loading @@ -315,7 +317,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service handler_->BindOnceOn(this, &L2capDynamicChannelHelper::on_connect_fail)); std::unique_lock<std::mutex> lock(channel_open_cv_mutex_); if (!channel_open_cv_.wait_for(lock, std::chrono::seconds(2), [this] { return channel_ != nullptr; })) { LOG_WARN("Channel is not open for psm %d", psm_); log::warn("Channel is not open for psm {}", psm_); } } Loading @@ -323,7 +325,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service if (channel_ == nullptr) { std::unique_lock<std::mutex> lock(channel_open_cv_mutex_); if (!channel_open_cv_.wait_for(lock, std::chrono::seconds(2), [this] { return channel_ != nullptr; })) { LOG_WARN("Channel is not open for psm %d", psm_); log::warn("Channel is not open for psm {}", psm_); return; } } Loading Loading @@ -397,7 +399,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service if (channel_ == nullptr) { std::unique_lock<std::mutex> lock(channel_open_cv_mutex_); if (!channel_open_cv_.wait_for(lock, std::chrono::seconds(2), [this] { return channel_ != nullptr; })) { LOG_WARN("Channel is not open"); log::warn("Channel is not open"); return false; } } Loading system/gd/l2cap/classic/internal/dynamic_channel_service_manager_impl.cc +4 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ #include "l2cap/classic/internal/dynamic_channel_service_manager_impl.h" #include <bluetooth/log.h> #include "common/bind.h" #include "l2cap/classic/internal/dynamic_channel_service_impl.h" #include "l2cap/psm.h" Loading Loading @@ -53,7 +56,7 @@ void DynamicChannelServiceManagerImpl::Unregister(Psm psm, DynamicChannelService service_map_.erase(psm); callback.Invoke(); } else { LOG_ERROR("service not registered psm:%d", psm); log::error("service not registered psm:{}", psm); } } Loading system/gd/l2cap/classic/internal/fixed_channel_impl.cc +8 −5 Original line number Diff line number Diff line Loading @@ -14,10 +14,13 @@ * limitations under the License. */ #include "l2cap/classic/internal/fixed_channel_impl.h" #include <bluetooth/log.h> #include <unordered_map> #include "l2cap/cid.h" #include "l2cap/classic/internal/fixed_channel_impl.h" #include "l2cap/classic/internal/link.h" #include "os/handler.h" #include "os/log.h" Loading Loading @@ -71,12 +74,12 @@ void FixedChannelImpl::OnClosed(hci::ErrorCode status) { void FixedChannelImpl::Acquire() { ASSERT_LOG(user_handler_ != nullptr, "Must register OnCloseCallback before calling any methods"); if (closed_) { LOG_WARN("%s is already closed", ToLoggableStr(*this).c_str()); log::warn("{} is already closed", ToLoggableStr(*this)); ASSERT(!acquired_); return; } if (acquired_) { LOG_INFO("%s was already acquired", ToLoggableStr(*this).c_str()); log::info("{} was already acquired", ToLoggableStr(*this)); return; } acquired_ = true; Loading @@ -86,12 +89,12 @@ void FixedChannelImpl::Acquire() { void FixedChannelImpl::Release() { ASSERT_LOG(user_handler_ != nullptr, "Must register OnCloseCallback before calling any methods"); if (closed_) { LOG_WARN("%s is already closed", ToLoggableStr(*this).c_str()); log::warn("{} is already closed", ToLoggableStr(*this)); ASSERT(!acquired_); return; } if (!acquired_) { LOG_INFO("%s was already released", ToLoggableStr(*this).c_str()); log::info("{} was already released", ToLoggableStr(*this)); return; } acquired_ = false; Loading system/gd/l2cap/classic/internal/fixed_channel_service_manager_impl.cc +4 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #include "l2cap/classic/internal/fixed_channel_service_manager_impl.h" #include <bluetooth/log.h> #include "common/bind.h" #include "l2cap/cid.h" #include "l2cap/classic/internal/fixed_channel_service_impl.h" Loading Loading @@ -55,7 +57,7 @@ void FixedChannelServiceManagerImpl::Unregister(Cid cid, FixedChannelService::On service_map_.erase(cid); handler->Post(std::move(callback)); } else { LOG_ERROR("service not registered cid:%d", cid); log::error("service not registered cid:{}", cid); } } Loading Loading @@ -95,7 +97,7 @@ uint64_t FixedChannelServiceManagerImpl::GetSupportedFixedChannelMask() { result |= kBrEdrSecurityManager; continue; default: LOG_WARN("Unknown fixed channel is registered: 0x%x", cid); log::warn("Unknown fixed channel is registered: 0x{:x}", cid); continue; } } Loading Loading
system/gd/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -609,6 +609,7 @@ cc_defaults { "libcrypto", "libgrpc++", "libgrpc_wrap", "liblog", "server_configurable_flags", ], cflags: [ Loading Loading @@ -680,9 +681,12 @@ cc_benchmark { "benchmark.cc", ], static_libs: [ "libbase", "libbluetooth_gd", "libbluetooth_log", "libbt_shim_bridge", "libchrome", "liblog", ], } Loading
system/gd/l2cap/classic/facade.cc +10 −8 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #include "l2cap/classic/facade.h" #include <bluetooth/log.h> #include <condition_variable> #include <cstdint> #include <unordered_map> Loading Loading @@ -186,7 +188,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service ASSERT(hci::Address::FromString(request->address(), peer)); auto entry = security_link_map_.find(peer); if (entry == security_link_map_.end()) { LOG_WARN("Unknown address '%s'", ADDRESS_TO_LOGGABLE_CSTR(peer)); log::warn("Unknown address '{}'", ADDRESS_TO_LOGGABLE_CSTR(peer)); } else { entry->second->Hold(); } Loading @@ -201,7 +203,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service ASSERT(hci::Address::FromString(request->address(), peer)); auto entry = security_link_map_.find(peer); if (entry == security_link_map_.end()) { LOG_WARN("Unknown address '%s'", ADDRESS_TO_LOGGABLE_CSTR(peer)); log::warn("Unknown address '{}'", ADDRESS_TO_LOGGABLE_CSTR(peer)); } else { entry->second->EnsureAuthenticated(); } Loading @@ -217,7 +219,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service outgoing_pairing_remote_devices_.erase(peer); auto entry = security_link_map_.find(peer); if (entry == security_link_map_.end()) { LOG_WARN("Unknown address '%s'", ADDRESS_TO_LOGGABLE_CSTR(peer)); log::warn("Unknown address '{}'", ADDRESS_TO_LOGGABLE_CSTR(peer)); } else { entry->second->Release(); } Loading @@ -233,7 +235,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service outgoing_pairing_remote_devices_.erase(peer); auto entry = security_link_map_.find(peer); if (entry == security_link_map_.end()) { LOG_WARN("Unknown address '%s'", ADDRESS_TO_LOGGABLE_CSTR(peer)); log::warn("Unknown address '{}'", ADDRESS_TO_LOGGABLE_CSTR(peer)); } else { entry->second->Disconnect(); } Loading @@ -255,7 +257,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service void OnLinkDisconnected(hci::Address remote) override { auto entry = security_link_map_.find(remote); if (entry == security_link_map_.end()) { LOG_WARN("Unknown address '%s'", ADDRESS_TO_LOGGABLE_CSTR(remote)); log::warn("Unknown address '{}'", ADDRESS_TO_LOGGABLE_CSTR(remote)); return; } entry->second.reset(); Loading Loading @@ -315,7 +317,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service handler_->BindOnceOn(this, &L2capDynamicChannelHelper::on_connect_fail)); std::unique_lock<std::mutex> lock(channel_open_cv_mutex_); if (!channel_open_cv_.wait_for(lock, std::chrono::seconds(2), [this] { return channel_ != nullptr; })) { LOG_WARN("Channel is not open for psm %d", psm_); log::warn("Channel is not open for psm {}", psm_); } } Loading @@ -323,7 +325,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service if (channel_ == nullptr) { std::unique_lock<std::mutex> lock(channel_open_cv_mutex_); if (!channel_open_cv_.wait_for(lock, std::chrono::seconds(2), [this] { return channel_ != nullptr; })) { LOG_WARN("Channel is not open for psm %d", psm_); log::warn("Channel is not open for psm {}", psm_); return; } } Loading Loading @@ -397,7 +399,7 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service if (channel_ == nullptr) { std::unique_lock<std::mutex> lock(channel_open_cv_mutex_); if (!channel_open_cv_.wait_for(lock, std::chrono::seconds(2), [this] { return channel_ != nullptr; })) { LOG_WARN("Channel is not open"); log::warn("Channel is not open"); return false; } } Loading
system/gd/l2cap/classic/internal/dynamic_channel_service_manager_impl.cc +4 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ #include "l2cap/classic/internal/dynamic_channel_service_manager_impl.h" #include <bluetooth/log.h> #include "common/bind.h" #include "l2cap/classic/internal/dynamic_channel_service_impl.h" #include "l2cap/psm.h" Loading Loading @@ -53,7 +56,7 @@ void DynamicChannelServiceManagerImpl::Unregister(Psm psm, DynamicChannelService service_map_.erase(psm); callback.Invoke(); } else { LOG_ERROR("service not registered psm:%d", psm); log::error("service not registered psm:{}", psm); } } Loading
system/gd/l2cap/classic/internal/fixed_channel_impl.cc +8 −5 Original line number Diff line number Diff line Loading @@ -14,10 +14,13 @@ * limitations under the License. */ #include "l2cap/classic/internal/fixed_channel_impl.h" #include <bluetooth/log.h> #include <unordered_map> #include "l2cap/cid.h" #include "l2cap/classic/internal/fixed_channel_impl.h" #include "l2cap/classic/internal/link.h" #include "os/handler.h" #include "os/log.h" Loading Loading @@ -71,12 +74,12 @@ void FixedChannelImpl::OnClosed(hci::ErrorCode status) { void FixedChannelImpl::Acquire() { ASSERT_LOG(user_handler_ != nullptr, "Must register OnCloseCallback before calling any methods"); if (closed_) { LOG_WARN("%s is already closed", ToLoggableStr(*this).c_str()); log::warn("{} is already closed", ToLoggableStr(*this)); ASSERT(!acquired_); return; } if (acquired_) { LOG_INFO("%s was already acquired", ToLoggableStr(*this).c_str()); log::info("{} was already acquired", ToLoggableStr(*this)); return; } acquired_ = true; Loading @@ -86,12 +89,12 @@ void FixedChannelImpl::Acquire() { void FixedChannelImpl::Release() { ASSERT_LOG(user_handler_ != nullptr, "Must register OnCloseCallback before calling any methods"); if (closed_) { LOG_WARN("%s is already closed", ToLoggableStr(*this).c_str()); log::warn("{} is already closed", ToLoggableStr(*this)); ASSERT(!acquired_); return; } if (!acquired_) { LOG_INFO("%s was already released", ToLoggableStr(*this).c_str()); log::info("{} was already released", ToLoggableStr(*this)); return; } acquired_ = false; Loading
system/gd/l2cap/classic/internal/fixed_channel_service_manager_impl.cc +4 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #include "l2cap/classic/internal/fixed_channel_service_manager_impl.h" #include <bluetooth/log.h> #include "common/bind.h" #include "l2cap/cid.h" #include "l2cap/classic/internal/fixed_channel_service_impl.h" Loading Loading @@ -55,7 +57,7 @@ void FixedChannelServiceManagerImpl::Unregister(Cid cid, FixedChannelService::On service_map_.erase(cid); handler->Post(std::move(callback)); } else { LOG_ERROR("service not registered cid:%d", cid); log::error("service not registered cid:{}", cid); } } Loading Loading @@ -95,7 +97,7 @@ uint64_t FixedChannelServiceManagerImpl::GetSupportedFixedChannelMask() { result |= kBrEdrSecurityManager; continue; default: LOG_WARN("Unknown fixed channel is registered: 0x%x", cid); log::warn("Unknown fixed channel is registered: 0x{:x}", cid); continue; } } Loading