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

Commit 90dbdde3 authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "unify storage usage across the stack" into main

parents 1abb800e b981f8ef
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@

#include "btif/include/btif_config.h"
#include "device/include/device_iot_config.h"
#include "gd/storage/config_keys.h"
#include "osi/include/osi.h"  // UNUSED_ATTR
#include "stack/include/bt_uuid16.h"
#include "stack/include/btm_sec_api_types.h"
@@ -486,7 +487,7 @@ void bta_ag_rfc_open(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) {
  if (p_scb->conn_service == BTA_AG_HFP) {
    size_t version_value_size = sizeof(p_scb->peer_version);
    if (!btif_config_get_bin(
            p_scb->peer_addr.ToString(), HFP_VERSION_CONFIG_KEY,
            p_scb->peer_addr.ToString(), BTIF_STORAGE_KEY_HFP_VERSION,
            (uint8_t*)&p_scb->peer_version, &version_value_size)) {
      LOG_WARN("%s: Failed read cached peer HFP version for %s", __func__,
               ADDRESS_TO_LOGGABLE_CSTR(p_scb->peer_addr));
@@ -494,7 +495,7 @@ void bta_ag_rfc_open(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) {
    }
    size_t sdp_features_size = sizeof(p_scb->peer_sdp_features);
    if (btif_config_get_bin(
            p_scb->peer_addr.ToString(), HFP_SDP_FEATURES_CONFIG_KEY,
            p_scb->peer_addr.ToString(), BTIF_STORAGE_KEY_HFP_SDP_FEATURES,
            (uint8_t*)&p_scb->peer_sdp_features, &sdp_features_size)) {
      bool sdp_wbs_support = p_scb->peer_sdp_features & BTA_AG_FEAT_WBS_SUPPORT;
      if (!p_scb->received_at_bac && sdp_wbs_support) {
@@ -621,8 +622,8 @@ void bta_ag_rfc_acp_open(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) {
      p_scb, (p_scb->reg_services & ~bta_ag_svc_mask[p_scb->conn_service]));

  size_t version_value_size = sizeof(hfp_version);
  bool get_version =
      btif_config_get_bin(p_scb->peer_addr.ToString(), HFP_VERSION_CONFIG_KEY,
  bool get_version = btif_config_get_bin(
      p_scb->peer_addr.ToString(), BTIF_STORAGE_KEY_HFP_VERSION,
      (uint8_t*)&hfp_version, &version_value_size);

  if (p_scb->conn_service == BTA_AG_HFP && get_version) {
+6 −4
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include "common/init_flags.h"
#include "device/include/interop.h"
#include "device/include/interop_config.h"
#include "gd/storage/config_keys.h"
#include "internal_include/bt_target.h"
#include "os/log.h"
#include "osi/include/allocator.h"
@@ -390,7 +391,7 @@ bool bta_ag_sdp_find_attr(tBTA_AG_SCB* p_scb, tBTA_SERVICE_MASK service) {
      if (peer_version != p_scb->peer_version) {
        p_scb->peer_version = peer_version;
        if (btif_config_set_bin(
                p_scb->peer_addr.ToString(), HFP_VERSION_CONFIG_KEY,
                p_scb->peer_addr.ToString(), BTIF_STORAGE_KEY_HFP_VERSION,
                (const uint8_t*)&peer_version, sizeof(peer_version))) {
        } else {
          LOG_WARN("%s: Failed to store peer HFP version for %s", __func__,
@@ -419,9 +420,10 @@ bool bta_ag_sdp_find_attr(tBTA_AG_SCB* p_scb, tBTA_SERVICE_MASK service) {
        }
        if (sdp_features != p_scb->peer_sdp_features) {
          p_scb->peer_sdp_features = sdp_features;
          if (btif_config_set_bin(
                  p_scb->peer_addr.ToString(), HFP_SDP_FEATURES_CONFIG_KEY,
                  (const uint8_t*)&sdp_features, sizeof(sdp_features))) {
          if (btif_config_set_bin(p_scb->peer_addr.ToString(),
                                  BTIF_STORAGE_KEY_HFP_SDP_FEATURES,
                                  (const uint8_t*)&sdp_features,
                                  sizeof(sdp_features))) {
          } else {
            LOG_WARN("%s: Failed to store peer HFP SDP Features for %s",
                     __func__, ADDRESS_TO_LOGGABLE_CSTR(p_scb->peer_addr));
+2 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@
#include "btif/include/btif_storage.h"
#include "device/include/device_iot_config.h"
#include "device/include/interop.h"
#include "gd/storage/config_keys.h"
#include "include/check.h"
#include "internal_include/bt_target.h"
#include "osi/include/allocator.h"
@@ -544,7 +545,7 @@ static void bta_av_a2dp_sdp_cback(bool found, tA2DP_Service* p_service,

    if (p_service->avdt_version != 0) {
      if (btif_config_set_bin(p_scb->PeerAddress().ToString(),
                              AVDTP_VERSION_CONFIG_KEY,
                              BTIF_STORAGE_KEY_AVDTP_VERSION,
                              (const uint8_t*)&p_service->avdt_version,
                              sizeof(p_service->avdt_version))) {
      } else {
+3 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include "btif/include/btif_av.h"
#include "btif/include/btif_av_co.h"
#include "btif/include/btif_config.h"
#include "gd/storage/config_keys.h"
#include "internal_include/bt_target.h"
#include "os/log.h"
#include "osi/include/allocator.h"
@@ -361,7 +362,8 @@ void tBTA_AV_SCB::OnConnected(const RawAddress& peer_address) {
  // Read and restore the AVDTP version from local storage
  uint16_t avdtp_version = 0;
  size_t version_value_size = sizeof(avdtp_version);
  if (!btif_config_get_bin(peer_address_.ToString(), AVDTP_VERSION_CONFIG_KEY,
  if (!btif_config_get_bin(peer_address_.ToString(),
                           BTIF_STORAGE_KEY_AVDTP_VERSION,
                           (uint8_t*)&avdtp_version, &version_value_size)) {
    LOG_WARN("%s: Failed to read cached peer AVDTP version for %s", __func__,
             ADDRESS_TO_LOGGABLE_CSTR(peer_address_));
+3 −2
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include "common/init_flags.h"
#include "common/strings.h"
#include "device/include/interop.h"
#include "gd/storage/config_keys.h"
#include "include/bind_helpers.h"
#include "include/check.h"
#include "internal_include/bt_target.h"
@@ -540,7 +541,7 @@ static void store_avrcp_profile_feature(tSDP_DISC_REC* sdp_rec) {
  }

  if (btif_config_set_bin(sdp_rec->remote_bd_addr.ToString().c_str(),
                          AV_REM_CTRL_FEATURES_CONFIG_KEY,
                          BTIF_STORAGE_KEY_AV_REM_CTRL_FEATURES,
                          (const uint8_t*)&avrcp_features,
                          sizeof(avrcp_features))) {
    LOG_INFO("Saving avrcp_features: 0x%x", avrcp_features);
@@ -562,7 +563,7 @@ static void bta_dm_store_audio_profiles_version() {
      {
          .servclass_uuid = UUID_SERVCLASS_AV_REMOTE_CONTROL,
          .btprofile_uuid = UUID_SERVCLASS_AV_REMOTE_CONTROL,
          .profile_key = AVRCP_CONTROLLER_VERSION_CONFIG_KEY,
          .profile_key = BTIF_STORAGE_KEY_AVRCP_CONTROLLER_VERSION,
          .store_audio_profile_feature = store_avrcp_profile_feature,
      },
  }};
Loading