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

Commit 0298e765 authored by Hansong Zhang's avatar Hansong Zhang Committed by Automerger Merge Worker
Browse files

Fix LE crash am: 86b13b04

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Idebf10a7e388ff17974b523aab976ab6b223cfa5
parents b261361a 86b13b04
Loading
Loading
Loading
Loading
+5 −11
Original line number Diff line number Diff line
@@ -1016,18 +1016,12 @@ bool L2CA_RemoveFixedChnl(uint16_t cid, const RawAddress& rem_bda) {
  return true;
}

uint16_t L2CA_GetLeHandle(uint16_t cid, const RawAddress& rem_bda) {
  if (cid != kAttCid && cid != kSmpCid) {
    LOG(ERROR) << "Invalid cid " << cid;
    return 0;
  }
  auto* helper = &le_fixed_channel_helper_.find(cid)->second;
  auto channel = helper->channels_.find(ToGdAddress(rem_bda));
  if (channel == helper->channels_.end() || channel->second == nullptr) {
    LOG(ERROR) << "Channel is not open";
uint16_t L2CA_GetLeHandle(const RawAddress& rem_bda) {
  auto addr = ToGdAddress(rem_bda);
  if (le_link_property_listener_shim_.info_.count(addr) == 0) {
    return 0;
  }
  return channel->second->GetLinkOptions()->GetHandle();
  return le_link_property_listener_shim_.info_[addr].handle;
}

void L2CA_LeConnectionUpdate(const RawAddress& rem_bda, uint16_t min_int,
@@ -1156,7 +1150,7 @@ bool L2CA_IsLinkEstablished(const RawAddress& bd_addr,
  if (transport == BT_TRANSPORT_BR_EDR) {
    return security_listener_shim_.IsLinkUp(bd_addr);
  } else {
    return bluetooth::shim::L2CA_GetLeHandle(kAttCid, bd_addr) != 0;
    return bluetooth::shim::L2CA_GetLeHandle(bd_addr) != 0;
  }
}

+1 −1
Original line number Diff line number Diff line
@@ -393,7 +393,7 @@ uint16_t L2CA_SendFixedChnlData(uint16_t fixed_cid, const RawAddress& rem_bda,
 ******************************************************************************/
bool L2CA_RemoveFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda);

uint16_t L2CA_GetLeHandle(uint16_t cid, const RawAddress& rem_bda);
uint16_t L2CA_GetLeHandle(const RawAddress& rem_bda);
hci_role_t L2CA_GetBleConnRole(const RawAddress& bd_addr);

void L2CA_LeConnectionUpdate(const RawAddress& rem_bda, uint16_t min_int,
+1 −1
Original line number Diff line number Diff line
@@ -673,7 +673,7 @@ tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr,
  }

  if (bluetooth::shim::is_gd_l2cap_enabled()) {
    uint16_t handle = bluetooth::shim::L2CA_GetLeHandle(L2CAP_ATT_CID, bd_addr);
    uint16_t handle = bluetooth::shim::L2CA_GetLeHandle(bd_addr);
    btsnd_hcic_ble_set_data_length(handle, tx_pdu_length, tx_time);
    return BTM_SUCCESS;
  }
+1 −2
Original line number Diff line number Diff line
@@ -76,8 +76,7 @@ bool bluetooth::shim::L2CA_IsLinkEstablished(const RawAddress& bd_addr,
  mock_function_count_map[__func__]++;
  return false;
}
uint16_t bluetooth::shim::L2CA_GetLeHandle(uint16_t cid,
                                           const RawAddress& bd_addr) {
uint16_t bluetooth::shim::L2CA_GetLeHandle(const RawAddress& bd_addr) {
  mock_function_count_map[__func__]++;
  return 0;
}