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

Commit feea1430 authored by Grzegorz Kołodziejczyk's avatar Grzegorz Kołodziejczyk
Browse files

le_audio: Sync on main loop on MicrophoneAttachToCurrentMediaScenario

Schedule setting active group in main thread to not introduce races with
resume call which may potentially lead to use after free issue.

Tag: #feature
Bug: 264233314
Test: atest bluetooth_le_audio_test
Change-Id: Ib69a8fe9c5e63b66c7c6963b27ca302263234ff2
parent 70bee993
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -4285,8 +4285,15 @@ TEST_F(UnicastTest, MicrophoneAttachToCurrentMediaScenario) {
  EXPECT_CALL(*mock_le_audio_source_hal_client_, Stop()).Times(1);
  EXPECT_CALL(*mock_le_audio_source_hal_client_, OnDestroyed()).Times(1);
  EXPECT_CALL(*mock_le_audio_sink_hal_client_, OnDestroyed()).Times(1);
  LeAudioClient::Get()->GroupSetActive(bluetooth::groups::kGroupUnknown);
  do_in_main_thread(
      FROM_HERE, base::BindOnce(
                     [](LeAudioClient* client) {
                       client->GroupSetActive(bluetooth::groups::kGroupUnknown);
                     },
                     LeAudioClient::Get()));
  Mock::VerifyAndClearExpectations(&mock_le_audio_source_hal_client_);

  SyncOnMainLoop();
}

TEST_F(UnicastTest, UpdateNotSupportedContextType) {