summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Eisenbach <eisenbach@google.com>2015-02-05 03:38:43 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-02-05 03:38:43 +0000
commit977acabd3744a3308057b1485c7ac8658698e96b (patch)
tree486f24e9f502830fa78808929de03d0a07b446c1
parent595bcb4c72aaa2a9a54a23b127dd5fa9842876ca (diff)
parenteebc8ab9c5e362d721f8f606f0a564ca9aff89d9 (diff)
downloadbluedroid-977acabd3744a3308057b1485c7ac8658698e96b.tar.gz
am eebc8ab9: DO NOT MERGE Change pairing_cb to assume temporary pairing by default
* commit 'eebc8ab9c5e362d721f8f606f0a564ca9aff89d9': DO NOT MERGE Change pairing_cb to assume temporary pairing by default
-rw-r--r--btif/src/btif_dm.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index cd75b3e..f907b67 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -77,11 +77,15 @@
#define BTIF_DM_INTERLEAVE_DURATION_LE_TWO 4
#endif
+#define BOND_TYPE_UNKNOWN 0
+#define BOND_TYPE_PERSISTENT 1
+#define BOND_TYPE_TEMPORARY 2
+
typedef struct
{
bt_bond_state_t state;
BD_ADDR bd_addr;
- UINT8 is_temp;
+ UINT8 bond_type;
UINT8 pin_code_len;
UINT8 is_ssp;
UINT8 autopair_attempts;
@@ -335,7 +339,7 @@ static void bond_state_changed(bt_status_t status, bt_bdaddr_t *bd_addr, bt_bond
if ( (pairing_cb.state == state) && (state == BT_BOND_STATE_BONDING) )
return;
- if (pairing_cb.is_temp)
+ if (pairing_cb.bond_type == BOND_TYPE_TEMPORARY)
{
state = BT_BOND_STATE_NONE;
}
@@ -744,9 +748,9 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_ssp_cfm_req)
if (p_ssp_cfm_req->just_works && !(p_ssp_cfm_req->loc_auth_req & BTM_AUTH_BONDS) &&
!(p_ssp_cfm_req->rmt_auth_req & BTM_AUTH_BONDS) &&
!(check_cod((bt_bdaddr_t*)&p_ssp_cfm_req->bd_addr, COD_HID_POINTING)))
- pairing_cb.is_temp = TRUE;
+ pairing_cb.bond_type = BOND_TYPE_TEMPORARY;
else
- pairing_cb.is_temp = FALSE;
+ pairing_cb.bond_type = BOND_TYPE_PERSISTENT;
pairing_cb.is_ssp = TRUE;
@@ -833,11 +837,11 @@ static void btif_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
if ( (p_auth_cmpl->success == TRUE) && (p_auth_cmpl->key_present) )
{
if ((p_auth_cmpl->key_type < HCI_LKEY_TYPE_DEBUG_COMB) || (p_auth_cmpl->key_type == HCI_LKEY_TYPE_AUTH_COMB) ||
- (p_auth_cmpl->key_type == HCI_LKEY_TYPE_CHANGED_COMB) || (!pairing_cb.is_temp))
+ (p_auth_cmpl->key_type == HCI_LKEY_TYPE_CHANGED_COMB) || pairing_cb.bond_type == BOND_TYPE_PERSISTENT)
{
bt_status_t ret;
- BTIF_TRACE_DEBUG3("%s: Storing link key. key_type=0x%x, is_temp=%d",
- __FUNCTION__, p_auth_cmpl->key_type, pairing_cb.is_temp);
+ BTIF_TRACE_DEBUG3("%s: Storing link key. key_type=0x%x, bond_type=%d",
+ __FUNCTION__, p_auth_cmpl->key_type, pairing_cb.bond_type);
ret = btif_storage_add_bonded_device(&bd_addr,
p_auth_cmpl->key, p_auth_cmpl->key_type,
pairing_cb.pin_code_len);
@@ -845,8 +849,15 @@ static void btif_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
}
else
{
- BTIF_TRACE_DEBUG3("%s: Temporary key. Not storing. key_type=0x%x, is_temp=%d",
- __FUNCTION__, p_auth_cmpl->key_type, pairing_cb.is_temp);
+ BTIF_TRACE_DEBUG3("%s: Temporary key. Not storing. key_type=0x%x, bond_type=%d",
+ __FUNCTION__, p_auth_cmpl->key_type, pairing_cb.bond_type);
+ if(pairing_cb.bond_type == BOND_TYPE_TEMPORARY)
+ {
+ BTIF_TRACE_DEBUG1("%s: sending BT_BOND_STATE_NONE for Temp pairing",
+ __FUNCTION__);
+ bond_state_changed(BT_STATUS_SUCCESS, &bd_addr, BT_BOND_STATE_NONE);
+ return;
+ }
}
}
if (p_auth_cmpl->success)
@@ -2520,7 +2531,7 @@ void btif_dm_ble_sec_req_evt(tBTA_DM_BLE_SEC_REQ *p_ble_req)
bond_state_changed(BT_STATUS_SUCCESS, &bd_addr, BT_BOND_STATE_BONDING);
- pairing_cb.is_temp = FALSE;
+ pairing_cb.bond_type = BOND_TYPE_PERSISTENT;
pairing_cb.is_le_only = TRUE;
pairing_cb.is_ssp = TRUE;