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

Commit f2f923aa authored by Yuyang Huang's avatar Yuyang Huang
Browse files

Open SCO based on HFP ProviderInfo

Bug: 294134504
Bug: 315234036
Test: m .
Change-Id: I18be0d8704a7802932f928322feaccf6575ae11f
parent cce2acbd
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include "btm_api_types.h"
#include "hardware/bluetooth.h"
#include "hardware/bluetooth_headset_interface.h"
#include "provider_info.h"
#include "types/raw_address.h"

namespace bluetooth {
@@ -61,6 +62,13 @@ tBTA_AG_SCB* get_hfp_active_device_callback() {
  return cb;
}

std::unordered_map<int, ::hfp::sco_config> HfpTransport::GetHfpScoConfig(
    SessionType sessionType) {
  auto providerInfo =
      ::bluetooth::audio::aidl::ProviderInfo::GetProviderInfo(sessionType);
  return providerInfo->GetHfpScoConfig();
}

HfpTransport::HfpTransport() { hfp_pending_cmd_ = HFP_CTRL_CMD_NONE; }

BluetoothAudioCtrlAck HfpTransport::StartRequest() {
+5 −0
Original line number Diff line number Diff line
@@ -17,7 +17,9 @@
#pragma once

#include <cstdint>
#include <unordered_map>

#include "bta/ag/bta_ag_int.h"
#include "client_interface_aidl.h"

namespace bluetooth {
@@ -68,6 +70,9 @@ class HfpTransport {

  void LogBytesProcessed(size_t bytes_read);

  static std::unordered_map<int, ::hfp::sco_config> GetHfpScoConfig(
      SessionType sessionType);

 private:
  tHFP_CTRL_CMD hfp_pending_cmd_;
};
+6 −0
Original line number Diff line number Diff line
@@ -506,6 +506,12 @@ void HfpClientInterface::Offload::CancelStreamingRequest() {
  }
}

std::unordered_map<int, ::hfp::sco_config>
HfpClientInterface::Offload::GetHfpScoConfig() {
  return aidl::hfp::HfpTransport::GetHfpScoConfig(
      aidl::SessionType::HFP_HARDWARE_OFFLOAD_DATAPATH);
}

HfpClientInterface::Offload* HfpClientInterface::GetOffload(
    bluetooth::common::MessageLoopThread* /*message_loop*/) {
  if (!is_aidl_support_hfp()) {
+1 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ class HfpClientInterface {
    void UpdateAudioConfigToHal(const ::hfp::offload_config& config) override;
    void ConfirmStreamingRequest() override;
    void CancelStreamingRequest() override;
    std::unordered_map<int, ::hfp::sco_config> GetHfpScoConfig();
  };

  // Get HFP software decoding client interface if it's not previously acquired
+5 −0
Original line number Diff line number Diff line
@@ -49,6 +49,11 @@ bool HfpClientInterface::ReleaseOffload(HfpClientInterface::Offload* offload) {

HfpClientInterface* HfpClientInterface::Get() { return nullptr; }

std::unordered_map<int, ::hfp::sco_config>
HfpClientInterface::Offload::GetHfpScoConfig() {
  return std::unordered_map<int, ::hfp::sco_config>();
}

}  // namespace hfp
}  // namespace audio
}  // namespace bluetooth
Loading