Loading system/gd/hci/acl_manager.h +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ class AclConnection { using Queue = common::BidiQueue<PacketView<kLittleEndian>, BasePacketBuilder>; using QueueUpEnd = common::BidiQueueEnd<BasePacketBuilder, PacketView<kLittleEndian>>; using QueueDownEnd = common::BidiQueueEnd<PacketView<kLittleEndian>, BasePacketBuilder>; QueueUpEnd* GetAclQueueEnd() const; virtual QueueUpEnd* GetAclQueueEnd() const; virtual void RegisterDisconnectCallback(common::OnceCallback<void(ErrorCode)> on_disconnect, os::Handler* handler); virtual bool Disconnect(DisconnectReason reason); // Ask AclManager to clean me up. Must invoke after on_disconnect is called Loading system/gd/hci/acl_manager_mock.h +1 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ class MockAclConnection : public AclConnection { (common::OnceCallback<void(ErrorCode)> on_disconnect, os::Handler* handler), (override)); MOCK_METHOD(bool, Disconnect, (DisconnectReason reason), (override)); MOCK_METHOD(void, Finish, (), (override)); MOCK_METHOD(QueueUpEnd*, GetAclQueueEnd, (), (const, override)); }; class MockAclManager : public AclManager { Loading system/gd/l2cap/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ filegroup { "internal/classic_fixed_channel_service_manager_impl.cc", "internal/classic_fixed_channel_allocator.cc", "internal/classic_link_manager.cc", "internal/scheduler_fifo.cc", ], } Loading @@ -19,6 +20,7 @@ filegroup { "internal/classic_fixed_channel_service_manager_test.cc", "internal/classic_fixed_channel_allocator_test.cc", "internal/classic_link_manager_test.cc", "internal/scheduler_fifo_test.cc", "signal_id_test.cc", ], } Loading system/gd/l2cap/internal/classic_link_manager.cc +7 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ #include "hci/acl_manager.h" #include "l2cap/internal/classic_link.h" #include "l2cap/internal/scheduler.h" #include "l2cap/internal/scheduler_fifo.h" #include "l2cap/l2cap_layer.h" #include "os/handler.h" #include "os/log.h" Loading Loading @@ -94,7 +94,8 @@ void ClassicLinkManager::OnConnectSuccess(std::unique_ptr<hci::AclConnection> ac common::Address address = acl_connection->GetAddress(); ASSERT_LOG(GetLink(address) == nullptr, "%s is connected twice without disconnection", acl_connection->GetAddress().ToString().c_str()); links_.try_emplace(address, handler_, std::move(acl_connection), std::make_unique<Scheduler>()); auto* link_queue_up_end = acl_connection->GetAclQueueEnd(); links_.try_emplace(address, handler_, std::move(acl_connection), std::make_unique<Fifo>(link_queue_up_end, handler_)); auto* link = GetLink(address); // Allocate and distribute channels for all registered fixed channel services auto fixed_channel_services = service_manager_->GetRegisteredServices(); Loading Loading @@ -131,6 +132,10 @@ void ClassicLinkManager::OnConnectFail(common::Address device, hci::ErrorCode re pending_links_.erase(pending_link); } void ClassicLinkManager::OnDisconnect(common::Address device, hci::ErrorCode status) { links_.erase(device); } } // namespace internal } // namespace l2cap } // namespace bluetooth No newline at end of file system/gd/l2cap/internal/classic_link_manager.h +1 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ class ClassicLinkManager : public hci::ConnectionCallbacks { ClassicLink* GetLink(common::Address device); void OnConnectSuccess(std::unique_ptr<hci::AclConnection> acl_connection) override; void OnConnectFail(common::Address device, hci::ErrorCode reason) override; void OnDisconnect(common::Address device, hci::ErrorCode status); private: // Dependencies Loading Loading
system/gd/hci/acl_manager.h +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ class AclConnection { using Queue = common::BidiQueue<PacketView<kLittleEndian>, BasePacketBuilder>; using QueueUpEnd = common::BidiQueueEnd<BasePacketBuilder, PacketView<kLittleEndian>>; using QueueDownEnd = common::BidiQueueEnd<PacketView<kLittleEndian>, BasePacketBuilder>; QueueUpEnd* GetAclQueueEnd() const; virtual QueueUpEnd* GetAclQueueEnd() const; virtual void RegisterDisconnectCallback(common::OnceCallback<void(ErrorCode)> on_disconnect, os::Handler* handler); virtual bool Disconnect(DisconnectReason reason); // Ask AclManager to clean me up. Must invoke after on_disconnect is called Loading
system/gd/hci/acl_manager_mock.h +1 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ class MockAclConnection : public AclConnection { (common::OnceCallback<void(ErrorCode)> on_disconnect, os::Handler* handler), (override)); MOCK_METHOD(bool, Disconnect, (DisconnectReason reason), (override)); MOCK_METHOD(void, Finish, (), (override)); MOCK_METHOD(QueueUpEnd*, GetAclQueueEnd, (), (const, override)); }; class MockAclManager : public AclManager { Loading
system/gd/l2cap/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ filegroup { "internal/classic_fixed_channel_service_manager_impl.cc", "internal/classic_fixed_channel_allocator.cc", "internal/classic_link_manager.cc", "internal/scheduler_fifo.cc", ], } Loading @@ -19,6 +20,7 @@ filegroup { "internal/classic_fixed_channel_service_manager_test.cc", "internal/classic_fixed_channel_allocator_test.cc", "internal/classic_link_manager_test.cc", "internal/scheduler_fifo_test.cc", "signal_id_test.cc", ], } Loading
system/gd/l2cap/internal/classic_link_manager.cc +7 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ #include "hci/acl_manager.h" #include "l2cap/internal/classic_link.h" #include "l2cap/internal/scheduler.h" #include "l2cap/internal/scheduler_fifo.h" #include "l2cap/l2cap_layer.h" #include "os/handler.h" #include "os/log.h" Loading Loading @@ -94,7 +94,8 @@ void ClassicLinkManager::OnConnectSuccess(std::unique_ptr<hci::AclConnection> ac common::Address address = acl_connection->GetAddress(); ASSERT_LOG(GetLink(address) == nullptr, "%s is connected twice without disconnection", acl_connection->GetAddress().ToString().c_str()); links_.try_emplace(address, handler_, std::move(acl_connection), std::make_unique<Scheduler>()); auto* link_queue_up_end = acl_connection->GetAclQueueEnd(); links_.try_emplace(address, handler_, std::move(acl_connection), std::make_unique<Fifo>(link_queue_up_end, handler_)); auto* link = GetLink(address); // Allocate and distribute channels for all registered fixed channel services auto fixed_channel_services = service_manager_->GetRegisteredServices(); Loading Loading @@ -131,6 +132,10 @@ void ClassicLinkManager::OnConnectFail(common::Address device, hci::ErrorCode re pending_links_.erase(pending_link); } void ClassicLinkManager::OnDisconnect(common::Address device, hci::ErrorCode status) { links_.erase(device); } } // namespace internal } // namespace l2cap } // namespace bluetooth No newline at end of file
system/gd/l2cap/internal/classic_link_manager.h +1 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ class ClassicLinkManager : public hci::ConnectionCallbacks { ClassicLink* GetLink(common::Address device); void OnConnectSuccess(std::unique_ptr<hci::AclConnection> acl_connection) override; void OnConnectFail(common::Address device, hci::ErrorCode reason) override; void OnDisconnect(common::Address device, hci::ErrorCode status); private: // Dependencies Loading