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

Commit 135e9130 authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

Read appearance of new LE devices on connection

Test: mmm packages/modules/Bluetooth
Flag: com.android.bluetooth.flags.read_le_appearance
Bug: 286334644
Bug: 362367900
Change-Id: I9d5f20672b01112a87d12b029b44fc064999dd7a
parent 48d6eea2
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ extern tBTM_CB btm_cb;

bool btm_ble_init_pseudo_addr(tBTM_SEC_DEV_REC* p_dev_rec, const RawAddress& new_pseudo_addr);
tBTM_STATUS btm_ble_read_remote_name(const RawAddress& remote_bda, tBTM_NAME_CMPL_CB* p_cb);
tBTM_STATUS btm_ble_read_remote_cod(const RawAddress& remote_bda);

namespace {
constexpr char kBtmLogTag[] = "SEC";
@@ -1549,6 +1550,15 @@ void btm_ble_connection_established(const RawAddress& bda) {
  if (p_dev_rec != nullptr && !p_dev_rec->sec_rec.is_name_known()) {
    btm_ble_read_remote_name(bda, nullptr);
  }

  if (com::android::bluetooth::flags::read_le_appearance() && p_dev_rec != nullptr &&
      !p_dev_rec->sec_rec.is_le_link_key_known()) {
    // Unknown device
    if (p_dev_rec->dev_class == kDevClassEmpty || p_dev_rec->dev_class == kDevClassUnclassified) {
      // Class of device not known, read appearance characteristic
      btm_ble_read_remote_cod(bda);
    }
  }
}

static void btm_ble_user_confirmation_req(const RawAddress& bd_addr, tBTM_SEC_DEV_REC* p_dev_rec,
@@ -1606,8 +1616,7 @@ static void btm_ble_complete_evt(const RawAddress& bd_addr, tBTM_SEC_DEV_REC* p_
          "pin_code_len={:x}",
          btm_sec_cb.pairing_state, btm_sec_cb.pairing_flags, btm_sec_cb.pin_code_len);

  /* Reset btm state only if the callback address matches pairing
   * address*/
  /* Reset btm state only if the callback address matches pairing address */
  if (bd_addr == btm_sec_cb.pairing_bda) {
    btm_sec_cb.pairing_bda = RawAddress::kAny;
    btm_sec_cb.pairing_state = BTM_PAIR_STATE_IDLE;