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

Commit 3bd58942 authored by Henri Chataing's avatar Henri Chataing
Browse files

system/bta: Use correct avdt handle for bta_av_setconfig_rej

bta_av_adjust_seps_idx fails when the remote configuration
is invalid and p_scb->avdt_handle is not configured as it should be.
This results in p_scb->avdt_handle being invalid and the
AVDTP Set Configuration Reject response not being sent.

This change removes the call to bta_av_adjust_seps_idx
which is only useful when accepting the configuration, and
directly uses the input handle.

Bug: 336232163
Bug: 338139069
Test: m com.android.btservices
Test: atest pts-bot:A2DP/SNK/AVP
Flag: com.android.bluetooth.flags.avdtp_error_codes
Change-Id: I79eed6b1d453b2e3c1ee6dc40d5925d2a2b7a837
parent 98e22e28
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1740,12 +1740,11 @@ void bta_av_setconfig_rej(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
  uint8_t avdt_handle = p_data->ci_setconfig.avdt_handle;
  uint8_t err_code = p_data->ci_setconfig.err_code;

  bta_av_adjust_seps_idx(p_scb, avdt_handle);

  log::info("sep_idx={} avdt_handle={} bta_handle=0x{:x} err_code=0x{:x}", p_scb->sep_idx,
            p_scb->avdt_handle, p_scb->hndl, err_code);

  if (!com::android::bluetooth::flags::avdtp_error_codes()) {
    bta_av_adjust_seps_idx(p_scb, avdt_handle);
    err_code = AVDT_ERR_UNSUP_CFG;
  }

@@ -1753,7 +1752,7 @@ void bta_av_setconfig_rej(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
  // AVDT_ConfigRsp will interpret the event as RSP instead of REJ.
  log::assert_that(err_code != 0, "err_code != 0");

  AVDT_ConfigRsp(p_scb->avdt_handle, p_scb->avdt_label, err_code, 0);
  AVDT_ConfigRsp(avdt_handle, p_scb->avdt_label, err_code, 0);

  tBTA_AV bta_av_data = {
      .reject =