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

Commit c1bc5b3f authored by En-Shuo Hsu's avatar En-Shuo Hsu Committed by Gerrit Code Review
Browse files

Merge "floss: Extend connect_audio for force_cvsd"

parents 28fee546 5c779e84
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -560,7 +560,8 @@ static jboolean connectAudioNative(JNIEnv* env, jobject object,
    return JNI_FALSE;
  }
  ALOGI("%s: device %s", __func__, ((RawAddress*)addr)->ToString().c_str());
  bt_status_t status = sBluetoothHfpInterface->ConnectAudio((RawAddress*)addr);
  bt_status_t status =
      sBluetoothHfpInterface->ConnectAudio((RawAddress*)addr, false);
  if (status != BT_STATUS_SUCCESS) {
    ALOGE("Failed HF audio connection, status: %d", status);
  }
+7 −5
Original line number Diff line number Diff line
@@ -159,16 +159,18 @@ void BTA_AgClose(uint16_t handle) {
 * Function         BTA_AgAudioOpen
 *
 * Description      Opens an audio connection to the currently connected
 *                  headset or handsfree.
 *                  headset or handsfree. Specifying force_cvsd to true to
 *                  force the stack to use CVSD even if mSBC is supported.
 *
 *
 * Returns          void
 *
 ******************************************************************************/
void BTA_AgAudioOpen(uint16_t handle) {
  do_in_main_thread(
      FROM_HERE, base::Bind(&bta_ag_sm_execute_by_handle, handle,
                            BTA_AG_API_AUDIO_OPEN_EVT, tBTA_AG_DATA::kEmpty));
void BTA_AgAudioOpen(uint16_t handle, bool force_cvsd) {
  tBTA_AG_DATA data = {};
  data.api_audio_open.force_cvsd = force_cvsd;
  do_in_main_thread(FROM_HERE, base::Bind(&bta_ag_sm_execute_by_handle, handle,
                                          BTA_AG_API_AUDIO_OPEN_EVT, data));
}

/*******************************************************************************
+6 −0
Original line number Diff line number Diff line
@@ -134,6 +134,11 @@ typedef struct {
  RawAddress bd_addr;
} tBTA_AG_API_OPEN;

/* data type for BTA_AG_API_AUDIO_OPEN_EVT */
typedef struct {
  bool force_cvsd;
} tBTA_AG_API_AUDIO_OPEN;

/* data type for BTA_AG_API_RESULT_EVT */
typedef struct {
  tBTA_AG_RES result;
@@ -162,6 +167,7 @@ typedef struct {
union tBTA_AG_DATA {
  tBTA_AG_API_REGISTER api_register;
  tBTA_AG_API_OPEN api_open;
  tBTA_AG_API_AUDIO_OPEN api_audio_open;
  tBTA_AG_API_RESULT api_result;
  tBTA_AG_API_SETCODEC api_setcodec;
  tBTA_AG_DISC_RESULT disc_result;
+6 −0
Original line number Diff line number Diff line
@@ -1178,6 +1178,12 @@ void bta_ag_sco_open(tBTA_AG_SCB* p_scb, UNUSED_ATTR const tBTA_AG_DATA& data) {
    LOG(INFO) << __func__ << ": not opening sco, by policy";
    return;
  }

  if (data.api_audio_open.force_cvsd) {
    LOG(INFO) << __func__ << ": set to use fallback codec";
    p_scb->codec_fallback = true;
  }

  /* if another scb using sco, this is a transfer */
  if (bta_ag_cb.sco.p_curr_scb && bta_ag_cb.sco.p_curr_scb != p_scb) {
    LOG(INFO) << __func__ << ": transfer "
+3 −2
Original line number Diff line number Diff line
@@ -568,13 +568,14 @@ void BTA_AgClose(uint16_t handle);
 * Function         BTA_AgAudioOpen
 *
 * Description      Opens an audio connection to the currently connected
 *                  headset or hnadsfree
 *                  headset or handsfree. Specifying force_cvsd to true to
 *                  force the stack to use CVSD even if mSBC is supported.
 *
 *
 * Returns          void
 *
 ******************************************************************************/
void BTA_AgAudioOpen(uint16_t handle);
void BTA_AgAudioOpen(uint16_t handle, bool force_cvsd);

/*******************************************************************************
 *
Loading