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

Commit 177b8c04 authored by weichinweng's avatar weichinweng Committed by Jack He
Browse files

HFP: Don't use mSBC for HF devices not supporting related feature

* Some misbehaving HF devices indicate their support some mSBC related
feature but some feature is not support. It will cause some unexpected
behavior.
* This CL adds a workround for checking if HF device indicate which one
is not support on Transparent Synchronous Data, WBS and Codec
Negotiation, Fluoride will assume CVSD codec by default.

Bug: 116082185
Test: make, connect SCO and check voice on carkit and headset.
Change-Id: Ic2209e514999958061bc7db7ab18d6e5b3976758
parent e41294ac
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -561,12 +561,20 @@ static void bta_ag_codec_negotiation_timer_cback(void* data) {
void bta_ag_codec_negotiate(tBTA_AG_SCB* p_scb) {
  APPL_TRACE_DEBUG("%s", __func__);
  bta_ag_cb.sco.p_curr_scb = p_scb;

  // Workaround for misbehaving HFs such as Sony XAV AX100 car kit and Sony
  // MW600 Headset, which indicate WBS support in SDP, but no codec
  // negotiation support in BRSF. In this case, using mSBC codec can result
  // background noise or no audio. Thus, defaulting to CVSD instead.
  if (!(p_scb->peer_features & BTA_AG_PEER_FEAT_CODEC)) {
  uint8_t* p_rem_feat = BTM_ReadRemoteFeatures(p_scb->peer_addr);
  bool sdp_wbs_support = p_scb->peer_sdp_features & BTA_AG_FEAT_WBS_SUPPORT;

  // Workaround for misbehaving HFs, which indicate which one is not support on
  // Transparent Synchronous Data in Remote Supported Features, WBS in SDP and
  // and Codec Negotiation in BRSF. Fluoride will assume CVSD codec by default.
  // In Sony XAV AX100 car kit and Sony MW600 Headset case, which indicate
  // Transparent Synchronous Data and WBS support, but no codec negotiation
  // support, using mSBC codec can result background noise or no audio.
  // In Skullcandy JIB case, which indicate WBS and codec negotiation support,
  // but no Transparent Synchronous Data support, using mSBC codec can result
  // SCO setup fail by Firmware rejest.
  if (!HCI_LMP_TRANSPNT_SUPPORTED(p_rem_feat) || !sdp_wbs_support ||
      !(p_scb->peer_features & BTA_AG_PEER_FEAT_CODEC)) {
    p_scb->sco_codec = UUID_CODEC_CVSD;
  }