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

Commit c6ecf4a2 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

leaudio: Always disconnect group on the transition timeout

With this patch if remote devices stop to response, the group will get
disconnected

Bug: 216466543
Bug: 150670922
Test: atest --host bluetooth_le_audio_test
bluetooth_le_audio_client_test
Sponsor: @jpawlowski

Change-Id: Iff2ea989a3a896bf8099eeba5c23e8487a176d42
parent ac914e52
Loading
Loading
Loading
Loading
+24 −16
Original line number Diff line number Diff line
@@ -299,24 +299,32 @@ class LeAudioClientImpl : public LeAudioClient {
      return;
    }

    /* Releasement didn't finished in time */
    if (group->GetTargetState() == AseState::BTA_LE_AUDIO_ASE_STATE_IDLE) {
    LOG_ERROR(
        " State not achieved on time for group: group id %d, current state %s, "
        "target state: %s",
        group_id, ToString(group->GetState()).c_str(),
        ToString(group->GetTargetState()).c_str());
    group->SetTargetState(AseState::BTA_LE_AUDIO_ASE_STATE_IDLE);

    /* There is an issue with a setting up stream or any other operation which
     * are gatt operations. It means peer is not responsable. Lets close ACL
     */
    CancelStreamingRequest();
    LeAudioDevice* leAudioDevice = group->GetFirstActiveDevice();
      LOG_ASSERT(leAudioDevice)
          << __func__ << " Shouldn't be called without an active device.";
    if (leAudioDevice == nullptr) {
      LOG_ERROR(" Shouldn't be called without an active device.");
      leAudioDevice = group->GetFirstDevice();
      if (leAudioDevice == nullptr) {
        LOG_ERROR(" Front device is null. Number of devices: %d",
                  group->Size());
        return;
      }
    }

    do {
      if (instance) instance->DisconnectDevice(leAudioDevice, true);
      leAudioDevice = group->GetNextActiveDevice(leAudioDevice);
    } while (leAudioDevice);

      return;
    }

    LOG(ERROR) << __func__ << ", State not achieved on time, releasing ases";

    groupStateMachine_->StopStream(group);
  }

  void UpdateContextAndLocations(LeAudioDeviceGroup* group,