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

Commit 61d5e354 authored by Jacky Cheung's avatar Jacky Cheung Committed by Zheng Zhang
Browse files

DO NOT MERGE ANYWHERE: Disable the use of GATT cache by default.

When a set of GATT services of a bonded device is cached locally,
an application needs to call BluetoothGatt.refresh() to clear it out
and to trigger a new service discovery.  By disabling local caching,
a service discovery is performed on every connection and that prevents
an application from getting staled GATT services.

bug: 68954828
Change-Id: I2c07404c3d56a5c8a0ffc86bc65d36480f3c46f2
parent 12828916
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -1517,6 +1517,12 @@ void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
*******************************************************************************/
*******************************************************************************/
bool bta_gattc_cache_load(tBTA_GATTC_CLCB *p_clcb)
bool bta_gattc_cache_load(tBTA_GATTC_CLCB *p_clcb)
{
{

#if (defined WEAR_DISABLE_GATT_CACHE && WEAR_DISABLE_GATT_CACHE == TRUE)
    LOG_WARN(LOG_TAG, "%s GATT cache not used.", __func__);
    return false;
#endif

    char fname[255] = {0};
    char fname[255] = {0};
    bta_gattc_generate_cache_file_name(fname, p_clcb->p_srcb->server_bda);
    bta_gattc_generate_cache_file_name(fname, p_clcb->p_srcb->server_bda);


+8 −0
Original line number Original line Diff line number Diff line
@@ -1592,4 +1592,12 @@ The maximum number of payload octets that the local device can receive in a sing
#define WEAR_AUTO_CONN_IDLE_INTERVAL_1_25_MS  72
#define WEAR_AUTO_CONN_IDLE_INTERVAL_1_25_MS  72
#endif
#endif


/*
 * Disable the use of local GATT cache.  This forces service discovery on connection
 * establishment.
 */
#ifndef WEAR_DISABLE_GATT_CACHE
#define WEAR_DISABLE_GATT_CACHE               TRUE
#endif

#endif /* BT_TARGET_H */
#endif /* BT_TARGET_H */