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

Commit d19485ec authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Cleanup GATT cache when remote device is disconnected

According to Bluetooth spec, GATT cache should not be persisted between
reconnections for unbonded devices. Bonded devices store the cache on
the disk and will read it on reconnection.

Bug: 33123476
Test: sl4a GattReadTest
Change-Id: If2ca53c7b22a346e7236514ea7b461695c923f74
parent 6b659db2
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -273,6 +273,12 @@ void bta_gattc_clcb_dealloc(tBTA_GATTC_CLCB* p_clcb) {
      p_srcb->connected = false;
      p_srcb->state = BTA_GATTC_SERV_IDLE;
      p_srcb->mtu = 0;

      /* clean up cache */
      if (p_srcb->p_srvc_cache) {
        list_free(p_srcb->p_srvc_cache);
        p_srcb->p_srvc_cache = NULL;
      }
    }

    osi_free_and_reset((void**)&p_clcb->p_q_cmd);