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

Commit 411466c3 authored by Alice Kuo's avatar Alice Kuo Committed by Gerrit Code Review
Browse files

Merge "Check AIDL transport in LE audio HAL verifier" into main

parents 97eb6264 3a3220b3
Loading
Loading
Loading
Loading
+5 −12
Original line number Diff line number Diff line
@@ -44,18 +44,7 @@ BluetoothAudioHalVersion HalVersionManager::GetHalVersion() {
}

BluetoothAudioHalTransport HalVersionManager::GetHalTransport() {
  switch (GetHalVersion()) {
    case BluetoothAudioHalVersion::VERSION_AIDL_V1:
    case BluetoothAudioHalVersion::VERSION_AIDL_V2:
    case BluetoothAudioHalVersion::VERSION_AIDL_V3:
    case BluetoothAudioHalVersion::VERSION_AIDL_V4:
      return BluetoothAudioHalTransport::AIDL;
    case BluetoothAudioHalVersion::VERSION_2_0:
    case BluetoothAudioHalVersion::VERSION_2_1:
      return BluetoothAudioHalTransport::HIDL;
    default:
      return BluetoothAudioHalTransport::UNKNOWN;
  }
  return instance_ptr->hal_transport_;
}

android::sp<IBluetoothAudioProvidersFactory_2_1>
@@ -131,9 +120,11 @@ BluetoothAudioHalVersion GetAidlInterfaceVersion() {
}

HalVersionManager::HalVersionManager() {
  hal_transport_ = BluetoothAudioHalTransport::UNKNOWN;
  if (AServiceManager_checkService(
          kDefaultAudioProviderFactoryInterface.c_str()) != nullptr) {
    hal_version_ = GetAidlInterfaceVersion();
    hal_transport_ = BluetoothAudioHalTransport::AIDL;
    return;
  }

@@ -155,6 +146,7 @@ HalVersionManager::HalVersionManager() {

  if (instance_count > 0) {
    hal_version_ = BluetoothAudioHalVersion::VERSION_2_1;
    hal_transport_ = BluetoothAudioHalTransport::HIDL;
    return;
  }

@@ -168,6 +160,7 @@ HalVersionManager::HalVersionManager() {

  if (instance_count > 0) {
    hal_version_ = BluetoothAudioHalVersion::VERSION_2_0;
    hal_transport_ = BluetoothAudioHalTransport::HIDL;
    return;
  }

+1 −2
Original line number Diff line number Diff line
@@ -47,8 +47,6 @@ enum class BluetoothAudioHalVersion : uint8_t {
enum class BluetoothAudioHalTransport : uint8_t {
  // Uninit, default value
  UNKNOWN,
  // No HAL available after init or force disabled
  DISABLED,
  AIDL,
  HIDL,
};
@@ -72,6 +70,7 @@ class HalVersionManager {
  std::mutex mutex_;

  BluetoothAudioHalVersion hal_version_;
  BluetoothAudioHalTransport hal_transport_;
};

}  // namespace audio
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ HalVersionManager::GetProvidersFactory_2_0() {

HalVersionManager::HalVersionManager() {
  hal_version_ = BluetoothAudioHalVersion::VERSION_UNAVAILABLE;
  hal_transport_ = BluetoothAudioHalTransport::UNKNOWN;
}

}  // namespace audio
+4 −2
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@
#include "bta_le_audio_api.h"

bool LeAudioHalVerifier::SupportsLeAudio() {
  return bluetooth::audio::HalVersionManager::GetHalVersion() >=
  return bluetooth::audio::HalVersionManager::GetHalTransport() ==
             bluetooth::audio::BluetoothAudioHalTransport::AIDL ||
         bluetooth::audio::HalVersionManager::GetHalVersion() >=
             bluetooth::audio::BluetoothAudioHalVersion::VERSION_2_1;
}