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

Commit e9765fc8 authored by Hui Peng's avatar Hui Peng
Browse files

Copy the keys when re-pairing with a new RPA/IRK

With the refactor in aosp/2817298, the ble keys are dropped
in the consolidation process, which causes reconnection issues
as reported in b/315203403

This change makes sure the the BLE keys are correctly copied.

Bug: 315203403
Bug: 315487763
Test: m com.android.btservices
Test: manual | pair with BLE device with RPA1 (generated with IRK1) and repair it with RPA2 generated (by IRK2), re-pairing and reconenction work
Flag: EXEMPT, one-line bug-fix for a regression | critical fix that needs to be included in Q1-2024
Change-Id: Ia9c99681b3f9404dccd0f249ad0d6ab8848dc2f5
parent 2a0e07bb
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -453,6 +453,7 @@ void btm_consolidate_dev(tBTM_SEC_DEV_REC* p_target_rec) {
    if (p_dev_rec->bd_addr == p_target_rec->bd_addr) {
    if (p_dev_rec->bd_addr == p_target_rec->bd_addr) {
      memcpy(p_target_rec, p_dev_rec, sizeof(tBTM_SEC_DEV_REC));
      memcpy(p_target_rec, p_dev_rec, sizeof(tBTM_SEC_DEV_REC));
      p_target_rec->ble = temp_rec.ble;
      p_target_rec->ble = temp_rec.ble;
      p_target_rec->sec_rec.ble_keys = temp_rec.sec_rec.ble_keys;
      p_target_rec->ble_hci_handle = temp_rec.ble_hci_handle;
      p_target_rec->ble_hci_handle = temp_rec.ble_hci_handle;
      p_target_rec->sec_rec.enc_key_size = temp_rec.sec_rec.enc_key_size;
      p_target_rec->sec_rec.enc_key_size = temp_rec.sec_rec.enc_key_size;
      p_target_rec->conn_params = temp_rec.conn_params;
      p_target_rec->conn_params = temp_rec.conn_params;