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

Commit 7f9c47a3 authored by Henri Chataing's avatar Henri Chataing
Browse files

blueooth/audio/aidl/default: Disable GetProviderInfo

This implementation of the HAL is used by pixel devices.
The implementation of GetProviderInfo is test only

Bug: 324570010
Test: TreeHugger
Change-Id: I67d17fb07c1288317290a0b1c4b07cd3be1e48c6
parent e1560216
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -120,6 +120,12 @@ ndk::ScopedAStatus A2dpOffloadAudioProvider::onSessionReady(
ndk::ScopedAStatus A2dpOffloadAudioProvider::parseA2dpConfiguration(
    const CodecId& codec_id, const std::vector<uint8_t>& configuration,
    CodecParameters* codec_parameters, A2dpStatus* _aidl_return) {
  if (!kEnableA2dpCodecExtensibility) {
    // parseA2dpConfiguration must not be implemented if A2dp codec
    // extensibility is not supported.
    return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_TRANSACTION);
  }

  auto codec = codec_factory_.GetCodec(codec_id);
  if (!codec) {
    LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
@@ -136,6 +142,12 @@ ndk::ScopedAStatus A2dpOffloadAudioProvider::getA2dpConfiguration(
    const std::vector<A2dpRemoteCapabilities>& remote_a2dp_capabilities,
    const A2dpConfigurationHint& hint,
    std::optional<audio::A2dpConfiguration>* _aidl_return) {
  if (!kEnableA2dpCodecExtensibility) {
    // getA2dpConfiguration must not be implemented if A2dp codec
    // extensibility is not supported.
    return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_TRANSACTION);
  }

  *_aidl_return = std::nullopt;
  A2dpConfiguration avdtp_configuration;

+17 −0
Original line number Diff line number Diff line
@@ -35,6 +35,23 @@ namespace hardware {
namespace bluetooth {
namespace audio {

/// Enable flag for the reference implementation for A2dp Codec
/// Extensibility.
///
/// A2dp Codec extensibility cannot be enabled until the following
/// requirements are fulfilled.
///
///  1. The Bluetooth controller must support the HCI Requirements
///     v1.04 or later, and must support the vendor HCI command
///     A2DP Offload Start (v2), A2DP Offload Stop (v2) as indicated
///     by the field a2dp_offload_v2 of the vendor capabilities.
///
///  2. The implementation of the provider must be completed with
///     DSP configuration for streaming.
enum : bool {
  kEnableA2dpCodecExtensibility = false,
};

class BluetoothAudioProvider : public BnBluetoothAudioProvider {
 public:
  BluetoothAudioProvider();
+6 −0
Original line number Diff line number Diff line
@@ -159,6 +159,12 @@ ndk::ScopedAStatus BluetoothAudioProviderFactory::getProviderInfo(

  if (session_type == SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
      session_type == SessionType::A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
    if (!kEnableA2dpCodecExtensibility) {
      // Implementing getProviderInfo equates supporting
      // A2dp codec extensibility.
      return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_TRANSACTION);
    }

    auto& provider_info = _aidl_return->emplace();

    provider_info.name = a2dp_offload_codec_factory_.name;