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

Commit 27536198 authored by Grzegorz Kołodziejczyk's avatar Grzegorz Kołodziejczyk Committed by Automerger Merge Worker
Browse files

BluetoothAudioHAL: Avoid deadlock for get Providers Factory 2.1 am: c68c86c4

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1608413

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic0b5391c74078e2c9407b49b59c41374356c5531
parents 23af5755 c68c86c4
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -69,8 +69,9 @@ class HalVersionManager {

  static android::sp<IBluetoothAudioProvidersFactory_2_0>
  GetProvidersFactory_2_0() {
    std::lock_guard<std::mutex> guard(instance_ptr->mutex_);
    std::unique_lock<std::mutex> guard(instance_ptr->mutex_);
    if (instance_ptr->hal_version_ == BluetoothAudioHalVersion::VERSION_2_1) {
      guard.unlock();
      return instance_ptr->GetProvidersFactory_2_1();
    }
    android::sp<IBluetoothAudioProvidersFactory_2_0> providers_factory =
@@ -81,6 +82,7 @@ class HalVersionManager {
    LOG(INFO) << "V2_0::IBluetoothAudioProvidersFactory::getService() returned "
              << providers_factory.get()
              << (providers_factory->isRemote() ? " (remote)" : " (local)");
    guard.unlock();
    return providers_factory;
  }