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

Commit b21d8830 authored by Henri Chataing's avatar Henri Chataing
Browse files

audio_hal_interface: Pass a2dp_offload_enabled flag to bluetooth::audio::a2dp::init

Removes the dependecy from audio_hal_interface on
  - btif_av_is_a2dp_offload_enabled

Bug: 365022887
Test: m com.android.btservices
Flag: EXEMPT, no logical change
Change-Id: I835baafdf83e14762d548b286e45457fa9e39387
parent a32525f0
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -54,11 +54,11 @@ bool is_hal_offloading() {

// Initialize BluetoothAudio HAL: openProvider
bool init(bluetooth::common::MessageLoopThread* message_loop,
          bluetooth::audio::a2dp::BluetoothAudioPort const* audio_port) {
          bluetooth::audio::a2dp::BluetoothAudioPort const* audio_port, bool offload_enabled) {
  if (HalVersionManager::GetHalTransport() == BluetoothAudioHalTransport::HIDL) {
    return hidl::a2dp::init(message_loop, audio_port);
    return hidl::a2dp::init(message_loop, audio_port, offload_enabled);
  }
  return aidl::a2dp::init(message_loop, audio_port);
  return aidl::a2dp::init(message_loop, audio_port, offload_enabled);
}

// Clean up BluetoothAudio HAL
+2 −1
Original line number Diff line number Diff line
@@ -69,7 +69,8 @@ bool is_hal_enabled();
bool is_hal_offloading();

// Initialize BluetoothAudio HAL: openProvider
bool init(bluetooth::common::MessageLoopThread* message_loop, BluetoothAudioPort const* audio_port);
bool init(bluetooth::common::MessageLoopThread* message_loop, BluetoothAudioPort const* audio_port,
          bool offload_enabled);

// Clean up BluetoothAudio HAL
void cleanup();
+2 −2
Original line number Diff line number Diff line
@@ -231,8 +231,8 @@ static BluetoothAudioPort null_audio_port;
static BluetoothAudioPort const* bluetooth_audio_port = &null_audio_port;

// Initialize BluetoothAudio HAL: openProvider
bool init(bluetooth::common::MessageLoopThread* message_loop,
          BluetoothAudioPort const* audio_port) {
bool init(bluetooth::common::MessageLoopThread* message_loop, BluetoothAudioPort const* audio_port,
          bool /*offload_enabled*/) {
  a2dp_uipc = UIPC_Init();
  total_bytes_read_ = 0;
  data_position_ = {};
+2 −3
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@
#include "a2dp_provider_info.h"
#include "a2dp_transport.h"
#include "audio_aidl_interfaces.h"
#include "btif/include/btif_av.h"
#include "codec_status_aidl.h"
#include "transport_instance.h"

@@ -347,7 +346,7 @@ static void delete_hal_interface(BluetoothAudioSinkClientInterface* hal_interfac

// Initialize BluetoothAudio HAL: openProvider
bool init(bluetooth::common::MessageLoopThread* /*message_loop*/,
          BluetoothAudioPort const* audio_port) {
          BluetoothAudioPort const* audio_port, bool offload_enabled) {
  log::info("");
  log::assert_that(audio_port != nullptr, "audio_port != nullptr");

@@ -365,7 +364,7 @@ bool init(bluetooth::common::MessageLoopThread* /*message_loop*/,
    return false;
  }

  if (btif_av_is_a2dp_offload_enabled() && offloading_hal_interface == nullptr) {
  if (offload_enabled && offloading_hal_interface == nullptr) {
    offloading_hal_interface =
            new_hal_interface(SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH);
    if (offloading_hal_interface == nullptr) {
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ bool is_hal_offloading();
 * Initialize BluetoothAudio HAL: openProvider
 ***/
bool init(bluetooth::common::MessageLoopThread* message_loop,
          bluetooth::audio::a2dp::BluetoothAudioPort const* audio_port);
          bluetooth::audio::a2dp::BluetoothAudioPort const* audio_port, bool offload_enabled);

/***
 * Clean up BluetoothAudio HAL
Loading