When bonding, there is an ACL_UP event to the upper layers and some apps
may want to fetch SDP in return. This can break pairing. In cases SDP fails,
it causes the procedure to be finished before the LinkKey is generated.
And thus the LinkKey is not committed to NVRAM and the device is not paired.
Bug:
111189110
Test: : Pair / Unpair BT accessories manually
Change-Id: Iaefbe8b6c1fc3e78f0f120220992df84699a2eb8
if ((p_data->disc_res.result != BTA_SUCCESS) &&
(pairing_cb.state == BT_BOND_STATE_BONDING) &&
(pairing_cb.sdp_attempts < BTIF_DM_MAX_SDP_ATTEMPTS_AFTER_PAIRING)) {
- BTIF_TRACE_WARNING("%s:SDP failed after bonding re-attempting",
- __func__);
- pairing_cb.sdp_attempts++;
- btif_dm_get_remote_services(bd_addr);
+ if (pairing_cb.sdp_attempts) {
+ BTIF_TRACE_WARNING("%s: SDP failed after bonding re-attempting",
+ __func__);
+ pairing_cb.sdp_attempts++;
+ btif_dm_get_remote_services(bd_addr);
+ } else {
+ BTIF_TRACE_WARNING("%s: SDP triggered by someone failed when bonding",
+ __func__);
+ }
return;
}
prop.type = BT_PROPERTY_UUIDS;