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

Commit 971756a5 authored by Cheney Ni's avatar Cheney Ni Committed by Jakub Pawlowski
Browse files

BluetoothAudioHAL: Don't fetch the provider without HAL version

This fixes a native crash while enabling BT with no bluetooth.audio HAL.

Fixes: 184147199
Bug: 184147199
Tag: #stability
Test: start Bluetooth on device without bluetooth.audio HAL
Change-Id: I96974b33316a73e1c0c291b9de05400d2e842e92
parent 1bf02f52
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -418,15 +418,18 @@ BluetoothAudioSinkClientInterface::BluetoothAudioSinkClientInterface(
                                        this, message_loop),
                                    sink},
      sink_(sink) {
  if (HalVersionManager::GetHalVersion() ==
      BluetoothAudioHalVersion::VERSION_UNAVAILABLE) {
    return;
  }

  if ((HalVersionManager::GetHalVersion() ==
       BluetoothAudioHalVersion::VERSION_2_1) &&
      (sink_->GetSessionType_2_1() != SessionType_2_1::UNKNOWN)) {
    FetchAudioProvider_2_1();

    return;
  }

  if (sink_->GetSessionType() != SessionType::UNKNOWN) FetchAudioProvider();
  FetchAudioProvider();
}

BluetoothAudioSinkClientInterface::~BluetoothAudioSinkClientInterface() {
@@ -453,13 +456,18 @@ BluetoothAudioSourceClientInterface::BluetoothAudioSourceClientInterface(
                                        this, message_loop),
                                    source},
      source_(source) {
  if (HalVersionManager::GetHalVersion() ==
      BluetoothAudioHalVersion::VERSION_UNAVAILABLE) {
    return;
  }

  if ((HalVersionManager::GetHalVersion() ==
       BluetoothAudioHalVersion::VERSION_2_1) &&
      (source_->GetSessionType_2_1() != SessionType_2_1::UNKNOWN)) {
    FetchAudioProvider_2_1();
    return;
  }

  if (source_->GetSessionType() != SessionType::UNKNOWN) FetchAudioProvider();
  FetchAudioProvider();
}

BluetoothAudioSourceClientInterface::~BluetoothAudioSourceClientInterface() {