am f1029c7a: Remove stored link key for temporarily paired devices
* commit 'f1029c7afb9b4c9fcf95b3f98ce9c68b10d5a02c':
Remove stored link key for temporarily paired devices
diff --git a/btif/include/btif_storage.h b/btif/include/btif_storage.h
index 54dc5d6..b650cae 100644
--- a/btif/include/btif_storage.h
+++ b/btif/include/btif_storage.h
@@ -133,6 +133,18 @@
*******************************************************************************/
bt_status_t btif_storage_remove_bonded_device(bt_bdaddr_t *remote_bd_addr);
+/******************************************************************************
+**
+** Function btif_storage_is_device_bonded
+**
+** Description BTIF storage API - checks if device present in bonded list
+**
+** Returns TRUE if the device is bonded,
+** FALSE otherwise
+**
+*******************************************************************************/
+BOOLEAN btif_storage_is_device_bonded(bt_bdaddr_t *remote_bd_addr);
+
/*******************************************************************************
**
** Function btif_storage_remove_bonded_device
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index 24aad27..3b4523f 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -1116,6 +1116,9 @@
{
BTIF_TRACE_DEBUG("%s: sending BT_BOND_STATE_NONE for Temp pairing",
__FUNCTION__);
+ if (btif_storage_is_device_bonded(&bd_addr) == TRUE) {
+ btif_storage_remove_bonded_device(&bd_addr);
+ }
bond_state_changed(BT_STATUS_SUCCESS, &bd_addr, BT_BOND_STATE_NONE);
return;
}
diff --git a/btif/src/btif_storage.c b/btif/src/btif_storage.c
index ca89077..7c5d6d6 100644
--- a/btif/src/btif_storage.c
+++ b/btif/src/btif_storage.c
@@ -591,6 +591,23 @@
* the property->type.
*******************************************************************************/
+/*****************************************************************************
+**
+** Function btif_storage_is_device_bonded
+**
+** Description BTIF storage API - checks if device present in bonded list
+**
+** Returns TRUE if the device is bonded,
+** FALSE otherwise
+**
+*******************************************************************************/
+BOOLEAN btif_storage_is_device_bonded(bt_bdaddr_t *remote_bd_addr)
+{
+ bdstr_t bdstr;
+ bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
+ return (btif_in_fetch_bonded_device(bdstr) == BT_STATUS_SUCCESS);
+}
+
/*******************************************************************************
**
** Function btif_storage_get_adapter_property