Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a16b47e authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

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
Change-Id: I86404ed3abef120a817f4df74ab29d773cf3601f
parent e88e2384
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -978,16 +978,18 @@ void bta_hh_security_cmpl(tBTA_HH_DEV_CB* p_cb,
  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 @@ static void bta_hh_process_cache_rpt(tBTA_HH_DEV_CB* p_cb,

  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;