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

Commit 47df4907 authored by Michał Narajowski's avatar Michał Narajowski
Browse files

bta: Fix using stored db to save reconnection time

Db is loaded in bta_gattc_conn which checks for RobustCaching
support using that loaded db. Then bta_gattc_start_discover is
called which also does the same check but with p_clcb->p_srcb->gatt_database
which is empty because it was only set if there was no support for
caching.

Bug: 274408908
Test: manual: listen to music via earbuds, put one in the case, take it
out and expect immediate reconnection.
Tag: #feature

Change-Id: I145518c7c867c1463065c4b3a912606fe4d3d0c4
parent 10e396c9
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -553,6 +553,9 @@ void bta_gattc_conn(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) {
      LOG_INFO("Connected to %s, robust caching support is %d",
               p_clcb->bda.ToRedactedStringForLogging().c_str(),
               robust_caching_support);

      if (!db.IsEmpty()) p_clcb->p_srcb->gatt_database = db;

      if (db.IsEmpty() ||
          robust_caching_support == RobustCachingSupport::SUPPORTED) {
        // If the peer device is expected to support robust caching, or if we
@@ -569,7 +572,6 @@ void bta_gattc_conn(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) {
        /* cache load failure, start discovery */
        bta_gattc_start_discover(p_clcb, NULL);
      } else {
        p_clcb->p_srcb->gatt_database = db;
        p_clcb->p_srcb->state = BTA_GATTC_SERV_IDLE;
        bta_gattc_reset_discover_st(p_clcb->p_srcb, GATT_SUCCESS);
      }