From: Srinu Jella Date: Mon, 13 Oct 2014 12:36:01 +0000 (+0530) Subject: Reset the pairing state on pairing failure X-Git-Tag: android-x86-7.1-r1~370^2~98 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=bf3e67e76aa2e7eced6b28669f10b599c08ab931;p=android-x86%2Fsystem-bt.git Reset the pairing state on pairing failure Use case: Test the paring scenario with remote device with security mode 3. STR: 1. Create a connection from Remove dev with Security Mode-3 to DUT. 2. Enter pin key in remote, when pin key pop-up comes in DUT, reject the same. 3. Try to create connection from DUT to Remote dev-2, within 30 seconds. Failure: Create connection not sent from DUT to remote, even though there was no pairing taking place Root cause: As the pairing state is not reset properly it disturbs the next pairing process. Reproducible using MecApp test application. Fix: Reset the pairing state to idle in case stored paring device matches with the device for which the pairing failure happened. Bug: 21896912 Change-Id: I0a9e143a44bb2ae7e296d7d76c1323e517f9cc42 --- diff --git a/stack/btm/btm_sec.c b/stack/btm/btm_sec.c index 34770f73e..e7352994e 100644 --- a/stack/btm/btm_sec.c +++ b/stack/btm/btm_sec.c @@ -4452,6 +4452,14 @@ void btm_sec_connected (UINT8 *bda, UINT16 handle, UINT8 status, UINT8 enc_mode) } else { + /* If the device matches with stored paring address + * reset the paring state to idle */ + if ((btm_cb.pairing_state != BTM_PAIR_STATE_IDLE) && + (memcmp (btm_cb.pairing_bda, bda, BD_ADDR_LEN) == 0)) + { + btm_sec_change_pairing_state(BTM_PAIR_STATE_IDLE); + } + /* can not find the device record and the status is error, * just ignore it */ return;