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

Commit 459f937f authored by Jakub Pawłowski's avatar Jakub Pawłowski Committed by Android (Google) Code Review
Browse files

Merge "le_audio: Don't trigger connection when device is not disconnected" into tm-qpr-dev

parents b132f610 0b8f739f
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -1107,8 +1107,17 @@ class LeAudioClientImpl : public LeAudioClient {
    LeAudioDevice* leAudioDevice = leAudioDevices_.FindByAddress(address);
    if (!leAudioDevice) {
      leAudioDevices_.Add(address, DeviceConnectState::CONNECTING_BY_USER);

    } else {
      if (leAudioDevice->GetConnectionState() !=
          DeviceConnectState::DISCONNECTED) {
        LOG_ERROR(
            "Device %s is in invalid state: %s",
            leAudioDevice->address_.ToString().c_str(),
            bluetooth::common::ToString(leAudioDevice->GetConnectionState())
                .c_str());

        return;
      }
      leAudioDevice->SetConnectionState(DeviceConnectState::CONNECTING_BY_USER);

      le_audio::MetricsCollector::Get()->OnConnectionStateChanged(