summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKausik Sinnaswamy <kausik@broadcom.com>2012-06-11 17:32:34 +0530
committerMatthew Xie <mattx@google.com>2012-07-14 11:19:22 -0700
commit9732649df910f59414250198494726c70a056a69 (patch)
treee50949e5ff6f3f4f51390cc7ed324af16a310e2e
parentcd32975c3238fdbf7f60839092b8f6e1bf795321 (diff)
downloadexternal_bluetooth_bluedroid-9732649df910f59414250198494726c70a056a69.zip
external_bluetooth_bluedroid-9732649df910f59414250198494726c70a056a69.tar.gz
external_bluetooth_bluedroid-9732649df910f59414250198494726c70a056a69.tar.bz2
Send bond_state_bonded only after SDP is complete
With instrumentation tests, there were race conditions where the while SDP was in progress after bonding, the next iteration of bonding was triggerred. The fix was to ensure that the bonded callback is sent only after SDP is complete Change-Id: I07269b9188aa00eb91f8ecc089b9beb7dbff7af6
-rwxr-xr-xbtif/src/btif_dm.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index c3de6f8..5e81480 100755
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -748,6 +748,7 @@ static void btif_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
/* Trigger SDP on the device */
btif_dm_get_remote_services(&bd_addr);
+ /* Do not call bond_state_changed_cb yet. Wait till fetch remote service is complete */
}
else
{
@@ -791,8 +792,8 @@ static void btif_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
default:
status = BT_STATUS_FAIL;
}
+ bond_state_changed(status, &bd_addr, state);
}
- bond_state_changed(status, &bd_addr, state);
}
/******************************************************************************
@@ -1003,6 +1004,13 @@ static void btif_dm_search_services_evt(UINT16 event, char *p_param)
/* Send the event to the BTIF */
HAL_CBACK(bt_hal_cbacks, remote_device_properties_cb,
BT_STATUS_SUCCESS, &bd_addr, 1, &prop);
+ if ((pairing_cb.state == BT_BOND_STATE_BONDING) &&
+ bdcmp(p_data->disc_res.bd_addr, pairing_cb.bd_addr) == 0)
+ {
+ BTIF_TRACE_DEBUG1("%s Remote Service SDP done. Call bond_state_changed_cb BONDED",
+ __FUNCTION__);
+ bond_state_changed(BT_STATUS_SUCCESS, &bd_addr, BT_BOND_STATE_BONDED);
+ }
}
break;