fix(bt/bluedroid): Triggering disconnect event of GAP correctly

This commit is contained in:
baohongde 2023-09-07 16:44:05 +08:00
parent 5a17b753f1
commit 97c1e30e39

View File

@ -2659,19 +2659,7 @@ void btm_acl_connected(BD_ADDR bda, UINT16 handle, UINT8 link_type, UINT8 enc_mo
*******************************************************************************/
void btm_acl_disconnected(UINT16 handle, UINT8 reason)
{
BOOLEAN need_report = TRUE;
#if BTM_SCO_INCLUDED == TRUE
/* If L2CAP doesn't know about it, send it to SCO */
if (!l2c_link_hci_disc_comp (handle, reason)) {
btm_sco_removed (handle, reason);
need_report = FALSE;
}
#else
l2c_link_hci_disc_comp(handle, reason);
#endif /* BTM_SCO_INCLUDED */
if (need_report) {
/* Report BR/EDR ACL disconnection result to upper layer */
tACL_CONN *conn = btm_handle_to_acl(handle);
if (conn) {
@ -2688,7 +2676,15 @@ void btm_acl_disconnected(UINT16 handle, UINT8 reason)
btm_acl_link_stat_report(&evt_data);
}
}
#if BTM_SCO_INCLUDED == TRUE
/* If L2CAP doesn't know about it, send it to SCO */
if (!l2c_link_hci_disc_comp (handle, reason)) {
btm_sco_removed (handle, reason);
}
#else
l2c_link_hci_disc_comp(handle, reason);
#endif /* BTM_SCO_INCLUDED */
#if (SMP_INCLUDED == TRUE)
/* Notify security manager */