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

Commit 125e273b authored by Archie Pusaka's avatar Archie Pusaka
Browse files

Floss: connect to LE identity addr if current random is unavailable

When restarting adapter, the current random address is uninitialized
making it's impossible to reconnect to LE device with Floss.
Use the current random address only if it's available.

Bug: 284012338
Test: Do the following steps.
      (1) Pair an LE device with IRK (e.g. MX Master 2S mouse)
      (2) Power off BT, power back on
      (3) Verify peer reconnects
Change-Id: Icf9a89783f26d00590b3c745af9857179204fd0a
parent e759dd8d
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -84,13 +84,16 @@ const tBLE_BD_ADDR convert_to_address_with_type(
    };
  } else {
    // Floss doesn't support LL Privacy (yet). To expedite ARC testing, always
    // connect to the latest LE random address rather than redesign.
    // connect to the latest LE random address (if available) rather than
    // redesign.
    // TODO(b/235218533): Remove when LL Privacy is implemented.
#if TARGET_FLOSS
    if (!p_dev_rec->ble.cur_rand_addr.IsEmpty()) {
      return {
          .type = BLE_ADDR_RANDOM,
        .bda = p_dev_rec->ble.cur_rand_addr.address,
          .bda = p_dev_rec->ble.cur_rand_addr,
      };
    }
#endif
    return p_dev_rec->ble.identity_address_with_type;
  }