summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Kyunglyul Hyun <klhyun@google.com> 2024-04-16 18:31:08 +0000
committer Kyunglyul Hyun <klhyun@google.com> 2024-04-23 13:01:51 +0000
commitbe38871d69461d9f1c9be19e7cfd00898ab62bdc (patch)
treecfd2db4e46080371a3ad011030d7dfb380988894
parentbb9fe5deaede9576fc8769827dba4aece26c788c (diff)
Retry reading db hash if canceled
When there are multiple clients connected to a remote device and the client reading db hash is closed, other clients stuck in DISCOVER state. With this CL, it notifies failure of discovery and enable them to restart discoverye to continue discovery. Bug: 331819748 Bug: 335082571 Test: atest BluetoothInstrumentationTests Change-Id: I53950c14208ec56c8139318a1312ab95ab540664
-rw-r--r--system/bta/gatt/bta_gattc_act.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/system/bta/gatt/bta_gattc_act.cc b/system/bta/gatt/bta_gattc_act.cc
index d6994c9622..d23ed8e01f 100644
--- a/system/bta/gatt/bta_gattc_act.cc
+++ b/system/bta/gatt/bta_gattc_act.cc
@@ -709,10 +709,16 @@ void bta_gattc_disc_close(tBTA_GATTC_CLCB* p_clcb,
const tBTA_GATTC_DATA* p_data) {
log::verbose("Discovery cancel conn_id={}", loghex(p_clcb->bta_conn_id));
- if (p_clcb->disc_active)
+ if (p_clcb->disc_active ||
+ (IS_FLAG_ENABLED(gatt_rediscover_on_canceled) &&
+ (p_clcb->request_during_discovery ==
+ BTA_GATTC_DISCOVER_REQ_READ_DB_HASH ||
+ p_clcb->request_during_discovery ==
+ BTA_GATTC_DISCOVER_REQ_READ_DB_HASH_FOR_SVC_CHG))) {
bta_gattc_reset_discover_st(p_clcb->p_srcb, GATT_ERROR);
- else
+ } else {
p_clcb->state = BTA_GATTC_CONN_ST;
+ }
// This function only gets called as the result of a BTA_GATTC_API_CLOSE_EVT
// while in the BTA_GATTC_DISCOVER_ST state. Once the state changes, the