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

Commit 1d5499c2 authored by Andre Eisenbach's avatar Andre Eisenbach
Browse files

Add LE device to device database before adding LE keys

A small bug in btif_read_le_key() would prevent a paired LE device from
being added back into the internal device database after reboot, causing
the security keys not being loaded.

Also added a debug statement to trace keys being loaded.

Bug: 20091926
Change-Id: Id2d6c69497857edc21e2d4c6a67ad9e8dadabcaa
parent 724e51fb
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -561,11 +561,15 @@ static void btif_read_le_key(const uint8_t key_type, const size_t key_len, bt_bd
            BD_ADDR bta_bd_addr;
            bdcpy(bta_bd_addr, bd_addr.address);

            if (!device_added)
            if (!*device_added)
            {
                BTA_DmAddBleDevice(bta_bd_addr, addr_type, BT_DEVICE_TYPE_BLE);
                *device_added = true;
            }

            char bd_str[20] = {0};
            BTIF_TRACE_DEBUG("%s() Adding key type %d for %s", __func__,
                key_type, bdaddr_to_string(&bd_addr, bd_str, sizeof(bd_str)));
            BTA_DmAddBleKey(bta_bd_addr, (tBTA_LE_KEY_VALUE *)buffer, key_type);
        }