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

Commit 9421a1ec authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Fix GATT not working due to address mismatch am: ebe82c6f

am: 3a8bee44

Change-Id: Ifdf1d94dfb8553a371224520ffd87d3eade06011
parents a4d66f11 3a8bee44
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -1923,15 +1923,21 @@ void btm_ble_conn_complete(uint8_t* p, UNUSED_ATTR uint16_t evt_len,

#if (BLE_PRIVACY_SPT == TRUE)
    peer_addr_type = bda_type;

    if (peer_addr_type & BLE_ADDR_TYPE_ID_BIT) {
    bool addr_is_rpa =
        (peer_addr_type == BLE_ADDR_RANDOM && BTM_BLE_IS_RESOLVE_BDA(bda));

    /* We must translate whatever address we received into the "pseudo" address.
     * i.e. if we bonded with device that was using RPA for first connection,
     * "pseudo" address is equal to this RPA. If it later decides to use Public
     * address, or Random Static Address, we convert it into the "pseudo"
     * address here. */
    if (!addr_is_rpa || peer_addr_type & BLE_ADDR_TYPE_ID_BIT) {
      match = btm_identity_addr_to_random_pseudo(&bda, &bda_type, true);
    }

    /* possiblly receive connection complete with resolvable random while
       the device has been paired */
    if (!match && peer_addr_type == BLE_ADDR_RANDOM &&
        BTM_BLE_IS_RESOLVE_BDA(bda)) {
    if (!match && addr_is_rpa) {
      tBTM_SEC_DEV_REC* match_rec = btm_ble_resolve_random_addr(bda);
      if (match_rec) {
        LOG_INFO(LOG_TAG, "%s matched and resolved random address", __func__);