Loading system/main/shim/acl_api.cc +2 −0 Original line number Diff line number Diff line Loading @@ -18,12 +18,14 @@ #include <android_bluetooth_sysprop.h> #include <base/location.h> #include <cstdint> #include <future> #include <optional> #include "hci/acl_manager.h" #include "hci/remote_name_request.h" #include "main/shim/acl.h" #include "main/shim/entry.h" #include "main/shim/helpers.h" #include "main/shim/stack.h" Loading system/main/shim/btm_api.cc +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include "hci/controller.h" #include "hci/controller_interface.h" #include "main/shim/acl.h" #include "main/shim/btm.h" #include "main/shim/entry.h" #include "main/shim/helpers.h" Loading system/main/shim/stack.cc +18 −11 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ #include "hci/msft.h" #include "hci/remote_name_request.h" #include "hci/vendor_specific_event_manager.h" #include "main/shim/acl.h" #include "main/shim/acl_legacy_interface.h" #include "main/shim/distance_measurement_manager.h" #include "main/shim/entry.h" Loading @@ -57,6 +58,12 @@ namespace shim { using ::bluetooth::common::InitFlags; using ::bluetooth::common::StringFormat; struct Stack::impl { legacy::Acl* acl_ = nullptr; }; Stack::Stack() { pimpl_ = std::make_shared<Stack::impl>(); } Stack* Stack::GetInstance() { static Stack instance; return &instance; Loading Loading @@ -90,7 +97,7 @@ void Stack::StartEverything() { ASSERT(stack_manager_.GetInstance<storage::StorageModule>() != nullptr); ASSERT(stack_manager_.GetInstance<shim::Dumpsys>() != nullptr); if (stack_manager_.IsStarted<hci::Controller>()) { acl_ = new legacy::Acl(stack_handler_, legacy::GetAclInterface(), pimpl_->acl_ = new legacy::Acl(stack_handler_, legacy::GetAclInterface(), GetController()->GetLeFilterAcceptListSize(), GetController()->GetLeResolvingListSize()); } else { Loading Loading @@ -135,10 +142,10 @@ void Stack::Stop() { bluetooth::shim::hci_on_shutting_down(); // Make sure gd acl flag is enabled and we started it up if (acl_ != nullptr) { acl_->FinalShutdown(); delete acl_; acl_ = nullptr; if (pimpl_->acl_ != nullptr) { pimpl_->acl_->FinalShutdown(); delete pimpl_->acl_; pimpl_->acl_ = nullptr; } ASSERT_LOG(is_running_, "%s Gd stack not running", __func__); Loading Loading @@ -181,15 +188,15 @@ const StackManager* Stack::GetStackManager() const { legacy::Acl* Stack::GetAcl() { std::lock_guard<std::recursive_mutex> lock(mutex_); ASSERT(is_running_); ASSERT_LOG(acl_ != nullptr, "Acl shim layer has not been created"); return acl_; ASSERT_LOG(pimpl_->acl_ != nullptr, "Acl shim layer has not been created"); return pimpl_->acl_; } LinkPolicyInterface* Stack::LinkPolicy() { std::lock_guard<std::recursive_mutex> lock(mutex_); ASSERT(is_running_); ASSERT_LOG(acl_ != nullptr, "Acl shim layer has not been created"); return acl_; ASSERT_LOG(pimpl_->acl_ != nullptr, "Acl shim layer has not been created"); return pimpl_->acl_; } Btm* Stack::GetBtm() { Loading system/main/shim/stack.h +7 −3 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ #include <functional> #include <mutex> #include "main/shim/acl.h" #include "main/shim/btm.h" #include "main/shim/link_policy_interface.h" #include "module.h" Loading @@ -30,13 +29,16 @@ // The shim layer implementation on the Gd stack side. namespace bluetooth { namespace shim { namespace legacy { class Acl; }; // namespace legacy // GD shim stack, having modes corresponding to legacy stack class Stack { public: static Stack* GetInstance(); Stack() = default; Stack(); Stack(const Stack&) = delete; Stack& operator=(const Stack&) = delete; Loading Loading @@ -77,12 +79,14 @@ class Stack { size_t NumModules() const { return num_modules_; } private: struct impl; std::shared_ptr<impl> pimpl_; mutable std::recursive_mutex mutex_; StackManager stack_manager_; bool is_running_ = false; os::Thread* stack_thread_ = nullptr; os::Handler* stack_handler_ = nullptr; legacy::Acl* acl_ = nullptr; Btm* btm_ = nullptr; size_t num_modules_{0}; void Start(ModuleList* modules); Loading Loading
system/main/shim/acl_api.cc +2 −0 Original line number Diff line number Diff line Loading @@ -18,12 +18,14 @@ #include <android_bluetooth_sysprop.h> #include <base/location.h> #include <cstdint> #include <future> #include <optional> #include "hci/acl_manager.h" #include "hci/remote_name_request.h" #include "main/shim/acl.h" #include "main/shim/entry.h" #include "main/shim/helpers.h" #include "main/shim/stack.h" Loading
system/main/shim/btm_api.cc +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include "hci/controller.h" #include "hci/controller_interface.h" #include "main/shim/acl.h" #include "main/shim/btm.h" #include "main/shim/entry.h" #include "main/shim/helpers.h" Loading
system/main/shim/stack.cc +18 −11 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ #include "hci/msft.h" #include "hci/remote_name_request.h" #include "hci/vendor_specific_event_manager.h" #include "main/shim/acl.h" #include "main/shim/acl_legacy_interface.h" #include "main/shim/distance_measurement_manager.h" #include "main/shim/entry.h" Loading @@ -57,6 +58,12 @@ namespace shim { using ::bluetooth::common::InitFlags; using ::bluetooth::common::StringFormat; struct Stack::impl { legacy::Acl* acl_ = nullptr; }; Stack::Stack() { pimpl_ = std::make_shared<Stack::impl>(); } Stack* Stack::GetInstance() { static Stack instance; return &instance; Loading Loading @@ -90,7 +97,7 @@ void Stack::StartEverything() { ASSERT(stack_manager_.GetInstance<storage::StorageModule>() != nullptr); ASSERT(stack_manager_.GetInstance<shim::Dumpsys>() != nullptr); if (stack_manager_.IsStarted<hci::Controller>()) { acl_ = new legacy::Acl(stack_handler_, legacy::GetAclInterface(), pimpl_->acl_ = new legacy::Acl(stack_handler_, legacy::GetAclInterface(), GetController()->GetLeFilterAcceptListSize(), GetController()->GetLeResolvingListSize()); } else { Loading Loading @@ -135,10 +142,10 @@ void Stack::Stop() { bluetooth::shim::hci_on_shutting_down(); // Make sure gd acl flag is enabled and we started it up if (acl_ != nullptr) { acl_->FinalShutdown(); delete acl_; acl_ = nullptr; if (pimpl_->acl_ != nullptr) { pimpl_->acl_->FinalShutdown(); delete pimpl_->acl_; pimpl_->acl_ = nullptr; } ASSERT_LOG(is_running_, "%s Gd stack not running", __func__); Loading Loading @@ -181,15 +188,15 @@ const StackManager* Stack::GetStackManager() const { legacy::Acl* Stack::GetAcl() { std::lock_guard<std::recursive_mutex> lock(mutex_); ASSERT(is_running_); ASSERT_LOG(acl_ != nullptr, "Acl shim layer has not been created"); return acl_; ASSERT_LOG(pimpl_->acl_ != nullptr, "Acl shim layer has not been created"); return pimpl_->acl_; } LinkPolicyInterface* Stack::LinkPolicy() { std::lock_guard<std::recursive_mutex> lock(mutex_); ASSERT(is_running_); ASSERT_LOG(acl_ != nullptr, "Acl shim layer has not been created"); return acl_; ASSERT_LOG(pimpl_->acl_ != nullptr, "Acl shim layer has not been created"); return pimpl_->acl_; } Btm* Stack::GetBtm() { Loading
system/main/shim/stack.h +7 −3 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ #include <functional> #include <mutex> #include "main/shim/acl.h" #include "main/shim/btm.h" #include "main/shim/link_policy_interface.h" #include "module.h" Loading @@ -30,13 +29,16 @@ // The shim layer implementation on the Gd stack side. namespace bluetooth { namespace shim { namespace legacy { class Acl; }; // namespace legacy // GD shim stack, having modes corresponding to legacy stack class Stack { public: static Stack* GetInstance(); Stack() = default; Stack(); Stack(const Stack&) = delete; Stack& operator=(const Stack&) = delete; Loading Loading @@ -77,12 +79,14 @@ class Stack { size_t NumModules() const { return num_modules_; } private: struct impl; std::shared_ptr<impl> pimpl_; mutable std::recursive_mutex mutex_; StackManager stack_manager_; bool is_running_ = false; os::Thread* stack_thread_ = nullptr; os::Handler* stack_handler_ = nullptr; legacy::Acl* acl_ = nullptr; Btm* btm_ = nullptr; size_t num_modules_{0}; void Start(ModuleList* modules); Loading