From: Nitin Arora Date: Wed, 13 Apr 2016 22:53:03 +0000 (-0700) Subject: Avoid skipping SDP after link key derivation X-Git-Tag: android-x86-8.1-r1~196^2~67^2~174^2~100 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=6e8198a22da7871a611ef991772ee827a69a9c46;p=android-x86%2Fsystem-bt.git Avoid skipping SDP after link key derivation Use Case: In case of cross key derivation of BR link key from a secure LTK, the corresponding BR transport needs to go through the SDP routine and alert the upper layers regarding the bond completion of the BR transport. This specific procedure is currently getting skipped in an attempt to prevent spurious link key notifications from causing bond state changes Fix: Added an additional check to make sure that the LE pairing is not ongoing before skipping the SDP. This uses the sequence of operations where the LE LTK is generated first and link key is derived from the LTK. Test: mma -j32 Change-Id: Ife242c93c3adf90d581ac0bbf4896dd164b9f8e2 --- diff --git a/btif/src/btif_dm.cc b/btif/src/btif_dm.cc index 162e2c24c..1f5c5ed2d 100644 --- a/btif/src/btif_dm.cc +++ b/btif/src/btif_dm.cc @@ -1061,11 +1061,14 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) { } // We could have received a new link key without going through the pairing - // flow. - // If so, we don't want to perform SDP or any other operations on the - // authenticated - // device. - if (bdcmp(p_auth_cmpl->bd_addr, pairing_cb.bd_addr) != 0) { + // flow. If so, we don't want to perform SDP or any other operations on the + // authenticated device. Also, make sure that the link key is not derived from + // secure LTK, because we will need to perform SDP in case of link key + // derivation to allow bond state change notification for the BR/EDR transport + // so that the subsequent BR/EDR connections to the remote can use the derived + // link key. + if ((bdcmp(p_auth_cmpl->bd_addr, pairing_cb.bd_addr) != 0) && + (!pairing_cb.ble.is_penc_key_rcvd)) { char address[32]; bt_bdaddr_t bt_bdaddr;