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

Commit 876c5331 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "leaudio: Improve inactivating group in error case" into main

parents 5cf3cb81 974d0272
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1222,16 +1222,16 @@ class LeAudioClientImpl : public LeAudioClient {
    if (active_group_id_ == bluetooth::groups::kGroupUnknown) {
      return;
    }
    auto group_id_to_close = active_group_id_;
    active_group_id_ = bluetooth::groups::kGroupUnknown;
    sink_monitor_notified_status_ = std::nullopt;
    log::info("Group id: {}", active_group_id_);

    log::info("Group id: {}", group_id_to_close);
    if (alarm_is_scheduled(suspend_timeout_)) alarm_cancel(suspend_timeout_);

    StopAudio();
    ClientAudioInterfaceRelease();
    callbacks_->OnGroupStatus(group_id_to_close, GroupStatus::INACTIVE);

    callbacks_->OnGroupStatus(active_group_id_, GroupStatus::INACTIVE);
    active_group_id_ = bluetooth::groups::kGroupUnknown;
  }

  void GroupSetActive(const int group_id) override {
+7 −1
Original line number Diff line number Diff line
@@ -5145,13 +5145,17 @@ TEST_F(UnicastTest, InactiveDeviceOnInternalStateMachineError) {

  SyncOnMainLoop();
  Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_);
  Mock::VerifyAndClearExpectations(&mock_le_audio_source_hal_client_);
  Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_);
  Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_);
  Mock::VerifyAndClearExpectations(&mock_state_machine_);
  SyncOnMainLoop();

  // Verify Data transfer on one audio source cis
  TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920);

  EXPECT_CALL(*mock_le_audio_source_hal_client_, Stop()).Times(1);
  EXPECT_CALL(*mock_le_audio_sink_hal_client_, Stop()).Times(1);

  EXPECT_CALL(mock_audio_hal_client_callbacks_,
              OnGroupStatus(group_id, GroupStatus::INACTIVE))
      .Times(1);
@@ -5162,6 +5166,8 @@ TEST_F(UnicastTest, InactiveDeviceOnInternalStateMachineError) {

  SyncOnMainLoop();
  Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_);
  Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_);
  Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_);
}

TEST_F(UnicastTest, GroupingAddTwiceNoRemove) {