diff options
author | 2023-03-09 09:03:03 -0800 | |
---|---|---|
committer | 2023-03-09 09:45:56 -0800 | |
commit | 698f4dce56fc120263c944d19af60506f79d2afb (patch) | |
tree | 3cd3fc67545e73fa5ccc09d2d15b44574e270ff1 | |
parent | 248721c131c03a069db8effcc443ce951d595c5d (diff) |
Add hfp sysprop for hf_features
The `define` cannot be override on runtime and some target need to
configure the features (Eg: Wear OS)
Test: manual | set the property and check new behavior
Bug: 263323082
Change-Id: I197d670c929c7a086340f9d8ff72b0ec170616fe
-rw-r--r-- | sysprop/hfp.sysprop | 8 | ||||
-rw-r--r-- | system/btif/src/btif_hf.cc | 30 |
2 files changed, 29 insertions, 9 deletions
diff --git a/sysprop/hfp.sysprop b/sysprop/hfp.sysprop index a641efa14f..f07124f0eb 100644 --- a/sysprop/hfp.sysprop +++ b/sysprop/hfp.sysprop @@ -10,6 +10,14 @@ prop { } prop { + api_name: "hf_features" + type: Integer + scope: Internal + access: Readonly + prop_name: "bluetooth.hfp.hf_features.config" +} + +prop { api_name: "hf_services" type: Integer scope: Internal diff --git a/system/btif/src/btif_hf.cc b/system/btif/src/btif_hf.cc index e470cc19cd..50fa3edcc1 100644 --- a/system/btif/src/btif_hf.cc +++ b/system/btif/src/btif_hf.cc @@ -77,16 +77,9 @@ namespace headset { { BTIF_HSAG_SERVICE_NAME, BTIF_HFAG_SERVICE_NAME } #endif -#ifndef BTIF_HF_FEATURES -#define BTIF_HF_FEATURES \ - (BTA_AG_FEAT_3WAY | BTA_AG_FEAT_ECNR | BTA_AG_FEAT_REJECT | \ - BTA_AG_FEAT_ECS | BTA_AG_FEAT_EXTERR | BTA_AG_FEAT_VREC | \ - BTA_AG_FEAT_CODEC | BTA_AG_FEAT_HF_IND | BTA_AG_FEAT_ESCO_S4 | \ - BTA_AG_FEAT_UNAT) -#endif - +static uint32_t get_hf_features(); /* HF features supported at runtime */ -static uint32_t btif_hf_features = BTIF_HF_FEATURES; +static uint32_t btif_hf_features = get_hf_features(); #define BTIF_HF_INVALID_IDX (-1) @@ -160,6 +153,25 @@ static tBTA_SERVICE_MASK get_BTIF_HF_SERVICES() { #endif } +/* HF features supported at runtime */ +static uint32_t get_hf_features() { +#define DEFAULT_BTIF_HF_FEATURES \ + (BTA_AG_FEAT_3WAY | BTA_AG_FEAT_ECNR | BTA_AG_FEAT_REJECT | \ + BTA_AG_FEAT_ECS | BTA_AG_FEAT_EXTERR | BTA_AG_FEAT_VREC | \ + BTA_AG_FEAT_CODEC | BTA_AG_FEAT_HF_IND | BTA_AG_FEAT_ESCO_S4 | \ + BTA_AG_FEAT_UNAT) +#ifdef OS_ANDROID + static const uint32_t hf_features = + android::sysprop::bluetooth::Hfp::hf_features().value_or( + DEFAULT_BTIF_HF_FEATURES); + return hf_features; +#elif TARGET_FLOSS + return BTA_AG_FEAT_ECS | BTA_AG_FEAT_CODEC; +#else + return DEFAULT_BTIF_HF_FEATURES; +#endif +} + /******************************************************************************* * * Function is_connected |