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

Commit 012558d7 authored by Jeremy Wu's avatar Jeremy Wu
Browse files

Floss: check |wbs_supported| in AT+BAC

Some boards don't support WBS, and the stack may store that value as a
result of codec negotiation.

In the end it likely does no harm as of now, since in
|bta_ag_create_sco| there is another check.

This CL ensures the unsupported codec would not be kept to be safe.

Bug: 306067195
Tag: #floss
Test: atest net_test_stack_btm
Change-Id: I40ad7cd05ac7f552b497a361ca8190f075d92a1b
parent 5b834439
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1247,13 +1247,14 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type,
        p_scb->peer_codecs = bta_ag_parse_bac(p_scb, p_arg, p_end);
        p_scb->codec_updated = true;

        bool wbs_supported = hfp_hal_interface::get_wbs_supported();
        bool swb_supported = hfp_hal_interface::get_swb_supported();

        if (swb_supported && (p_scb->peer_codecs & BTM_SCO_CODEC_LC3) &&
            !(p_scb->disabled_codecs & BTM_SCO_CODEC_LC3)) {
          p_scb->sco_codec = BTM_SCO_CODEC_LC3;
          APPL_TRACE_DEBUG("Received AT+BAC, updating sco codec to LC3");
        } else if ((p_scb->peer_codecs & BTM_SCO_CODEC_MSBC) &&
        } else if (wbs_supported && (p_scb->peer_codecs & BTM_SCO_CODEC_MSBC) &&
                   !(p_scb->disabled_codecs & BTM_SCO_CODEC_MSBC)) {
          p_scb->sco_codec = BTM_SCO_CODEC_MSBC;
          APPL_TRACE_DEBUG("Received AT+BAC, updating sco codec to MSBC");