When a device connect to android over LE, the default policy is to keep
this connection. If any app "claims" this connnection, and then stop
using it, we'll disconnect from the device after a short timeout.
If pairing is triggered to such device, that is connected but not used
by any app, it will cause disconnect after the pairing is finished. This
is because using SMP over fixed LE L2CAP channel is conseidered as
connecting, using, and disconnecting a channel by the stack. This is
obvious logic error - using fixed channels should not require
"connecting" to them.
As a temporary workaround, do not trigger a timeout when a fixed SMP
channel is closed over LE.
For LE only devices, this means they will stay connected after the
pairing until some app starts using them or they disconnect. For dual
mode devices, Classic connection will be established and SDP will be
performed. The classic connection will be disconnected if no app will
use it, and the LE connection to the device will stay up.
Bug:
37352720
Test: manual
Change-Id: Ic9d688aacf84e0267277b12b28dfa7cc57fdcea6
(cherry picked from commit
7c8bab231328956d3b7569280cb162be4e345422)
/* If no channels on the connection, start idle timeout */
if ((p_lcb) && p_lcb->in_use && (p_lcb->link_state == LST_CONNECTED)) {
if (!p_lcb->ccb_queue.p_first_ccb) {
+ // Closing a security channel on LE device should not start connection
+ // timeout
+ if (p_lcb->transport == BT_TRANSPORT_LE &&
+ p_ccb->local_cid == L2CAP_SMP_CID)
+ return;
+
l2cu_no_dynamic_ccbs(p_lcb);
} else {
/* Link is still active, adjust channel quotas. */