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

Commit a888bfbf authored by Jeremy Wu's avatar Jeremy Wu
Browse files

Floss: fix wbs_supported for sco_hfp_hal_linux

Currently the preferred codec is overriden to mSBC even when the local
device does not support WBS, mainly due to how Android expects WBS to
always be supported (and can be decided in compile-time if not).

In this CL we ignore the "AT+BAC" event that attempts to modify the
preferred codec to WBS when local device does not support it
(hal-independent).

Bug: 241202081
Tag: #floss
Test: Build and verify `wbs_supported` isn't overriden to True by a wbs-capable headset when local device does not support
Change-Id: I06e3bf905ccb75f4d86b035f7da04ff7f5737547
parent 1d4b1bb9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -180,6 +180,7 @@ cc_defaults {
        "lib-bt-packets-base",
        "lib-bt-packets-avrcp",
        "libbt-audio-hal-interface",
        "libbt-stack",
        "libaudio-a2dp-hw-utils",
    ],
    cflags: [
@@ -486,6 +487,7 @@ cc_test {
          "libaudio-a2dp-hw-utils",
          "libbluetooth-types",
          "libbt-audio-hal-interface",
          "libbt-stack",
          "libbtdevice",
          "lib-bt-packets",
          "lib-bt-packets-avrcp",
+5 −5
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@
#include "include/hardware/bt_hf.h"
#include "main/shim/dumpsys.h"
#include "osi/include/log.h"
#include "stack/btm/btm_sco_hfp_hal.h"
#include "stack/include/btm_api.h"
#include "types/raw_address.h"

@@ -552,11 +553,10 @@ static void btif_hf_upstreams_evt(uint16_t event, char* p_param) {
    case BTA_AG_AT_BAC_EVT:
      BTIF_TRACE_DEBUG("AG Bitmap of peer-codecs %d", p_data->val.num);
      /* If the peer supports mSBC and the BTIF preferred codec is also mSBC,
      then
      we should set the BTA AG Codec to mSBC. This would trigger a +BCS to mSBC
      at the time
      of SCO connection establishment */
      if (p_data->val.num & BTM_SCO_CODEC_MSBC) {
       * then we should set the BTA AG Codec to mSBC. This would trigger a +BCS
       * to mSBC at the time of SCO connection establishment */
      if (hfp_hal_interface::get_wbs_supported() &&
          (p_data->val.num & BTM_SCO_CODEC_MSBC)) {
        BTIF_TRACE_EVENT("%s: btif_hf override-Preferred Codec to MSBC",
                         __func__);
        BTA_AgSetCodec(btif_hf_cb[idx].handle, BTM_SCO_CODEC_MSBC);