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

Commit 5036d90b authored by Henri Chataing's avatar Henri Chataing
Browse files

Remove unused function btm_dev_support_role_switch

Bug: 331817295
Test: m com.android.btservices
Flag: EXEMPT, dead code removal
Change-Id: I3f9f55b9d01a67dc4c0f13e8830adc19eeb9d3a9
parent b103e31e
Loading
Loading
Loading
Loading
+0 −45
Original line number Diff line number Diff line
@@ -286,51 +286,6 @@ tBTM_SEC_DEV_REC* btm_sec_alloc_dev(const RawAddress& bd_addr) {
  return (p_dev_rec);
}

/*******************************************************************************
 *
 * Function         btm_dev_support_role_switch
 *
 * Description      This function is called by the L2CAP to check if remote
 *                  device supports role switch
 *
 * Parameters:      bd_addr       - Address of the peer device
 *
 * Returns          true if device is known and role switch is supported
 *                  for the link.
 *
 ******************************************************************************/
bool btm_dev_support_role_switch(const RawAddress& bd_addr) {
  if (BTM_IsScoActiveByBdaddr(bd_addr)) {
    log::verbose("Role switch is not allowed if a SCO is up");
    return false;
  }

  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);
  if (p_dev_rec == nullptr) {
    log::verbose("Unknown address for role switch");
    return false;
  }

  if (!bluetooth::shim::GetController()->SupportsRoleSwitch()) {
    log::verbose("Local controller does not support role switch");
    return false;
  }

  if (p_dev_rec->remote_supports_hci_role_switch) {
    log::verbose("Peer controller supports role switch");
    return true;
  }

  if (!p_dev_rec->remote_feature_received) {
    log::verbose(
        "Unknown peer capabilities, assuming peer supports role switch");
    return true;
  }

  log::verbose("Peer controller does not support role switch");
  return false;
}

static bool is_handle_equal(void* data, void* context) {
  tBTM_SEC_DEV_REC* p_dev_rec = static_cast<tBTM_SEC_DEV_REC*>(data);
  uint16_t* handle = static_cast<uint16_t*>(context);
+0 −14
Original line number Diff line number Diff line
@@ -68,20 +68,6 @@ const char* BTM_SecReadDevName(const RawAddress& bd_addr);
 ******************************************************************************/
tBTM_SEC_DEV_REC* btm_sec_alloc_dev(const RawAddress& bd_addr);

/*******************************************************************************
 *
 * Function         btm_dev_support_role_switch
 *
 * Description      This function is called by the L2CAP to check if remote
 *                  device supports role switch
 *
 * Parameters:      bd_addr       - Address of the peer device
 *
 * Returns          true if device is known and role switch is supported
 *
 ******************************************************************************/
bool btm_dev_support_role_switch(const RawAddress& bd_addr);

/*******************************************************************************
 *
 * Function         btm_find_dev_by_handle
+0 −1
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ using namespace bluetooth;
extern tBTM_CB btm_cb;

bool BTM_ReadPowerMode(const RawAddress& remote_bda, tBTM_PM_MODE* p_mode);
bool btm_dev_support_role_switch(const RawAddress& bd_addr);
tBTM_STATUS btm_sec_disconnect(uint16_t handle, tHCI_STATUS reason,
                               std::string);
void btm_acl_created(const RawAddress& bda, uint16_t hci_handle,
+0 −4
Original line number Diff line number Diff line
@@ -54,10 +54,6 @@ bool BTM_SecDeleteDevice(const RawAddress& /* bd_addr */) {
  inc_func_call_count(__func__);
  return false;
}
bool btm_dev_support_role_switch(const RawAddress& /* bd_addr */) {
  inc_func_call_count(__func__);
  return false;
}
bool btm_set_bond_type_dev(const RawAddress& /* bd_addr */,
                           tBTM_BOND_TYPE /* bond_type */) {
  inc_func_call_count(__func__);