From: Chris Manton Date: Wed, 25 Nov 2020 02:38:01 +0000 (-0800) Subject: gd: Add local/remote acl connection initiator bit X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b1126b04356bb50aa1076252102e9ed56695c6be;p=android-x86%2Fsystem-bt.git gd: Add local/remote acl connection initiator bit Report the initiator of the acl connection. Bug: 166280067 Test: gd/cert/run --host Tag: #refactor Change-Id: If123478fd271f9f49ff9a3d0e30be8a9a6e1abfd --- diff --git a/gd/hci/acl_manager/acl_connection.h b/gd/hci/acl_manager/acl_connection.h index 9c2d3f379..c396b1833 100644 --- a/gd/hci/acl_manager/acl_connection.h +++ b/gd/hci/acl_manager/acl_connection.h @@ -41,6 +41,8 @@ class AclConnection { using QueueDownEnd = common::BidiQueueEnd, BasePacketBuilder>; virtual QueueUpEnd* GetAclQueueEnd() const; + bool locally_initiated_{false}; + protected: AclConnection(QueueUpEnd* queue_up_end, uint16_t handle) : queue_up_end_(queue_up_end), handle_(handle) {} QueueUpEnd* queue_up_end_; diff --git a/gd/hci/acl_manager/classic_impl.h b/gd/hci/acl_manager/classic_impl.h index c5d303fb0..480bdd543 100644 --- a/gd/hci/acl_manager/classic_impl.h +++ b/gd/hci/acl_manager/classic_impl.h @@ -190,9 +190,11 @@ struct classic_impl : public security::ISecurityManagerListener { auto status = connection_complete.GetStatus(); auto address = connection_complete.GetBdAddr(); Role current_role = Role::CENTRAL; + bool locally_initiated = true; if (outgoing_connecting_address_ == address) { outgoing_connecting_address_ = Address::kEmpty; } else { + locally_initiated = false; ASSERT_LOG(incoming_connecting_address_ == address, "No prior connection request for %s", address.ToString().c_str()); incoming_connecting_address_ = Address::kEmpty; @@ -212,6 +214,7 @@ struct classic_impl : public security::ISecurityManagerListener { round_robin_scheduler_->Register(RoundRobinScheduler::ConnectionType::CLASSIC, handle, queue); std::unique_ptr connection( new ClassicAclConnection(std::move(queue), acl_connection_interface_, handle, address)); + connection->locally_initiated_ = locally_initiated; auto& connection_proxy = check_and_get_connection(handle); connection_proxy.connection_management_callbacks_ = connection->GetEventCallbacks(); connection_proxy.connection_management_callbacks_->OnRoleChange(current_role);