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

Commit b0c80d64 authored by Chris Manton's avatar Chris Manton Committed by Gerrit Code Review
Browse files

Merge "Only add br_edr to power mode db"

parents 530336ac 27268481
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -407,14 +407,14 @@ void btm_acl_created(const RawAddress& bda, uint16_t hci_handle,
  p_acl->transport = transport;
  p_acl->switch_role_failed_attempts = 0;
  p_acl->reset_switch_role();
  BTM_PM_OnConnected(hci_handle, bda);

  LOG_DEBUG(
      "Created new ACL connection peer:%s role:%s handle:0x%04x transport:%s",
      ADDRESS_TO_LOGGABLE_CSTR(bda), RoleText(p_acl->link_role).c_str(), hci_handle,
      bt_transport_text(transport).c_str());

  if (transport == BT_TRANSPORT_BR_EDR) {
  if (p_acl->is_transport_br_edr()) {
    BTM_PM_OnConnected(hci_handle, bda);
    btm_set_link_policy(p_acl, btm_cb.acl_cb_.DefaultLinkPolicy());
  }

@@ -485,9 +485,11 @@ void btm_acl_removed(uint16_t handle) {
  }
  p_acl->in_use = false;
  NotifyAclLinkDown(*p_acl);
  p_acl->Reset();
  if (p_acl->is_transport_br_edr()) {
    BTM_PM_OnDisconnected(handle);
  }
  p_acl->Reset();
}

/*******************************************************************************
 *
+7 −0
Original line number Diff line number Diff line
@@ -148,11 +148,18 @@ tBTM_STATUS BTM_PmRegister(uint8_t mask, uint8_t* p_pm_id,
}

void BTM_PM_OnConnected(uint16_t handle, const RawAddress& remote_bda) {
  if (pm_mode_db.find(handle) != pm_mode_db.end()) {
    LOG_ERROR("Overwriting power mode db entry handle:%hu peer:%s", handle,
              ADDRESS_TO_LOGGABLE_CSTR(remote_bda));
  }
  pm_mode_db[handle] = {};
  pm_mode_db[handle].Init(remote_bda, handle);
}

void BTM_PM_OnDisconnected(uint16_t handle) {
  if (pm_mode_db.find(handle) == pm_mode_db.end()) {
    LOG_ERROR("Erasing unknown power mode db entry handle:%hu", handle);
  }
  pm_mode_db.erase(handle);
  if (handle == pm_pend_link) {
    pm_pend_link = 0;