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

Commit ac098f93 authored by Chienyuan's avatar Chienyuan
Browse files

Do not consolidate pure LE device

Bug: 231443460
Tag: #refactor
Test: gd/cert/run
Test: Pair pure LE device, adb shell dumpsys bluetooth_manager
Change-Id: Ice2ec28f32c154dcf8bb82c084d8939e8d69014a
parent da9bfe44
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -945,6 +945,10 @@ static void remove_devices_with_sample_ltk() {
void btif_storage_load_consolidate_devices(void) {
void btif_storage_load_consolidate_devices(void) {
  btif_bonded_devices_t bonded_devices;
  btif_bonded_devices_t bonded_devices;
  btif_in_fetch_bonded_devices(&bonded_devices, 1);
  btif_in_fetch_bonded_devices(&bonded_devices, 1);
  std::unordered_set<RawAddress> bonded_addresses;
  for (uint16_t i = 0; i < bonded_devices.num_devices; i++) {
    bonded_addresses.insert(bonded_devices.devices[i]);
  }


  std::vector<std::pair<RawAddress, RawAddress>> consolidated_devices;
  std::vector<std::pair<RawAddress, RawAddress>> consolidated_devices;
  for (uint16_t i = 0; i < bonded_devices.num_devices; i++) {
  for (uint16_t i = 0; i < bonded_devices.num_devices; i++) {
@@ -953,7 +957,9 @@ void btif_storage_load_consolidate_devices(void) {
    if (btif_storage_get_ble_bonding_key(
    if (btif_storage_get_ble_bonding_key(
            bonded_devices.devices[i], BTM_LE_KEY_PID, (uint8_t*)&key,
            bonded_devices.devices[i], BTM_LE_KEY_PID, (uint8_t*)&key,
            sizeof(tBTM_LE_PID_KEYS)) == BT_STATUS_SUCCESS) {
            sizeof(tBTM_LE_PID_KEYS)) == BT_STATUS_SUCCESS) {
      if (bonded_devices.devices[i] != key.pid_key.identity_addr) {
      if (bonded_devices.devices[i] != key.pid_key.identity_addr &&
          bonded_addresses.find(key.pid_key.identity_addr) !=
              bonded_addresses.end()) {
        LOG_INFO("found consolidated device %s %s",
        LOG_INFO("found consolidated device %s %s",
                 bonded_devices.devices[i].ToString().c_str(),
                 bonded_devices.devices[i].ToString().c_str(),
                 key.pid_key.identity_addr.ToString().c_str());
                 key.pid_key.identity_addr.ToString().c_str());