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

Commit 00803c30 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Reduce unneeded namespace resolution main/shim/acl am: 5203deb0 am: d78ad76b

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1584412

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5bc0b0a2decb2ad8bac3f53cdb3cfea5d1c247be
parents 0b7174cb d78ad76b
Loading
Loading
Loading
Loading
+62 −69
Original line number Original line Diff line number Diff line
@@ -99,10 +99,10 @@ struct ConnectionDescriptor {
        " creation_time:%s teardown_time:%s disconnect_reason:%s",
        " creation_time:%s teardown_time:%s disconnect_reason:%s",
        GetPrivateRemoteAddress().c_str(), handle_,
        GetPrivateRemoteAddress().c_str(), handle_,
        logbool(is_locally_initiated_).c_str(),
        logbool(is_locally_initiated_).c_str(),
        bluetooth::common::StringFormatTimeWithMilliseconds(
        common::StringFormatTimeWithMilliseconds(
            kConnectionDescriptorTimeFormat, creation_time_)
            kConnectionDescriptorTimeFormat, creation_time_)
            .c_str(),
            .c_str(),
        bluetooth::common::StringFormatTimeWithMilliseconds(
        common::StringFormatTimeWithMilliseconds(
            kConnectionDescriptorTimeFormat, teardown_time_)
            kConnectionDescriptorTimeFormat, teardown_time_)
            .c_str(),
            .c_str(),
        hci::ErrorCodeText(disconnect_reason_).c_str());
        hci::ErrorCodeText(disconnect_reason_).c_str());
@@ -167,8 +167,7 @@ constexpr size_t kConnectionHistorySize = 40;
inline uint8_t LowByte(uint16_t val) { return val & 0xff; }
inline uint8_t LowByte(uint16_t val) { return val & 0xff; }
inline uint8_t HighByte(uint16_t val) { return val >> 8; }
inline uint8_t HighByte(uint16_t val) { return val >> 8; }


void ValidateAclInterface(
void ValidateAclInterface(const shim::legacy::acl_interface_t& acl_interface) {
    const bluetooth::shim::legacy::acl_interface_t& acl_interface) {
  ASSERT_LOG(acl_interface.on_send_data_upwards != nullptr,
  ASSERT_LOG(acl_interface.on_send_data_upwards != nullptr,
             "Must provide to receive data on acl links");
             "Must provide to receive data on acl links");
  ASSERT_LOG(acl_interface.on_packets_completed != nullptr,
  ASSERT_LOG(acl_interface.on_packets_completed != nullptr,
@@ -223,13 +222,13 @@ class ShimAclConnection {
               "Shim Acl was not properly disconnected handle:0x%04x", handle_);
               "Shim Acl was not properly disconnected handle:0x%04x", handle_);
  }
  }


  void EnqueuePacket(std::unique_ptr<bluetooth::packet::RawBuilder> packet) {
  void EnqueuePacket(std::unique_ptr<packet::RawBuilder> packet) {
    // TODO Handle queue size exceeds some threshold
    // TODO Handle queue size exceeds some threshold
    queue_.push(std::move(packet));
    queue_.push(std::move(packet));
    RegisterEnqueue();
    RegisterEnqueue();
  }
  }


  std::unique_ptr<bluetooth::packet::BasePacketBuilder> handle_enqueue() {
  std::unique_ptr<packet::BasePacketBuilder> handle_enqueue() {
    auto packet = std::move(queue_.front());
    auto packet = std::move(queue_.front());
    queue_.pop();
    queue_.pop();
    if (queue_.empty()) {
    if (queue_.empty()) {
@@ -285,7 +284,7 @@ class ShimAclConnection {
  SendDataUpwards send_data_upwards_;
  SendDataUpwards send_data_upwards_;
  hci::acl_manager::AclConnection::QueueUpEnd* queue_up_end_;
  hci::acl_manager::AclConnection::QueueUpEnd* queue_up_end_;


  std::queue<std::unique_ptr<bluetooth::packet::RawBuilder>> queue_;
  std::queue<std::unique_ptr<packet::RawBuilder>> queue_;
  bool is_enqueue_registered_{false};
  bool is_enqueue_registered_{false};
  bool is_disconnected_{false};
  bool is_disconnected_{false};
  CreationTime creation_time_;
  CreationTime creation_time_;
@@ -582,7 +581,7 @@ class LeShimAclConnection
  std::unique_ptr<hci::acl_manager::LeAclConnection> connection_;
  std::unique_ptr<hci::acl_manager::LeAclConnection> connection_;
};
};


struct bluetooth::shim::legacy::Acl::impl {
struct shim::legacy::Acl::impl {
  std::map<HciHandle, std::unique_ptr<ClassicShimAclConnection>>
  std::map<HciHandle, std::unique_ptr<ClassicShimAclConnection>>
      handle_to_classic_connection_map_;
      handle_to_classic_connection_map_;
  std::map<HciHandle, std::unique_ptr<LeShimAclConnection>>
  std::map<HciHandle, std::unique_ptr<LeShimAclConnection>>
@@ -596,8 +595,8 @@ struct bluetooth::shim::legacy::Acl::impl {
           handle_to_classic_connection_map_.end();
           handle_to_classic_connection_map_.end();
  }
  }


  void EnqueueClassicPacket(
  void EnqueueClassicPacket(HciHandle handle,
      HciHandle handle, std::unique_ptr<bluetooth::packet::RawBuilder> packet) {
                            std::unique_ptr<packet::RawBuilder> packet) {
    ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection",
    ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection",
               handle);
               handle);
    handle_to_classic_connection_map_[handle]->EnqueuePacket(std::move(packet));
    handle_to_classic_connection_map_[handle]->EnqueuePacket(std::move(packet));
@@ -609,7 +608,7 @@ struct bluetooth::shim::legacy::Acl::impl {
  }
  }


  void EnqueueLePacket(HciHandle handle,
  void EnqueueLePacket(HciHandle handle,
                       std::unique_ptr<bluetooth::packet::RawBuilder> packet) {
                       std::unique_ptr<packet::RawBuilder> packet) {
    ASSERT_LOG(IsLeAcl(handle), "handle %d is not a LE connection", handle);
    ASSERT_LOG(IsLeAcl(handle), "handle %d is not a LE connection", handle);
    handle_to_le_connection_map_[handle]->EnqueuePacket(std::move(packet));
    handle_to_le_connection_map_[handle]->EnqueuePacket(std::move(packet));
  }
  }
@@ -716,7 +715,7 @@ void DumpsysAcl(int fd) {


  LOG_DUMPSYS_TITLE(fd, DUMPSYS_TAG);
  LOG_DUMPSYS_TITLE(fd, DUMPSYS_TAG);


  bluetooth::shim::Stack::GetInstance()->GetAcl()->DumpConnectionHistory(fd);
  shim::Stack::GetInstance()->GetAcl()->DumpConnectionHistory(fd);


  for (int i = 0; i < MAX_L2CAP_LINKS; i++) {
  for (int i = 0; i < MAX_L2CAP_LINKS; i++) {
    const tACL_CONN& acl_conn = acl_cb.acl_db[i];
    const tACL_CONN& acl_conn = acl_cb.acl_db[i];
@@ -760,7 +759,7 @@ void DumpsysAcl(int fd) {
}
}
#undef DUMPSYS_TAG
#undef DUMPSYS_TAG


using Record = bluetooth::common::TimestampedEntry<std::string>;
using Record = common::TimestampedEntry<std::string>;
const std::string kTimeFormat("%Y-%m-%d %H:%M:%S");
const std::string kTimeFormat("%Y-%m-%d %H:%M:%S");


#define DUMPSYS_TAG "shim::legacy::btm"
#define DUMPSYS_TAG "shim::legacy::btm"
@@ -802,14 +801,14 @@ void DumpsysRecord(int fd) {
}
}
#undef DUMPSYS_TAG
#undef DUMPSYS_TAG


void bluetooth::shim::legacy::Acl::Dump(int fd) const {
void shim::legacy::Acl::Dump(int fd) const {
  DumpsysRecord(fd);
  DumpsysRecord(fd);
  DumpsysAcl(fd);
  DumpsysAcl(fd);
  DumpsysL2cap(fd);
  DumpsysL2cap(fd);
  DumpsysBtm(fd);
  DumpsysBtm(fd);
}
}


bluetooth::shim::legacy::Acl::Acl(os::Handler* handler,
shim::legacy::Acl::Acl(os::Handler* handler,
                       const acl_interface_t& acl_interface)
                       const acl_interface_t& acl_interface)
    : handler_(handler), acl_interface_(acl_interface) {
    : handler_(handler), acl_interface_(acl_interface) {
  ValidateAclInterface(acl_interface_);
  ValidateAclInterface(acl_interface_);
@@ -818,7 +817,7 @@ bluetooth::shim::legacy::Acl::Acl(os::Handler* handler,
  GetAclManager()->RegisterLeCallbacks(this, handler_);
  GetAclManager()->RegisterLeCallbacks(this, handler_);
  GetController()->RegisterCompletedMonitorAclPacketsCallback(
  GetController()->RegisterCompletedMonitorAclPacketsCallback(
      handler->BindOn(this, &Acl::on_incoming_acl_credits));
      handler->BindOn(this, &Acl::on_incoming_acl_credits));
  bluetooth::shim::RegisterDumpsysFunction(static_cast<void*>(this),
  shim::RegisterDumpsysFunction(static_cast<void*>(this),
                                [this](int fd) { Dump(fd); });
                                [this](int fd) { Dump(fd); });
  Stack::GetInstance()->GetBtm()->Register_HACK_SetScoDisconnectCallback(
  Stack::GetInstance()->GetBtm()->Register_HACK_SetScoDisconnectCallback(
      [this](uint16_t handle, uint8_t reason) {
      [this](uint16_t handle, uint8_t reason) {
@@ -827,8 +826,8 @@ bluetooth::shim::legacy::Acl::Acl(os::Handler* handler,
      });
      });
}
}


bluetooth::shim::legacy::Acl::~Acl() {
shim::legacy::Acl::~Acl() {
  bluetooth::shim::UnregisterDumpsysFunction(static_cast<void*>(this));
  shim::UnregisterDumpsysFunction(static_cast<void*>(this));
  GetController()->UnregisterCompletedMonitorAclPacketsCallback();
  GetController()->UnregisterCompletedMonitorAclPacketsCallback();


  if (CheckForOrphanedAclConnections()) {
  if (CheckForOrphanedAclConnections()) {
@@ -836,7 +835,7 @@ bluetooth::shim::legacy::Acl::~Acl() {
  }
  }
}
}


bool bluetooth::shim::legacy::Acl::CheckForOrphanedAclConnections() const {
bool shim::legacy::Acl::CheckForOrphanedAclConnections() const {
  bool orphaned_acl_connections = false;
  bool orphaned_acl_connections = false;


  if (!pimpl_->handle_to_classic_connection_map_.empty()) {
  if (!pimpl_->handle_to_classic_connection_map_.empty()) {
@@ -845,7 +844,7 @@ bool bluetooth::shim::legacy::Acl::CheckForOrphanedAclConnections() const {
      LOG_ERROR("  Orphaned classic ACL handle:0x%04x bd_addr:%s created:%s",
      LOG_ERROR("  Orphaned classic ACL handle:0x%04x bd_addr:%s created:%s",
                connection.second->Handle(),
                connection.second->Handle(),
                PRIVATE_ADDRESS(connection.second->GetRemoteAddress()),
                PRIVATE_ADDRESS(connection.second->GetRemoteAddress()),
                bluetooth::common::StringFormatTimeWithMilliseconds(
                common::StringFormatTimeWithMilliseconds(
                    kConnectionDescriptorTimeFormat,
                    kConnectionDescriptorTimeFormat,
                    connection.second->GetCreationTime())
                    connection.second->GetCreationTime())
                    .c_str());
                    .c_str());
@@ -859,7 +858,7 @@ bool bluetooth::shim::legacy::Acl::CheckForOrphanedAclConnections() const {
      LOG_ERROR("  Orphaned le ACL handle:0x%04x bd_addr:%s created:%s",
      LOG_ERROR("  Orphaned le ACL handle:0x%04x bd_addr:%s created:%s",
                connection.second->Handle(),
                connection.second->Handle(),
                PRIVATE_ADDRESS(connection.second->GetRemoteAddressWithType()),
                PRIVATE_ADDRESS(connection.second->GetRemoteAddressWithType()),
                bluetooth::common::StringFormatTimeWithMilliseconds(
                common::StringFormatTimeWithMilliseconds(
                    kConnectionDescriptorTimeFormat,
                    kConnectionDescriptorTimeFormat,
                    connection.second->GetCreationTime())
                    connection.second->GetCreationTime())
                    .c_str());
                    .c_str());
@@ -869,13 +868,13 @@ bool bluetooth::shim::legacy::Acl::CheckForOrphanedAclConnections() const {
  return orphaned_acl_connections;
  return orphaned_acl_connections;
}
}


void bluetooth::shim::legacy::Acl::on_incoming_acl_credits(uint16_t handle,
void shim::legacy::Acl::on_incoming_acl_credits(uint16_t handle,
                                                uint16_t credits) {
                                                uint16_t credits) {
  TRY_POSTING_ON_MAIN(acl_interface_.on_packets_completed, handle, credits);
  TRY_POSTING_ON_MAIN(acl_interface_.on_packets_completed, handle, credits);
}
}


void bluetooth::shim::legacy::Acl::write_data_sync(
void shim::legacy::Acl::write_data_sync(
    HciHandle handle, std::unique_ptr<bluetooth::packet::RawBuilder> packet) {
    HciHandle handle, std::unique_ptr<packet::RawBuilder> packet) {
  if (pimpl_->IsClassicAcl(handle)) {
  if (pimpl_->IsClassicAcl(handle)) {
    pimpl_->EnqueueClassicPacket(handle, std::move(packet));
    pimpl_->EnqueueClassicPacket(handle, std::move(packet));
  } else if (pimpl_->IsLeAcl(handle)) {
  } else if (pimpl_->IsLeAcl(handle)) {
@@ -885,15 +884,14 @@ void bluetooth::shim::legacy::Acl::write_data_sync(
  }
  }
}
}


void bluetooth::shim::legacy::Acl::WriteData(
void shim::legacy::Acl::WriteData(HciHandle handle,
    HciHandle handle, std::unique_ptr<bluetooth::packet::RawBuilder> packet) {
                                  std::unique_ptr<packet::RawBuilder> packet) {
  handler_->Post(common::BindOnce(&Acl::write_data_sync,
  handler_->Post(common::BindOnce(&Acl::write_data_sync,
                                  common::Unretained(this), handle,
                                  common::Unretained(this), handle,
                                  std::move(packet)));
                                  std::move(packet)));
}
}


void bluetooth::shim::legacy::Acl::CreateClassicConnection(
void shim::legacy::Acl::CreateClassicConnection(const hci::Address& address) {
    const bluetooth::hci::Address& address) {
  GetAclManager()->CreateConnection(address);
  GetAclManager()->CreateConnection(address);
  LOG_DEBUG("Connection initiated for classic to remote:%s",
  LOG_DEBUG("Connection initiated for classic to remote:%s",
            PRIVATE_ADDRESS(address));
            PRIVATE_ADDRESS(address));
@@ -901,8 +899,8 @@ void bluetooth::shim::legacy::Acl::CreateClassicConnection(
                 "classic");
                 "classic");
}
}


void bluetooth::shim::legacy::Acl::CreateLeConnection(
void shim::legacy::Acl::CreateLeConnection(
    const bluetooth::hci::AddressWithType& address_with_type) {
    const hci::AddressWithType& address_with_type) {
  GetAclManager()->CreateLeConnection(address_with_type);
  GetAclManager()->CreateLeConnection(address_with_type);
  LOG_DEBUG("Connection initiated for le connection to remote:%s",
  LOG_DEBUG("Connection initiated for le connection to remote:%s",
            PRIVATE_ADDRESS(address_with_type));
            PRIVATE_ADDRESS(address_with_type));
@@ -910,8 +908,8 @@ void bluetooth::shim::legacy::Acl::CreateLeConnection(
                 "Initiated connection", "le");
                 "Initiated connection", "le");
}
}


void bluetooth::shim::legacy::Acl::CancelLeConnection(
void shim::legacy::Acl::CancelLeConnection(
    const bluetooth::hci::AddressWithType& address_with_type) {
    const hci::AddressWithType& address_with_type) {
  GetAclManager()->CancelLeConnect(address_with_type);
  GetAclManager()->CancelLeConnect(address_with_type);
  LOG_DEBUG("Cancelled le connection to remote:%s",
  LOG_DEBUG("Cancelled le connection to remote:%s",
            PRIVATE_ADDRESS(address_with_type));
            PRIVATE_ADDRESS(address_with_type));
@@ -919,9 +917,9 @@ void bluetooth::shim::legacy::Acl::CancelLeConnection(
                 "Cancelled connection", "le");
                 "Cancelled connection", "le");
}
}


void bluetooth::shim::legacy::Acl::OnClassicLinkDisconnected(
void shim::legacy::Acl::OnClassicLinkDisconnected(HciHandle handle,
    HciHandle handle, hci::ErrorCode reason) {
                                                  hci::ErrorCode reason) {
  bluetooth::hci::Address remote_address =
  hci::Address remote_address =
      pimpl_->handle_to_classic_connection_map_[handle]->GetRemoteAddress();
      pimpl_->handle_to_classic_connection_map_[handle]->GetRemoteAddress();
  CreationTime creation_time =
  CreationTime creation_time =
      pimpl_->handle_to_classic_connection_map_[handle]->GetCreationTime();
      pimpl_->handle_to_classic_connection_map_[handle]->GetCreationTime();
@@ -946,7 +944,7 @@ void bluetooth::shim::legacy::Acl::OnClassicLinkDisconnected(
          is_locally_initiated, reason)));
          is_locally_initiated, reason)));
}
}


void bluetooth::shim::legacy::Acl::OnLeLinkDisconnected(HciHandle handle,
void shim::legacy::Acl::OnLeLinkDisconnected(HciHandle handle,
                                             hci::ErrorCode reason) {
                                             hci::ErrorCode reason) {
  hci::AddressWithType remote_address_with_type =
  hci::AddressWithType remote_address_with_type =
      pimpl_->handle_to_le_connection_map_[handle]->GetRemoteAddressWithType();
      pimpl_->handle_to_le_connection_map_[handle]->GetRemoteAddressWithType();
@@ -974,7 +972,7 @@ void bluetooth::shim::legacy::Acl::OnLeLinkDisconnected(HciHandle handle,
          is_locally_initiated, reason)));
          is_locally_initiated, reason)));
}
}


void bluetooth::shim::legacy::Acl::OnConnectSuccess(
void shim::legacy::Acl::OnConnectSuccess(
    std::unique_ptr<hci::acl_manager::ClassicAclConnection> connection) {
    std::unique_ptr<hci::acl_manager::ClassicAclConnection> connection) {
  ASSERT(connection != nullptr);
  ASSERT(connection != nullptr);
  auto handle = connection->GetHandle();
  auto handle = connection->GetHandle();
@@ -1003,7 +1001,7 @@ void bluetooth::shim::legacy::Acl::OnConnectSuccess(
                 (locally_initiated) ? "Local initiated" : "Remote initiated");
                 (locally_initiated) ? "Local initiated" : "Remote initiated");
}
}


void bluetooth::shim::legacy::Acl::OnConnectFail(hci::Address address,
void shim::legacy::Acl::OnConnectFail(hci::Address address,
                                      hci::ErrorCode reason) {
                                      hci::ErrorCode reason) {
  const RawAddress bd_addr = ToRawAddress(address);
  const RawAddress bd_addr = ToRawAddress(address);
  TRY_POSTING_ON_MAIN(acl_interface_.connection.classic.on_failed, bd_addr,
  TRY_POSTING_ON_MAIN(acl_interface_.connection.classic.on_failed, bd_addr,
@@ -1015,13 +1013,13 @@ void bluetooth::shim::legacy::Acl::OnConnectFail(hci::Address address,
                                    hci::ErrorCodeText(reason).c_str()));
                                    hci::ErrorCodeText(reason).c_str()));
}
}


void bluetooth::shim::legacy::Acl::OnLeConnectSuccess(
void shim::legacy::Acl::OnLeConnectSuccess(
    hci::AddressWithType address_with_type,
    hci::AddressWithType address_with_type,
    std::unique_ptr<hci::acl_manager::LeAclConnection> connection) {
    std::unique_ptr<hci::acl_manager::LeAclConnection> connection) {
  ASSERT(connection != nullptr);
  ASSERT(connection != nullptr);
  auto handle = connection->GetHandle();
  auto handle = connection->GetHandle();


  bluetooth::hci::Role connection_role = connection->GetRole();
  hci::Role connection_role = connection->GetRole();
  bool locally_initiated = connection->locally_initiated_;
  bool locally_initiated = connection->locally_initiated_;


  pimpl_->handle_to_le_connection_map_.emplace(
  pimpl_->handle_to_le_connection_map_.emplace(
@@ -1059,8 +1057,8 @@ void bluetooth::shim::legacy::Acl::OnLeConnectSuccess(
                 "Connection successful", "le");
                 "Connection successful", "le");
}
}


void bluetooth::shim::legacy::Acl::OnLeConnectFail(
void shim::legacy::Acl::OnLeConnectFail(hci::AddressWithType address_with_type,
    hci::AddressWithType address_with_type, hci::ErrorCode reason) {
                                        hci::ErrorCode reason) {
  tBLE_BD_ADDR legacy_address_with_type =
  tBLE_BD_ADDR legacy_address_with_type =
      ToLegacyAddressWithType(address_with_type);
      ToLegacyAddressWithType(address_with_type);


@@ -1078,8 +1076,7 @@ void bluetooth::shim::legacy::Acl::OnLeConnectFail(
      base::StringPrintf("le reason:%s", hci::ErrorCodeText(reason).c_str()));
      base::StringPrintf("le reason:%s", hci::ErrorCodeText(reason).c_str()));
}
}


void bluetooth::shim::legacy::Acl::ConfigureLePrivacy(
void shim::legacy::Acl::ConfigureLePrivacy(bool is_le_privacy_enabled) {
    bool is_le_privacy_enabled) {
  LOG_INFO("Configuring Le privacy:%s",
  LOG_INFO("Configuring Le privacy:%s",
           (is_le_privacy_enabled) ? "true" : "false");
           (is_le_privacy_enabled) ? "true" : "false");
  ASSERT_LOG(is_le_privacy_enabled,
  ASSERT_LOG(is_le_privacy_enabled,
@@ -1100,8 +1097,7 @@ void bluetooth::shim::legacy::Acl::ConfigureLePrivacy(
      maximum_rotation_time);
      maximum_rotation_time);
}
}


void bluetooth::shim::legacy::Acl::DisconnectClassic(uint16_t handle,
void shim::legacy::Acl::DisconnectClassic(uint16_t handle, tHCI_STATUS reason) {
                                                     tHCI_STATUS reason) {
  auto connection = pimpl_->handle_to_classic_connection_map_.find(handle);
  auto connection = pimpl_->handle_to_classic_connection_map_.find(handle);
  if (connection != pimpl_->handle_to_classic_connection_map_.end()) {
  if (connection != pimpl_->handle_to_classic_connection_map_.end()) {
    auto remote_address = connection->second->GetRemoteAddress();
    auto remote_address = connection->second->GetRemoteAddress();
@@ -1117,8 +1113,7 @@ void bluetooth::shim::legacy::Acl::DisconnectClassic(uint16_t handle,
  }
  }
}
}


void bluetooth::shim::legacy::Acl::DisconnectLe(uint16_t handle,
void shim::legacy::Acl::DisconnectLe(uint16_t handle, tHCI_STATUS reason) {
                                                tHCI_STATUS reason) {
  auto connection = pimpl_->handle_to_le_connection_map_.find(handle);
  auto connection = pimpl_->handle_to_le_connection_map_.find(handle);
  if (connection != pimpl_->handle_to_le_connection_map_.end()) {
  if (connection != pimpl_->handle_to_le_connection_map_.end()) {
    auto remote_address_with_type =
    auto remote_address_with_type =
@@ -1135,49 +1130,47 @@ void bluetooth::shim::legacy::Acl::DisconnectLe(uint16_t handle,
             handle);
             handle);
  }
  }
}
}
bool bluetooth::shim::legacy::Acl::HoldMode(uint16_t hci_handle,
bool shim::legacy::Acl::HoldMode(uint16_t hci_handle, uint16_t max_interval,
                                            uint16_t max_interval,
                                 uint16_t min_interval) {
                                 uint16_t min_interval) {
  handler_->CallOn(pimpl_.get(), &Acl::impl::HoldMode, hci_handle, max_interval,
  handler_->CallOn(pimpl_.get(), &Acl::impl::HoldMode, hci_handle, max_interval,
                   min_interval);
                   min_interval);
  return false;  // TODO void
  return false;  // TODO void
}
}


bool bluetooth::shim::legacy::Acl::SniffMode(uint16_t hci_handle,
bool shim::legacy::Acl::SniffMode(uint16_t hci_handle, uint16_t max_interval,
                                             uint16_t max_interval,
                                  uint16_t min_interval, uint16_t attempt,
                                             uint16_t min_interval,
                                             uint16_t attempt,
                                  uint16_t timeout) {
                                  uint16_t timeout) {
  handler_->CallOn(pimpl_.get(), &Acl::impl::SniffMode, hci_handle,
  handler_->CallOn(pimpl_.get(), &Acl::impl::SniffMode, hci_handle,
                   max_interval, min_interval, attempt, timeout);
                   max_interval, min_interval, attempt, timeout);
  return false;
  return false;
}
}


bool bluetooth::shim::legacy::Acl::ExitSniffMode(uint16_t hci_handle) {
bool shim::legacy::Acl::ExitSniffMode(uint16_t hci_handle) {
  handler_->CallOn(pimpl_.get(), &Acl::impl::ExitSniffMode, hci_handle);
  handler_->CallOn(pimpl_.get(), &Acl::impl::ExitSniffMode, hci_handle);
  return false;
  return false;
}
}


bool bluetooth::shim::legacy::Acl::SniffSubrating(
bool shim::legacy::Acl::SniffSubrating(uint16_t hci_handle,
    uint16_t hci_handle, uint16_t maximum_latency,
                                       uint16_t maximum_latency,
    uint16_t minimum_remote_timeout, uint16_t minimum_local_timeout) {
                                       uint16_t minimum_remote_timeout,
                                       uint16_t minimum_local_timeout) {
  handler_->CallOn(pimpl_.get(), &Acl::impl::SniffSubrating, hci_handle,
  handler_->CallOn(pimpl_.get(), &Acl::impl::SniffSubrating, hci_handle,
                   maximum_latency, minimum_remote_timeout,
                   maximum_latency, minimum_remote_timeout,
                   minimum_local_timeout);
                   minimum_local_timeout);
  return false;
  return false;
}
}


void bluetooth::shim::legacy::Acl::HACK_OnScoDisconnected(uint16_t handle,
void shim::legacy::Acl::HACK_OnScoDisconnected(uint16_t handle,
                                               uint8_t reason) {
                                               uint8_t reason) {
  TRY_POSTING_ON_MAIN(acl_interface_.connection.sco.on_disconnected, handle,
  TRY_POSTING_ON_MAIN(acl_interface_.connection.sco.on_disconnected, handle,
                      static_cast<tHCI_REASON>(reason));
                      static_cast<tHCI_REASON>(reason));
}
}


void bluetooth::shim::legacy::Acl::DumpConnectionHistory(int fd) const {
void shim::legacy::Acl::DumpConnectionHistory(int fd) const {
  pimpl_->DumpConnectionHistory(fd);
  pimpl_->DumpConnectionHistory(fd);
}
}


void bluetooth::shim::legacy::Acl::Shutdown() {
void shim::legacy::Acl::Shutdown() {
  if (CheckForOrphanedAclConnections()) {
  if (CheckForOrphanedAclConnections()) {
    std::promise<void> shutdown_promise;
    std::promise<void> shutdown_promise;
    auto shutdown_future = shutdown_promise.get_future();
    auto shutdown_future = shutdown_promise.get_future();