From: Nitin Arora Date: Mon, 25 Jul 2016 18:33:19 +0000 (-0700) Subject: Bluetooth: Add logic to cancel link timeout alarm X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=50db3838b079a0cf282d1451fe5d46adbaf676d5;p=android-x86%2Fsystem-bt.git Bluetooth: Add logic to cancel link timeout alarm Issue: Post bonding process, temporary gatt connections are created to perform device name discovery and remote device discovery before any profile level connections are made for remote devices. At every disconnection the number of apps holding the physical link is validated to keep the link alive. A disconnection starts the idle timeout of 1sec if there is no other apps available. However, a new logical connection is unable to reset the timer, even if the link comes up, within 1sec of the last disconnection. Fix: At every connection occuring within the "No app timeout", the link timer is cancelled since there is still a gatt_if that needs to keep the link alive. CRs-Fixed: 1050047 Change-Id: I3205894e4d692e4e8b1a547b6fb4d346c4f281a5 --- diff --git a/stack/gatt/gatt_main.c b/stack/gatt/gatt_main.c index 8bbd6503b..9ed17dfbf 100644 --- a/stack/gatt/gatt_main.c +++ b/stack/gatt/gatt_main.c @@ -417,7 +417,7 @@ BOOLEAN gatt_act_connect (tGATT_REG *p_reg, BD_ADDR bd_addr, tBT_TRANSPORT trans if (ret) { - gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, TRUE, FALSE); + gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, TRUE, TRUE); } return ret; diff --git a/stack/l2cap/l2c_utils.c b/stack/l2cap/l2c_utils.c old mode 100755 new mode 100644 index aaf65d727..e77417535 --- a/stack/l2cap/l2c_utils.c +++ b/stack/l2cap/l2c_utils.c @@ -2870,13 +2870,17 @@ void l2cu_no_dynamic_ccbs (tL2C_LCB *p_lcb) } } + if (timeout_ms == (1000) * (0xFFFF)) + start_timeout = false; + if (start_timeout) { - L2CAP_TRACE_DEBUG("%s starting IDLE timeout: %d ms", __func__, + L2CAP_TRACE_DEBUG("%s starting IDLE timeout: %llu ms", __func__, timeout_ms); alarm_set_on_queue(p_lcb->l2c_lcb_timer, timeout_ms, l2c_lcb_timer_timeout, p_lcb, btu_general_alarm_queue); } else { + L2CAP_TRACE_DEBUG("%s, alarm cancel", __func__); alarm_cancel(p_lcb->l2c_lcb_timer); } }