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

Commit 46b807a8 authored by Jack He's avatar Jack He Committed by Automerger Merge Worker
Browse files

Merge "bta_gattc_cache: Use GATT caching for devices with LMP version 5.1" am:...

Merge "bta_gattc_cache: Use GATT caching for devices with LMP version 5.1" am: 9aa1316e am: d3b9bbee am: e9a5b54a am: 397169fc am: 7234d763

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2238425



Change-Id: Ib77457cb85cc5c6327781afde50dafeb946c612e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f780fdef 7234d763
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -768,6 +768,26 @@ void bta_gattc_start_discover(tBTA_GATTC_CLCB* p_clcb,
      p_clcb->p_srcb->update_count = 0;
      p_clcb->p_srcb->state = BTA_GATTC_SERV_DISC_ACT;

      /* This is workaround for the embedded devices being already on the market
       * and having a serious problem with handle Read By Type with
       * GATT_UUID_DATABASE_HASH. With this workaround, Android will assume that
       * embedded device having LMP version lower than 5.1 (0x0a), it does not
       * support GATT Caching.
       */
      uint8_t lmp_version = 0;
      if (!BTM_ReadRemoteVersion(p_clcb->bda, &lmp_version, nullptr, nullptr)) {
        LOG_WARN("Could not read remote version for %s",
                 p_clcb->bda.ToString().c_str());
      }

      if (lmp_version < 0x0a) {
        LOG_WARN(
            " Device LMP version 0x%02x < Bluetooth 5.1. Ignore database cache "
            "read.",
            lmp_version);
        p_clcb->p_srcb->srvc_hdl_db_hash = false;
      }

      /* read db hash if db hash characteristic exists */
      if (bta_gattc_is_robust_caching_enabled() &&
          p_clcb->p_srcb->srvc_hdl_db_hash &&