summaryrefslogtreecommitdiffstats
path: root/btif/src
diff options
context:
space:
mode:
authorSreenidhi T <nidhit@broadcom.com>2012-03-30 02:00:55 -0700
committerMatthew Xie <mattx@google.com>2012-07-14 11:19:13 -0700
commit2e33c936064af00e6ec9a704a01e6b36eb8cd5c8 (patch)
treefd2ed49f691bae15ea6240e1af8d634471da5d23 /btif/src
parent52f2d221d391280dff0f38cd3c504d85e3a1128b (diff)
downloadexternal_bluetooth_bluedroid-2e33c936064af00e6ec9a704a01e6b36eb8cd5c8.zip
external_bluetooth_bluedroid-2e33c936064af00e6ec9a704a01e6b36eb8cd5c8.tar.gz
external_bluetooth_bluedroid-2e33c936064af00e6ec9a704a01e6b36eb8cd5c8.tar.bz2
Added the check for incoming pairing consent for JustWorks.
Change-Id: I2b2b70068718dbfbbea759bb5cb3f1fe67b645ba
Diffstat (limited to 'btif/src')
-rw-r--r--btif/src/btif_dm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index 75a844f..fa0330e 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -321,6 +321,10 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_ssp_cfm_req)
bt_bdaddr_t bd_addr;
bt_bdname_t bd_name;
UINT32 cod;
+ BOOLEAN incoming_bonding;
+
+ /* if bonding state is BT_BOND_STATE_BONDING, then we initiated it */
+ incoming_bonding = !(pairing_cb.state == BT_BOND_STATE_BONDING);
BTIF_TRACE_DEBUG1("%s", __FUNCTION__);
bdcpy(bd_addr.address, p_ssp_cfm_req->bd_addr);
@@ -336,8 +340,8 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_ssp_cfm_req)
else
pairing_cb.is_temp = TRUE;
- /* If JustWorks auto-accept */
- if (p_ssp_cfm_req->just_works)
+ /* If JustWorks auto-accept if we initiated bonding */
+ if (p_ssp_cfm_req->just_works && !incoming_bonding)
{
BTIF_TRACE_EVENT1("%s: Auto-accept JustWorks pairing", __FUNCTION__);
btif_dm_ssp_reply(&bd_addr, BT_SSP_VARIANT_CONSENT, TRUE, 0);
@@ -353,7 +357,7 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_ssp_cfm_req)
/* TODO: pairing variant passkey_entry? */
HAL_CBACK(bt_hal_cbacks, ssp_request_cb, &bd_addr, &bd_name,
- cod, BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
+ cod, p_ssp_cfm_req->just_works ? BT_SSP_VARIANT_CONSENT : BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
p_ssp_cfm_req->num_val);
}