OSDN Git Service

Add device record for BR/EDR devices with derived LE keys
authorSubramanian Srinivasan <subrsrin@codeaurora.org>
Fri, 14 Oct 2016 22:43:34 +0000 (15:43 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Fri, 14 Oct 2016 22:47:03 +0000 (15:47 -0700)
Loads BLE keys stored in NVRAM to btm_sec database for BR/EDR
devices with cross transport derived LE keys after BT reset.
This change also makes sure that after BT reset, while loading
the bonded devices from NVRAM, the bonded devices(with device
type BR/EDR and having derived BLE keys) are also added to the
resolving list after loading the IRK into btm_sec database.

Test: vendor
Change-Id: I1c9164a947526cf2ea36156458d148f5cbee778f

btif/src/btif_storage.cc

index c95fdeb..638c45f 100644 (file)
@@ -161,6 +161,8 @@ static bt_status_t btif_in_fetch_bonded_ble_device(const char *remote_bd_addr,in
                                               btif_bonded_devices_t *p_bonded_devices);
 static bt_status_t btif_in_fetch_bonded_device(const char *bdstr);
 
+static bool btif_has_ble_keys(const char *bdstr);
+
 /************************************************************************************
 **  Static functions
 ************************************************************************************/
@@ -1190,7 +1192,8 @@ static bt_status_t btif_in_fetch_bonded_ble_device(const char *remote_bd_addr, i
     if (!btif_config_get_int(remote_bd_addr, "DevType", &device_type))
         return BT_STATUS_FAIL;
 
-    if ((device_type & BT_DEVICE_TYPE_BLE) == BT_DEVICE_TYPE_BLE)
+    if ((device_type & BT_DEVICE_TYPE_BLE) == BT_DEVICE_TYPE_BLE ||
+            btif_has_ble_keys(remote_bd_addr))
     {
         BTIF_TRACE_DEBUG("%s Found a LE device: %s", __func__, remote_bd_addr);
 
@@ -1243,6 +1246,11 @@ bt_status_t btif_storage_set_remote_addr_type(bt_bdaddr_t *remote_bd_addr,
     return ret ? BT_STATUS_SUCCESS : BT_STATUS_FAIL;
 }
 
+bool btif_has_ble_keys(const char *bdstr)
+{
+    return btif_config_exist(bdstr, "LE_KEY_PENC");
+}
+
 /*******************************************************************************
 **
 ** Function         btif_storage_get_remote_addr_type