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

Commit 6ed32bb0 authored by Chris Manton's avatar Chris Manton
Browse files

gd_acl: Directly access acl manager for SCO hack

Also explicitly log SCO disconnect

Bug: 179649871
Test: gd/cert/run
Tag: #refactor

Change-Id: Ia8fb5408d909c02d01bac5057dd388e1d8909e63
parent f293f141
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -37,6 +37,10 @@ namespace security {
class SecurityModule;
}
namespace shim {
namespace legacy {
class Acl;
}

class Btm;
void L2CA_UseLegacySecurityModule();
bool L2CA_SetAclPriority(uint16_t, bool);
@@ -46,6 +50,7 @@ namespace hci {

class AclManager : public Module {
 friend class bluetooth::shim::Btm;
 friend class bluetooth::shim::legacy::Acl;
 friend void bluetooth::shim::L2CA_UseLegacySecurityModule();
 friend bool bluetooth::shim::L2CA_SetAclPriority(uint16_t, bool);

+3 −1
Original line number Diff line number Diff line
@@ -927,6 +927,7 @@ shim::legacy::Acl::Acl(os::Handler* handler,
                       const acl_interface_t& acl_interface,
                       uint8_t max_acceptlist_size)
    : handler_(handler), acl_interface_(acl_interface) {
  ASSERT(handler_ != nullptr);
  ValidateAclInterface(acl_interface_);
  pimpl_ = std::make_unique<Acl::impl>(max_acceptlist_size);
  GetAclManager()->RegisterCallbacks(this, handler_);
@@ -935,7 +936,8 @@ shim::legacy::Acl::Acl(os::Handler* handler,
      handler->BindOn(this, &Acl::on_incoming_acl_credits));
  shim::RegisterDumpsysFunction(static_cast<void*>(this),
                                [this](int fd) { Dump(fd); });
  Stack::GetInstance()->GetBtm()->Register_HACK_SetScoDisconnectCallback(

  GetAclManager()->HACK_SetScoDisconnectCallback(
      [this](uint16_t handle, uint8_t reason) {
        TRY_POSTING_ON_MAIN(acl_interface_.connection.sco.on_disconnected,
                            handle, static_cast<tHCI_REASON>(reason));
+5 −0
Original line number Diff line number Diff line
@@ -893,6 +893,8 @@ void btm_sco_on_disconnected(uint16_t hci_handle, tHCI_REASON reason) {
    return;
  }

  const RawAddress bd_addr(p_sco->esco.data.bd_addr);

  p_sco->state = SCO_ST_UNUSED;
  p_sco->hci_handle = HCI_INVALID_HANDLE;
  p_sco->rem_bd_known = false;
@@ -900,6 +902,9 @@ void btm_sco_on_disconnected(uint16_t hci_handle, tHCI_REASON reason) {
  (*p_sco->p_disc_cb)(btm_cb.sco_cb.get_index(p_sco));
  LOG_DEBUG("Disconnected SCO link handle:%hu reason:%s", hci_handle,
            hci_reason_code_text(reason).c_str());
  BTM_LogHistory(kBtmLogTag, bd_addr, "Disconnected",
                 base::StringPrintf("handle:0x%04x reason:%s", hci_handle,
                                    hci_reason_code_text(reason).c_str()));
}

/*******************************************************************************