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

Commit 2b9be1e3 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
(cherry picked from commit d19485ec)
parent c5713dfd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -302,6 +302,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);