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

Commit 1f9c10f8 authored by Patty Huang's avatar Patty Huang
Browse files

Get AIDL interface version that is in used

Bug: 249614160
Bug: 277857154

Test: Manual
Change-Id: Ibaf7253be97ec6621b67ee4df13b48ede0f9fe5f
parent 3223ab21
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -258,6 +258,31 @@ bool BluetoothAudioClientInterface::SetLowLatencyModeAllowed(bool allowed) {
  return true;
}

int BluetoothAudioClientInterface::GetAidlInterfaceVersion() {
  int aidl_version = -1;
  if (!is_aidl_available()) {
    return aidl_version;
  }

  auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(
      ::ndk::SpAIBinder(AServiceManager_waitForService(
          kDefaultAudioProviderFactoryInterface.c_str())));

  if (provider_factory == nullptr) {
    LOG(ERROR) << __func__ << ", can't get aidl version from unknown factory";
    return aidl_version;
  }

  auto aidl_retval = provider_factory->getInterfaceVersion(&aidl_version);
  if (!aidl_retval.isOk()) {
    LOG(FATAL) << __func__
               << ": BluetoothAudioHal::getInterfaceVersion failure: "
               << aidl_retval.getDescription();
  }

  return aidl_version;
}

int BluetoothAudioClientInterface::StartSession() {
  std::lock_guard<std::mutex> guard(internal_mutex_);
  if (provider_ == nullptr) {
+2 −0
Original line number Diff line number Diff line
@@ -93,6 +93,8 @@ class BluetoothAudioClientInterface {

  static bool is_aidl_available();

  static int GetAidlInterfaceVersion();

 protected:
  mutable std::mutex internal_mutex_;
  /***
+4 −0
Original line number Diff line number Diff line
@@ -642,6 +642,10 @@ AudioConfiguration offload_config_to_hal_audio_config(
  return AudioConfiguration(ucast_config);
}

int GetAidlInterfaceVersion() {
  return BluetoothAudioSinkClientInterface::GetAidlInterfaceVersion();
}

}  // namespace le_audio
}  // namespace aidl
}  // namespace audio
+1 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ bool is_source_hal_enabled();
bool is_sink_hal_enabled();

std::vector<AudioSetConfiguration> get_offload_capabilities();
int GetAidlInterfaceVersion();

class LeAudioTransport {
 public:
+9 −0
Original line number Diff line number Diff line
@@ -63,6 +63,15 @@ aidl::BluetoothAudioSinkClientInterface* get_aidl_client_interface(
  return aidl::le_audio::LeAudioSinkTransport::interface_unicast_;
}

int GetAidlInterfaceVersion() {
  if (HalVersionManager::GetHalTransport() ==
      BluetoothAudioHalTransport::HIDL) {
    return -1;
  }

  return aidl::le_audio::GetAidlInterfaceVersion();
}

aidl::le_audio::LeAudioSinkTransport* get_aidl_transport_instance(
    bool is_broadcaster) {
  if (is_broadcaster)
Loading