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

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

leaudio: Remove autonomous disable timeout

Autonomous disable timeout turns out to be not needed.
The way it was implemented, would block remote device to disable one
direction for the bi-directional CISes e.g. when remote decide to no use
microphone.

Also the way it was implemented did not help with invalid remote behavior
which would be not moving to QoS Configured state when CIS was lost.
In fact it is not needed, as Android assumes that after CIS link lost,
ASEs are in the QoS Configured state as per specification. Remote
notification on this state does not matter here - which helps in IOP.

Bug: 335799807
Bug: 343860840
Flag: Exempt, regression tested with unittests
Test: atest bluetooth_le_audio_test

Change-Id: I01091291398b8cc2c08749c6d0533079672d2597
parent 9d9867d4
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -539,12 +539,6 @@ class LeAudioClientImpl : public LeAudioClient {
    }
  }

  void OnDeviceAutonomousStateTransitionTimeout(LeAudioDevice* leAudioDevice) {
    log::error("Device {}, failed to complete autonomous transition",
               leAudioDevice->address_);
    DisconnectDevice(leAudioDevice, true);
  }

  void UpdateLocationsAndContextsAvailability(LeAudioDeviceGroup* group,
                                              bool force = false) {
    bool group_conf_changed = group->ReloadAudioLocations();
@@ -6193,12 +6187,6 @@ class CallbacksImpl : public LeAudioGroupStateMachine::Callbacks {
    if (instance) instance->OnLeAudioDeviceSetStateTimeout(group_id);
  }

  void OnDeviceAutonomousStateTransitionTimeout(
      LeAudioDevice* leAudioDevice) override {
    if (instance)
      instance->OnDeviceAutonomousStateTransitionTimeout(leAudioDevice);
  }

  void OnUpdatedCisConfiguration(int group_id, uint8_t direction) {
    if (instance) instance->OnUpdatedCisConfiguration(group_id, direction);
  }
+12 −0
Original line number Diff line number Diff line
@@ -353,6 +353,18 @@ bool LeAudioDeviceGroup::IsGroupReadyToSuspendStream(void) const {
  return iter == leAudioDevices_.end();
}

bool LeAudioDeviceGroup::HaveAnyActiveDeviceInStreamingState() const {
  auto iter =
      std::find_if(leAudioDevices_.begin(), leAudioDevices_.end(), [](auto& d) {
        if (d.expired())
          return false;
        else
          return (((d.lock()).get())->HaveAnyStreamingAses());
      });

  return iter != leAudioDevices_.end();
}

bool LeAudioDeviceGroup::HaveAnyActiveDeviceInUnconfiguredState() const {
  auto iter =
      std::find_if(leAudioDevices_.begin(), leAudioDevices_.end(), [](auto& d) {
+1 −0
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@ class LeAudioDeviceGroup {
      types::DataPathState data_path_state) const;
  bool IsDeviceInTheGroup(LeAudioDevice* leAudioDevice) const;
  bool HaveAllActiveDevicesAsesTheSameState(types::AseState state) const;
  bool HaveAnyActiveDeviceInStreamingState() const;
  bool HaveAnyActiveDeviceInUnconfiguredState() const;
  bool IsGroupStreamReady(void) const;
  bool IsGroupReadyToCreateStream(void) const;
+16 −8
Original line number Diff line number Diff line
@@ -425,9 +425,6 @@ void LeAudioDevice::ClearPACs(void) {

LeAudioDevice::~LeAudioDevice(void) {
  alarm_free(link_quality_timer);
  for (auto& ase : ases_) {
    alarm_free(ase.autonomous_operation_timer_);
  }
  this->ClearPACs();
}

@@ -722,6 +719,19 @@ bool LeAudioDevice::HaveActiveAse(void) {
  return iter != ases_.end();
}

bool LeAudioDevice::HaveAnyStreamingAses(void) {
  /* In configuring state when active in Idle or Configured and reconfigure */
  auto iter = std::find_if(ases_.begin(), ases_.end(), [](const auto& ase) {
    if (!ase.active) return false;

    if (ase.state == AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING) return true;

    return false;
  });

  return iter != ases_.end();
}

bool LeAudioDevice::HaveAnyUnconfiguredAses(void) {
  /* In configuring state when active in Idle or Configured and reconfigure */
  auto iter = std::find_if(ases_.begin(), ases_.end(), [](const auto& ase) {
@@ -1130,11 +1140,9 @@ void LeAudioDevice::DeactivateAllAses(void) {
          bluetooth::common::ToString(ase.cis_state),
          bluetooth::common::ToString(ase.data_path_state));
    }
    if (alarm_is_scheduled(ase.autonomous_operation_timer_)) {
      alarm_free(ase.autonomous_operation_timer_);
      ase.autonomous_operation_timer_ = NULL;
      ase.autonomous_target_state_ = AseState::BTA_LE_AUDIO_ASE_STATE_IDLE;
    }

    log::verbose("{}, ase_id {}", address_, ase.id);

    ase.state = AseState::BTA_LE_AUDIO_ASE_STATE_IDLE;
    ase.cis_state = CisState::IDLE;
    ase.data_path_state = DataPathState::IDLE;
+1 −0
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@ class LeAudioDevice {
  bool HaveAllActiveAsesSameState(types::AseState state);
  bool HaveAllActiveAsesSameDataPathState(types::DataPathState state) const;
  bool HaveAnyUnconfiguredAses(void);
  bool HaveAnyStreamingAses(void);
  bool IsReadyToCreateStream(void);
  bool IsReadyToStream(void) const {
    return HaveAllActiveAsesCisEst() &&
Loading