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

Commit 517203d1 authored by William Escande's avatar William Escande
Browse files

Add hfp sysprop for profile version

The `define` cannot be override on runtime and some target need to
change the default version to use (Eg: Wear OS)

Dirty cherry because of:
  * hfp dynamic version feature missing
  * invisalign

Bug: 263323082
Test: atest net_test_btif_hf_client_service net_test_bta
      net_test_btif_bta
(cherry picked from https://android-review.googlesource.com/q/commit:fb9e4fac25fe3f6ef5e0b1822715fdf5c508b076)
Merged-In: Iee020f8029dc5f82564fa28574914096a8e7cd75

Change-Id: I16bd905974e9cf589b01bdd908763f3a2699a49b
parent b015842d
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -9,4 +9,12 @@ prop {
    prop_name: "bluetooth.hfp.hf_services_mask.config"
}

prop {
    api_name: "version"
    type: Integer
    scope: Internal
    access: Readonly
    prop_name: "bluetooth.hfp.version.config"
}

+3 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ cc_library_static {
        "hh/bta_hh_le.cc",
        "hh/bta_hh_main.cc",
        "hh/bta_hh_utils.cc",
        "hfp/bta_hfp_api.cc",
        "hd/bta_hd_act.cc",
        "hd/bta_hd_api.cc",
        "hd/bta_hd_main.cc",
@@ -188,6 +189,7 @@ cc_test {
        "libbt-audio-hal-interface",
        "libbluetooth-types",
        "libbt-protos-lite",
        "libcom.android.sysprop.bluetooth",
        "libosi",
        "libbt-common",
    ],
@@ -337,6 +339,7 @@ cc_test {
    ],
    static_libs: [
        "libbluetooth-types",
        "libcom.android.sysprop.bluetooth",
        "libosi",
    ],
    cflags: ["-DBUILDCFG"],
+1 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ static_library("bta") {
    "hh/bta_hh_le.cc",
    "hh/bta_hh_main.cc",
    "hh/bta_hh_utils.cc",
    "hfp/bta_hfp_api.cc",
    "hd/bta_hd_act.cc",
    "hd/bta_hd_api.cc",
    "hd/bta_hd_main.cc",
+1 −1
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@ bool bta_ag_add_record(uint16_t service_uuid, const char* p_service_name,
  /* add profile descriptor list */
  if (service_uuid == UUID_SERVCLASS_AG_HANDSFREE) {
    profile_uuid = UUID_SERVCLASS_HF_HANDSFREE;
    version = BTA_HFP_VERSION;
    version = get_default_hfp_version();
  } else {
    profile_uuid = UUID_SERVCLASS_HEADSET;
    version = HSP_VERSION_1_2;
+17 −1
Original line number Diff line number Diff line
@@ -46,6 +46,22 @@ using bluetooth::Uuid;
/* Number of elements in service class id list. */
#define BTA_HF_CLIENT_NUM_SVC_ELEMS 2

#ifdef OS_ANDROID
#include <hfp.sysprop.h>
#endif

#define DEFAULT_BTA_HFP_VERSION HFP_VERSION_1_7
int get_default_hfp_version() {
#ifdef OS_ANDROID
  static const int version =
      android::sysprop::bluetooth::Hfp::version().value_or(
          DEFAULT_BTA_HFP_VERSION);
  return version;
#else
  return DEFAULT_BTA_HFP_VERSION;
#endif
}

/*******************************************************************************
 *
 * Function         bta_hf_client_sdp_cback
@@ -124,7 +140,7 @@ bool bta_hf_client_add_record(const char* p_service_name, uint8_t scn,

  /* add profile descriptor list */
  profile_uuid = UUID_SERVCLASS_HF_HANDSFREE;
  version = BTA_HFP_VERSION;
  version = get_default_hfp_version();

  result &= SDP_AddProfileDescriptorList(sdp_handle, profile_uuid, version);

Loading