From a86618a954d1ac72b70338982352895f6e6187df Mon Sep 17 00:00:00 2001 From: Jakub Pawlowski Date: Tue, 29 Nov 2016 11:45:09 -0800 Subject: [PATCH] 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 9580a30918c256cf20fdb68823115864155e6243) --- bta/gatt/bta_gattc_utils.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bta/gatt/bta_gattc_utils.c b/bta/gatt/bta_gattc_utils.c index bd0d466f5..8910bd367 100644 --- a/bta/gatt/bta_gattc_utils.c +++ b/bta/gatt/bta_gattc_utils.c @@ -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); -- 2.11.0