Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5dca6afa authored by Hansong Zhang's avatar Hansong Zhang
Browse files

GD L2cap improvements

* Store the role from updates.
* Update PSM check.  LE doesn't need it because it uses SPSM.

Tag: #gd-refactor
Bug: 141555841
Test: cert/run --host
Change-Id: Ibfea3d227a999c8e31e6897628c257084b43174e
parent 403aafd2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -402,7 +402,7 @@ void Link::OnCentralLinkKeyComplete(hci::KeyFlag key_flag) {
  LOG_INFO("UNIMPLEMENTED key_flag:%s", hci::KeyFlagText(key_flag).c_str());
}
void Link::OnRoleChange(hci::Role new_role) {
  LOG_INFO("UNIMPLEMENTED role:%s", hci::RoleText(new_role).c_str());
  role_ = new_role;
}
void Link::OnDisconnection(hci::ErrorCode reason) {
  OnAclDisconnected(reason);
+3 −0
Original line number Diff line number Diff line
@@ -83,6 +83,9 @@ void LinkManager::ConnectFixedChannelServices(hci::Address device,

void LinkManager::ConnectDynamicChannelServices(
    hci::Address device, Link::PendingDynamicChannelConnection pending_dynamic_channel_connection, Psm psm) {
  if (!IsPsmValid(psm)) {
    return;
  }
  auto* link = GetLink(device);
  if (link == nullptr) {
    acl_manager_->CreateConnection(device);
+2 −2
Original line number Diff line number Diff line
@@ -63,6 +63,8 @@ class L2capClassicModule : public bluetooth::Module {
   */
  virtual SecurityInterface* GetSecurityInterface(os::Handler* handler, LinkSecurityInterfaceListener* listener);

  friend security::SecurityModule;

 protected:
  void ListDependencies(ModuleList* list) override;

@@ -78,8 +80,6 @@ class L2capClassicModule : public bluetooth::Module {
  struct impl;
  std::unique_ptr<impl> pimpl_;

  friend security::SecurityModule;

  DISALLOW_COPY_AND_ASSIGN(L2capClassicModule);
};

+0 −4
Original line number Diff line number Diff line
@@ -28,8 +28,6 @@ namespace l2cap {
namespace internal {

std::shared_ptr<DynamicChannelImpl> DynamicChannelAllocator::AllocateChannel(Psm psm, Cid remote_cid) {
  ASSERT_LOG(IsPsmValid(psm), "Psm 0x%x is invalid", psm);

  if (used_remote_cid_.find(remote_cid) != used_remote_cid_.end()) {
    LOG_INFO("Remote cid 0x%x is used", remote_cid);
    return nullptr;
@@ -54,8 +52,6 @@ std::shared_ptr<DynamicChannelImpl> DynamicChannelAllocator::AllocateChannel(Psm

std::shared_ptr<DynamicChannelImpl> DynamicChannelAllocator::AllocateReservedChannel(Cid reserved_cid, Psm psm,
                                                                                     Cid remote_cid) {
  ASSERT_LOG(IsPsmValid(psm), "Psm 0x%x is invalid", psm);

  if (used_remote_cid_.find(remote_cid) != used_remote_cid_.end()) {
    LOG_INFO("Remote cid 0x%x is used", remote_cid);
    return nullptr;
+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ DynamicChannelImpl::DynamicChannelImpl(Psm psm, Cid cid, Cid remote_cid, l2cap::
                                       os::Handler* l2cap_handler)
    : psm_(psm), cid_(cid), remote_cid_(remote_cid), link_(link), l2cap_handler_(l2cap_handler),
      device_(link->GetDevice()) {
  ASSERT(IsPsmValid(psm_));
  ASSERT(cid_ > 0);
  ASSERT(remote_cid_ > 0);
  ASSERT(link_ != nullptr);
Loading