summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Eisenbach <eisenbach@google.com>2016-10-17 17:32:45 -0700
committerAndre Eisenbach <eisenbach@google.com>2016-10-20 11:14:57 -0700
commit667e1fe3d7ccc6e2ce11781443f36fc10e47d9a3 (patch)
treee921d8495dc535f4e997c441b1679ebe8742c3d5
parentf87953f1be45c8f3e6f28610e1ac4dd29be007f1 (diff)
downloadandroid-system-bt-667e1fe3d7ccc6e2ce11781443f36fc10e47d9a3.tar.gz
android-system-bt-667e1fe3d7ccc6e2ce11781443f36fc10e47d9a3.tar.xz
Reset device security flags when pairing fails
Bug: 29998634 Test: manual Change-Id: Icd9a76a065de147372df060c0b9555c75bcf46bc
-rw-r--r--bta/dm/bta_dm_act.c21
-rw-r--r--stack/btm/btm_dev.c19
-rw-r--r--stack/include/btm_api.h9
3 files changed, 36 insertions, 13 deletions
diff --git a/bta/dm/bta_dm_act.c b/bta/dm/bta_dm_act.c
index 5c76faa..acda747 100644
--- a/bta/dm/bta_dm_act.c
+++ b/bta/dm/bta_dm_act.c
@@ -3495,24 +3495,19 @@ static void bta_dm_reset_sec_dev_pending(BD_ADDR remote_bd_addr)
*******************************************************************************/
static void bta_dm_remove_sec_dev_entry(BD_ADDR remote_bd_addr)
{
- UINT16 index = 0;
if ( BTM_IsAclConnectionUp(remote_bd_addr, BT_TRANSPORT_LE) ||
BTM_IsAclConnectionUp(remote_bd_addr, BT_TRANSPORT_BR_EDR))
{
- APPL_TRACE_DEBUG("%s ACL is not down. Schedule for Dev Removal when ACL closes",
- __FUNCTION__);
- for (index = 0; index < bta_dm_cb.device_list.count; index ++)
+ APPL_TRACE_DEBUG("%s ACL is not down. Schedule for Dev Removal when ACL closes",
+ __func__);
+ BTM_SecClearSecurityFlags (remote_bd_addr);
+ for (int i = 0; i < bta_dm_cb.device_list.count; i++)
{
- if (!bdcmp( bta_dm_cb.device_list.peer_device[index].peer_bdaddr, remote_bd_addr))
+ if (!bdcmp( bta_dm_cb.device_list.peer_device[i].peer_bdaddr, remote_bd_addr))
+ {
+ bta_dm_cb.device_list.peer_device[i].remove_dev_pending = TRUE;
break;
- }
- if (index != bta_dm_cb.device_list.count)
- {
- bta_dm_cb.device_list.peer_device[index].remove_dev_pending = TRUE;
- }
- else
- {
- APPL_TRACE_ERROR(" %s Device does not exist in DB", __FUNCTION__);
+ }
}
}
else
diff --git a/stack/btm/btm_dev.c b/stack/btm/btm_dev.c
index 9087e52..1e3f1fe 100644
--- a/stack/btm/btm_dev.c
+++ b/stack/btm/btm_dev.c
@@ -190,6 +190,25 @@ BOOLEAN BTM_SecDeleteDevice (BD_ADDR bd_addr)
/*******************************************************************************
**
+** Function BTM_SecClearSecurityFlags
+**
+** Description Reset the security flags (mark as not-paired) for a given
+** remove device.
+**
+*******************************************************************************/
+extern void BTM_SecClearSecurityFlags (BD_ADDR bd_addr)
+{
+ tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev(bd_addr);
+ if (p_dev_rec == NULL)
+ return;
+
+ p_dev_rec->sec_flags = 0;
+ p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
+ p_dev_rec->sm4 = BTM_SM4_UNKNOWN;
+}
+
+/*******************************************************************************
+**
** Function BTM_SecReadDevName
**
** Description Looks for the device name in the security database for the
diff --git a/stack/include/btm_api.h b/stack/include/btm_api.h
index b3232f4..89b718f 100644
--- a/stack/include/btm_api.h
+++ b/stack/include/btm_api.h
@@ -3324,6 +3324,15 @@ extern BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class,
*******************************************************************************/
extern BOOLEAN BTM_SecDeleteDevice (BD_ADDR bd_addr);
+/*******************************************************************************
+**
+** Function BTM_SecClearSecurityFlags
+**
+** Description Reset the security flags (mark as not-paired) for a given
+** remove device.
+**
+*******************************************************************************/
+extern void BTM_SecClearSecurityFlags (BD_ADDR bd_addr);
/*******************************************************************************
**