Do not allow LE connection timeout smaller than 1s for HID devices
Bug: 28979841
Change-Id: I520608a13224601fb9101d00c08b34cdb0f8d374
diff --git a/bta/hh/bta_hh_le.c b/bta/hh/bta_hh_le.c
index 5d23d81..b44d86f 100644
--- a/bta/hh/bta_hh_le.c
+++ b/bta/hh/bta_hh_le.c
@@ -1756,6 +1756,9 @@
if (max < BTM_BLE_CONN_INT_MIN_LIMIT)
max = BTM_BLE_CONN_INT_MIN_LIMIT;
+ if (tout < BTM_BLE_CONN_TIMEOUT_MIN_DEF)
+ tout = BTM_BLE_CONN_TIMEOUT_MIN_DEF;
+
BTM_BleSetPrefConnParams (p_dev_cb->addr, min, max, latency, tout);
L2CA_UpdateBleConnParams(p_dev_cb->addr, min, max, latency, tout);
}
diff --git a/stack/include/btm_ble_api.h b/stack/include/btm_ble_api.h
index 92b8fda..bc66425 100644
--- a/stack/include/btm_ble_api.h
+++ b/stack/include/btm_ble_api.h
@@ -186,6 +186,11 @@
#define BTM_BLE_CONN_TIMEOUT_DEF 2000
#endif
+/* minimum supervision timeout */
+#ifndef BTM_BLE_CONN_TIMEOUT_MIN_DEF
+#define BTM_BLE_CONN_TIMEOUT_MIN_DEF 100
+#endif
+
/* minimum acceptable connection interval */
#ifndef BTM_BLE_CONN_INT_MIN_LIMIT
#define BTM_BLE_CONN_INT_MIN_LIMIT 0x0009