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

Commit 1a7f806e authored by Jakub Rotkiewicz's avatar Jakub Rotkiewicz
Browse files

avdt: do discovery after INT peer sets configuration

Bug: 329809288
Flag: com.android.bluetooth.flags.avdt_discover_seps_as_acceptor
Test: mmm packages/modules/Bluetooth
Change-Id: Ic88a4fa47686d1efc2599f5d9fbad87c21d140d9
parent c50cae9d
Loading
Loading
Loading
Loading
+47 −32
Original line number Diff line number Diff line
@@ -1074,12 +1074,26 @@ void bta_av_setconfig_rsp(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
      p_scb->role |= BTA_AV_ROLE_SUSPEND_OPT;
    }
    log::verbose("recfg_needed:{} role:0x{:x}", p_data->ci_setconfig.recfg_needed, p_scb->role);
    p_scb->num_seps = 1;

    if (p_scb->cur_psc_mask & AVDT_PSC_DELAY_RPT) {
      p_scb->SetAvdtpVersion(AVDT_VERSION_1_3);
    }

    if (com::android::bluetooth::flags::avdt_discover_seps_as_acceptor()) {
      if (btif_av_src_sink_coexist_enabled()) {
        if (local_sep == AVDT_TSEP_SRC) {
          /* Make sure UUID has been initialized... */
          /* if local sep is source, uuid_int should be source */
          p_scb->uuid_int = UUID_SERVCLASS_AUDIO_SOURCE;
        } else {
          p_scb->uuid_int = UUID_SERVCLASS_AUDIO_SINK;
        }
      } else if (p_scb->uuid_int == 0) {
        p_scb->uuid_int = p_scb->open_api.uuid;
      }
      bta_av_discover_req(p_scb, NULL);
    } else {
      p_scb->num_seps = 1;
      if (A2DP_GetCodecType(p_scb->cfg.codec_info) == A2DP_MEDIA_CT_SBC) {
        /* if SBC is used by the SNK as INT, discover req is not sent in
         * bta_av_config_ind.
@@ -1087,8 +1101,8 @@ void bta_av_setconfig_rsp(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
        /* this is called in A2DP SRC path only, In case of SINK we don't need it
         */
        if (local_sep == AVDT_TSEP_SRC) {
        p_scb->p_cos->disc_res(p_scb->hndl, p_scb->PeerAddress(), p_scb->num_seps, p_scb->num_seps,
                               0, UUID_SERVCLASS_AUDIO_SOURCE);
          p_scb->p_cos->disc_res(p_scb->hndl, p_scb->PeerAddress(), p_scb->num_seps,
                                 p_scb->num_seps, 0, UUID_SERVCLASS_AUDIO_SOURCE);
        }
      } else {
        /* we do not know the peer device and it is using non-SBC codec
@@ -1122,6 +1136,7 @@ void bta_av_setconfig_rsp(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
      }
    }
  }
}

/*******************************************************************************
 *