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

Commit ee32ad70 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "audio_hal_interface: Deprecate manually disabling the audio HAL" into main

parents b379e520 c3ef5843
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -237,8 +237,6 @@ std::unique_ptr<::bluetooth::audio::aidl::a2dp::ProviderInfo> provider_info;
// initialized
uint16_t remote_delay = 0;

bool btaudio_a2dp_disabled = false;
bool is_configured = false;
bool is_low_latency_mode_allowed = false;

static BluetoothAudioCtrlAck a2dp_ack_to_bt_audio_ctrl_ack(BluetoothAudioStatus ack) {
@@ -328,15 +326,6 @@ static bool a2dp_get_selected_hal_pcm_config(A2dpCodecConfig* a2dp_codec_configs
         pcm_config->channelMode != ChannelMode::UNKNOWN;
}

// Checking if new bluetooth_audio is supported
bool is_hal_force_disabled() {
  if (!is_configured) {
    btaudio_a2dp_disabled = osi_property_get_bool(BLUETOOTH_AUDIO_HAL_PROP_DISABLED, false);
    is_configured = true;
  }
  return btaudio_a2dp_disabled;
}

}  // namespace

bool update_codec_offloading_capabilities(
@@ -394,11 +383,6 @@ bool init(bluetooth::common::MessageLoopThread* /*message_loop*/) {
    return true;
  }

  if (is_hal_force_disabled()) {
    log::error("BluetoothAudio HAL is disabled");
    return false;
  }

  if (!BluetoothAudioClientInterface::is_aidl_available()) {
    log::error("BluetoothAudio AIDL implementation does not exist");
    return false;
+0 −2
Original line number Diff line number Diff line
@@ -30,8 +30,6 @@
#include "bta/le_audio/le_audio_types.h"
#include "transport_instance.h"

#define BLUETOOTH_AUDIO_HAL_PROP_DISABLED "persist.bluetooth.bluetooth_audio_hal.disabled"

namespace bluetooth {
namespace audio {
namespace aidl {
+0 −15
Original line number Diff line number Diff line
@@ -158,21 +158,11 @@ HearingAidTransport* hearing_aid_sink = nullptr;
// Common interface to call-out into Bluetooth Audio Hal
bluetooth::audio::aidl::BluetoothAudioSinkClientInterface* hearing_aid_hal_clientinterface =
        nullptr;
bool btaudio_hearing_aid_disabled = false;
bool is_configured = false;

// Save the value if the remote reports its delay before hearing_aid_sink is
// initialized
uint16_t remote_delay_ms = 0;

bool is_hal_force_disabled() {
  if (!is_configured) {
    btaudio_hearing_aid_disabled = osi_property_get_bool(BLUETOOTH_AUDIO_HAL_PROP_DISABLED, false);
    is_configured = true;
  }
  return btaudio_hearing_aid_disabled;
}

}  // namespace

namespace bluetooth {
@@ -185,11 +175,6 @@ bool is_hal_enabled() { return hearing_aid_hal_clientinterface != nullptr; }
bool init(StreamCallbacks stream_cb, bluetooth::common::MessageLoopThread* /*message_loop*/) {
  log::info("");

  if (is_hal_force_disabled()) {
    log::error("BluetoothAudio HAL is disabled");
    return false;
  }

  if (!BluetoothAudioClientInterface::is_aidl_available()) {
    log::error("BluetoothAudio AIDL implementation does not exist");
    return false;
+0 −6
Original line number Diff line number Diff line
@@ -97,8 +97,6 @@ AudioConfiguration offload_config_to_hal_audio_config(const ::hfp::offload_confi
  return AudioConfiguration(hfp_config);
}

bool is_hal_enabled() { return !osi_property_get_bool(BLUETOOTH_AUDIO_HAL_PROP_DISABLED, false); }

bool is_aidl_support_hfp() {
  return HalVersionManager::GetHalTransport() == BluetoothAudioHalTransport::AIDL &&
         HalVersionManager::GetHalVersion() >= BluetoothAudioHalVersion::VERSION_AIDL_V4;
@@ -107,10 +105,6 @@ bool is_aidl_support_hfp() {
// Parent client implementation
HfpClientInterface* HfpClientInterface::interface = nullptr;
HfpClientInterface* HfpClientInterface::Get() {
  if (!is_hal_enabled()) {
    log::error("BluetoothAudio HAL is disabled");
    return nullptr;
  }
  if (!is_aidl_support_hfp()) {
    log::warn("Unsupported HIDL or AIDL version");
    return nullptr;
+0 −16
Original line number Diff line number Diff line
@@ -226,9 +226,6 @@ BluetoothAudioSinkClientInterface* active_hal_interface = nullptr;
// initialized
uint16_t remote_delay = 0;

bool btaudio_a2dp_disabled = false;
bool is_configured = false;

static BluetoothAudioCtrlAck a2dp_ack_to_bt_audio_ctrl_ack(BluetoothAudioStatus ack) {
  switch (ack) {
    case BluetoothAudioStatus::SUCCESS:
@@ -306,14 +303,6 @@ static bool a2dp_get_selected_hal_pcm_config(A2dpCodecConfig* a2dp_codec_configs
         pcm_config->channelMode != ChannelMode::UNKNOWN;
}

// Checking if new bluetooth_audio is supported
bool is_hal_2_0_force_disabled() {
  if (!is_configured) {
    btaudio_a2dp_disabled = osi_property_get_bool(BLUETOOTH_AUDIO_HAL_PROP_DISABLED, false);
    is_configured = true;
  }
  return btaudio_a2dp_disabled;
}
}  // namespace

bool update_codec_offloading_capabilities(
@@ -337,11 +326,6 @@ bool is_hal_2_0_offloading() {
bool init(bluetooth::common::MessageLoopThread* message_loop) {
  log::info("");

  if (is_hal_2_0_force_disabled()) {
    log::error("BluetoothAudio HAL is disabled");
    return false;
  }

  auto a2dp_sink = new A2dpTransport(SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH);
  software_hal_interface = new BluetoothAudioSinkClientInterface(a2dp_sink, message_loop);
  if (!software_hal_interface->IsValid()) {
Loading