Do not rediscover HOGP device services on restart
HOGP host rediscovers the remote database on restart because HID
report cache is reset.
Test: Reconnect HOGP device, check logs for service discovery
Test: mma
Test: m com.android.btservices
Bug: 305117417
(cherry picked from https://android-review.googlesource.com/q/commit:9a16b47ee22bd168c85d063a1487e95345596e0f)
Merged-In: I86404ed3abef120a817f4df74ab29d773cf3601f
Change-Id: I86404ed3abef120a817f4df74ab29d773cf3601f
Bug: 306295166
diff --git a/system/bta/hh/bta_hh_le.cc b/system/bta/hh/bta_hh_le.cc
index 1047ed0..ac8bb48 100644
--- a/system/bta/hh/bta_hh_le.cc
+++ b/system/bta/hh/bta_hh_le.cc
@@ -978,16 +978,18 @@
APPL_TRACE_DEBUG("%s", __func__);
if (p_cb->status == BTA_HH_OK) {
if (p_cb->hid_srvc.state < BTA_HH_SERVICE_DISCOVERED) {
- APPL_TRACE_DEBUG("bta_hh_security_cmpl no reports loaded, try to load");
+ LOG_DEBUG("No reports loaded, try to load");
/* start loading the cache if not in stack */
tBTA_HH_RPT_CACHE_ENTRY* p_rpt_cache;
uint8_t num_rpt = 0;
if ((p_rpt_cache = bta_hh_le_co_cache_load(p_cb->addr, &num_rpt,
p_cb->app_id)) != NULL) {
+ LOG_DEBUG("Cache found, no need to perform service discovery");
bta_hh_process_cache_rpt(p_cb, p_rpt_cache, num_rpt);
}
}
+
/* discovery has been done for HID service */
if (p_cb->app_id != 0 &&
p_cb->hid_srvc.state >= BTA_HH_SERVICE_DISCOVERED) {
@@ -2221,7 +2223,7 @@
if (num_rpt != 0) /* no cache is found */
{
- p_cb->hid_srvc.state = BTA_HH_SERVICE_UNKNOWN;
+ p_cb->hid_srvc.state = BTA_HH_SERVICE_DISCOVERED;
/* set the descriptor info */
p_cb->hid_srvc.descriptor.dl_len = p_cb->dscp_info.descriptor.dl_len;