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

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

Merge "Floss: pass down sco_offload_enabled received from audio stack"

parents 2fe318ba 58ea4766
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -159,7 +159,7 @@ void BTA_AgClose(uint16_t handle) {
 * Function         BTA_AgAudioOpen
 *
 * Description      Opens an audio connection to the currently connected
 *                  headset or hnadsfree.
 *                  headset or handsfree.
 *
 *
 * Returns          void
@@ -176,7 +176,7 @@ void BTA_AgAudioOpen(uint16_t handle) {
 * Function         BTA_AgAudioClose
 *
 * Description      Close the currently active audio connection to a headset
 *                  or hnadsfree. The data connection remains open
 *                  or handsfree. The data connection remains open
 *
 *
 * Returns          void
@@ -225,6 +225,11 @@ void BTA_AgSetCodec(uint16_t handle, tBTA_AG_PEER_CODEC codec) {
                                          BTA_AG_API_SETCODEC_EVT, data));
}

void BTA_AgSetScoOffloadEnabled(bool value) {
  do_in_main_thread(FROM_HERE,
                    base::Bind(&bta_ag_set_sco_offload_enabled, value));
}

void BTA_AgSetScoAllowed(bool value) {
  do_in_main_thread(FROM_HERE, base::Bind(&bta_ag_set_sco_allowed, value));
}
+1 −0
Original line number Diff line number Diff line
@@ -404,6 +404,7 @@ extern void bta_ag_handle_collision(tBTA_AG_SCB* p_scb,
extern void bta_ag_sco_codec_nego(tBTA_AG_SCB* p_scb, bool result);
extern void bta_ag_codec_negotiate(tBTA_AG_SCB* p_scb);
extern void bta_ag_send_bcs(tBTA_AG_SCB* p_scb);
extern void bta_ag_set_sco_offload_enabled(bool value);
extern void bta_ag_set_sco_allowed(bool value);
extern const RawAddress& bta_ag_get_active_device();
extern void bta_clear_active_device();
+4 −0
Original line number Diff line number Diff line
@@ -1352,6 +1352,10 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB* p_scb,
  bta_ag_create_pending_sco(p_scb, bta_ag_cb.sco.is_local);
}

void bta_ag_set_sco_offload_enabled(bool value) {
  hfp_hal_interface::enable_offload(value);
}

void bta_ag_set_sco_allowed(bool value) {
  sco_allowed = value;
  APPL_TRACE_DEBUG(sco_allowed ? "sco now allowed" : "sco now not allowed");
+2 −0
Original line number Diff line number Diff line
@@ -616,6 +616,8 @@ void BTA_AgResult(uint16_t handle, tBTA_AG_RES result,
 ******************************************************************************/
void BTA_AgSetCodec(uint16_t handle, tBTA_AG_PEER_CODEC codec);

void BTA_AgSetScoOffloadEnabled(bool value);

void BTA_AgSetScoAllowed(bool value);

void BTA_AgSetActiveDevice(const RawAddress& active_device_addr);
+7 −0
Original line number Diff line number Diff line
@@ -759,6 +759,7 @@ class HeadsetInterface : Interface {
                               const char* name, RawAddress* bd_addr) override;

  void Cleanup() override;
  bt_status_t SetScoOffloadEnabled(bool value) override;
  bt_status_t SetScoAllowed(bool value) override;
  bt_status_t SendBsir(bool value, RawAddress* bd_addr) override;
  bt_status_t SetActiveDevice(RawAddress* active_device_addr) override;
@@ -1430,6 +1431,12 @@ void HeadsetInterface::Cleanup() {
  do_in_jni_thread(FROM_HERE, base::Bind([]() { bt_hf_callbacks = nullptr; }));
}

bt_status_t HeadsetInterface::SetScoOffloadEnabled(bool value) {
  CHECK_BTHF_INIT();
  BTA_AgSetScoOffloadEnabled(value);
  return BT_STATUS_SUCCESS;
}

bt_status_t HeadsetInterface::SetScoAllowed(bool value) {
  CHECK_BTHF_INIT();
  BTA_AgSetScoAllowed(value);
Loading