diff options
author | 2025-03-21 01:48:11 -0700 | |
---|---|---|
committer | 2025-03-21 01:48:11 -0700 | |
commit | 93a98f2df6b49e9704f9d81f2da6640a900e4c22 (patch) | |
tree | 3ecbe5b159a9ebf6dc8f5ad3d977f6e3d5906de6 | |
parent | 44d459e6ff7308fcb9a78deedc92842a6de5f832 (diff) | |
parent | fc5b76899c464056dc52b5d1273fdfba7b95b34b (diff) |
Merge changes I9c28b437,I8256e68a into main
* changes:
flag: Remove leaudio_codec_config_callback_order_fix flag
flag: Remove leaudio_speed_up_reconfiguration_between_call flag
-rw-r--r-- | android/app/src/com/android/bluetooth/le_audio/LeAudioService.java | 5 | ||||
-rw-r--r-- | android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java | 3 | ||||
-rw-r--r-- | flags/leaudio.aconfig | 20 | ||||
-rw-r--r-- | system/bta/le_audio/client.cc | 22 | ||||
-rw-r--r-- | system/bta/le_audio/le_audio_client_test.cc | 465 |
5 files changed, 4 insertions, 511 deletions
diff --git a/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java b/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java index 4f0d215e5b..3576d07c3c 100644 --- a/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java +++ b/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java @@ -3371,11 +3371,6 @@ public class LeAudioService extends ProfileService { boolean inputCodecOrFreqChanged) { Log.i(TAG, "notifyAudioFrameworkForCodecConfigUpdate groupId: " + groupId); - if (!Flags.leaudioCodecConfigCallbackOrderFix()) { - Log.d(TAG, "leaudio_codec_config_callback_order_fix is not enabled"); - return; - } - if (mActiveAudioOutDevice != null && outputCodecOrFreqChanged) { int volume = getAudioDeviceGroupVolume(groupId); diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java index 1690ba0775..5d3634d952 100644 --- a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java +++ b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java @@ -211,7 +211,6 @@ public class LeAudioServiceTest { public static List<FlagsParameterization> getParams() { return FlagsParameterization.progressionOf( Flags.FLAG_LEAUDIO_BROADCAST_PRIMARY_GROUP_SELECTION, - Flags.FLAG_LEAUDIO_CODEC_CONFIG_CALLBACK_ORDER_FIX, Flags.FLAG_LEAUDIO_UNICAST_NO_AVAILABLE_CONTEXTS, Flags.FLAG_LEAUDIO_BROADCAST_API_MANAGE_PRIMARY_GROUP, Flags.FLAG_DO_NOT_HARDCODE_TMAP_ROLE_MASK); @@ -1843,7 +1842,6 @@ public class LeAudioServiceTest { /** Test native interface group status message handling */ @Test - @EnableFlags(Flags.FLAG_LEAUDIO_CODEC_CONFIG_CALLBACK_ORDER_FIX) public void testMessageFromNativeGroupCodecConfigChangedNonActiveDevice() { onGroupCodecConfChangedCallbackCalled = false; @@ -1929,7 +1927,6 @@ public class LeAudioServiceTest { /** Test native interface group status message handling */ @Test - @EnableFlags(Flags.FLAG_LEAUDIO_CODEC_CONFIG_CALLBACK_ORDER_FIX) public void testMessageFromNativeGroupCodecConfigChangedActiveDevice_DifferentConfiguration() { onGroupCodecConfChangedCallbackCalled = false; diff --git a/flags/leaudio.aconfig b/flags/leaudio.aconfig index a2f77b5658..bc9210e9b4 100644 --- a/flags/leaudio.aconfig +++ b/flags/leaudio.aconfig @@ -44,16 +44,6 @@ flag { } flag { - name: "leaudio_codec_config_callback_order_fix" - namespace: "bluetooth" - description: "Fix for the order on the callback" - bug: "326442537" - metadata { - purpose: PURPOSE_BUGFIX - } -} - -flag { name: "leaudio_allow_leaudio_only_devices" namespace: "bluetooth" description: "Enable Le Audio for LeAudio only devices" @@ -116,16 +106,6 @@ flag { } flag { - name: "leaudio_speed_up_reconfiguration_between_call" - namespace: "bluetooth" - description: "Fix reconfiguration time between call and media" - bug: "352686917" - metadata { - purpose: PURPOSE_BUGFIX - } -} - -flag { name: "leaudio_set_codec_config_preference" namespace: "bluetooth" description: "New apis to set codec config preference" diff --git a/system/bta/le_audio/client.cc b/system/bta/le_audio/client.cc index 43c5100b02..388070ef8a 100644 --- a/system/bta/le_audio/client.cc +++ b/system/bta/le_audio/client.cc @@ -1332,11 +1332,6 @@ public: in_call_ = in_call; - if (!com::android::bluetooth::flags::leaudio_speed_up_reconfiguration_between_call()) { - log::debug("leaudio_speed_up_reconfiguration_between_call flag is not enabled"); - return; - } - if (active_group_id_ == bluetooth::groups::kGroupUnknown) { log::debug("There is no active group"); return; @@ -1794,14 +1789,10 @@ public: /* Reset sink and source listener notified status */ sink_monitor_notified_status_ = std::nullopt; source_monitor_notified_status_ = std::nullopt; - if (com::android::bluetooth::flags::leaudio_codec_config_callback_order_fix()) { - SendAudioGroupSelectableCodecConfigChanged(group); - SendAudioGroupCurrentCodecConfigChanged(group); - callbacks_->OnGroupStatus(active_group_id_, GroupStatus::ACTIVE); - } else { - callbacks_->OnGroupStatus(active_group_id_, GroupStatus::ACTIVE); - SendAudioGroupSelectableCodecConfigChanged(group); - } + + SendAudioGroupSelectableCodecConfigChanged(group); + SendAudioGroupCurrentCodecConfigChanged(group); + callbacks_->OnGroupStatus(active_group_id_, GroupStatus::ACTIVE); } void SetEnableState(const RawAddress& address, bool enabled) override { @@ -5451,11 +5442,6 @@ public: remote_metadata.source.set(LeAudioContextType::CONVERSATIONAL); } - if (!com::android::bluetooth::flags::leaudio_speed_up_reconfiguration_between_call()) { - UpdateSinkLocalMetadataContextTypes(remote_metadata.source); - UpdateSourceLocalMetadataContextTypes(remote_metadata.sink); - } - if (IsInVoipCall()) { log::debug("Unsetting RINGTONE from remote sink"); remote_metadata.sink.unset(LeAudioContextType::RINGTONE); diff --git a/system/bta/le_audio/le_audio_client_test.cc b/system/bta/le_audio/le_audio_client_test.cc index 02104518d2..a27c272872 100644 --- a/system/bta/le_audio/le_audio_client_test.cc +++ b/system/bta/le_audio/le_audio_client_test.cc @@ -4792,7 +4792,6 @@ TEST_F(UnicastTest, GroupSetActiveNonConnectedGroup) { } TEST_F(UnicastTest, GroupSetActive_CurrentCodecSentOfActive) { - com::android::bluetooth::flags::provider_->leaudio_codec_config_callback_order_fix(true); const RawAddress test_address0 = GetTestAddress(0); int group_id = bluetooth::groups::kGroupUnknown; @@ -8837,111 +8836,7 @@ TEST_F(UnicastTest, TwoEarbudsStopConversational_StartStreamSonification) { Mock::VerifyAndClearExpectations(&mock_state_machine_); } -TEST_F(UnicastTest, TwoEarbudsStreamingContextSwitchReconfigure) { - // TODO(b/352686917). Remove the test when flag will be removing - com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(false); - - uint8_t group_size = 2; - int group_id = 2; - - // Report working CSIS - ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); - - ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); - - // First earbud - const RawAddress test_address0 = GetTestAddress(0); - EXPECT_CALL(mock_btif_storage_, AddLeaudioAutoconnect(test_address0, true)).Times(1); - ConnectCsisDevice(test_address0, 1 /*conn_id*/, codec_spec_conf::kLeAudioLocationFrontLeft, - codec_spec_conf::kLeAudioLocationFrontLeft, group_size, group_id, 1 /* rank*/); - - // Second earbud - const RawAddress test_address1 = GetTestAddress(1); - EXPECT_CALL(mock_btif_storage_, AddLeaudioAutoconnect(test_address1, true)).Times(1); - ConnectCsisDevice(test_address1, 2 /*conn_id*/, codec_spec_conf::kLeAudioLocationFrontRight, - codec_spec_conf::kLeAudioLocationFrontRight, group_size, group_id, 2 /* rank*/, - true /*connect_through_csis*/); - - constexpr int gmcs_ccid = 1; - constexpr int gtbs_ccid = 2; - - // Start streaming MEDIA - EXPECT_CALL(*mock_le_audio_source_hal_client_, Start(_, _, _)).Times(1); - EXPECT_CALL(*mock_le_audio_sink_hal_client_, Start(_, _, _)).Times(1); - LeAudioClient::Get()->SetCcidInformation(gmcs_ccid, 4 /* Media */); - LeAudioClient::Get()->SetCcidInformation(gtbs_ccid, 2 /* Phone */); - LeAudioClient::Get()->GroupSetActive(group_id); - SyncOnMainLoop(); - - types::BidirectionalPair<std::vector<uint8_t>> ccids = {.sink = {gmcs_ccid}, .source = {}}; - EXPECT_CALL(mock_state_machine_, StartStream(_, _, _, ccids)).Times(1); - StartStreaming(AUDIO_USAGE_MEDIA, AUDIO_CONTENT_TYPE_MUSIC, group_id); - - SyncOnMainLoop(); - Mock::VerifyAndClearExpectations(&mock_state_machine_); - Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); - Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); - - // Verify Data transfer on two peer sinks - uint8_t cis_count_out = 2; - uint8_t cis_count_in = 0; - TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920); - - // Stop - StopStreaming(group_id); - // simulate suspend timeout passed, alarm executing - fake_osi_alarm_set_on_mloop_.cb(fake_osi_alarm_set_on_mloop_.data); - Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); - - log::info("SetInCall is used by GTBS - and only then we can expect CCID to be set."); - LeAudioClient::Get()->SetInCall(true); - - // Conversational is a bidirectional scenario so expect GTBS CCID - // in the metadata for both directions. Can be called twice when one - // direction resume after the other and metadata is updated. - ccids = {.sink = {gtbs_ccid}, .source = {gtbs_ccid}}; - EXPECT_CALL(mock_state_machine_, - StartStream(_, types::LeAudioContextType::CONVERSATIONAL, _, ccids)) - .Times(AtLeast(1)); - StartStreaming(AUDIO_USAGE_VOICE_COMMUNICATION, AUDIO_CONTENT_TYPE_SPEECH, group_id); - - SyncOnMainLoop(); - Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); - Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); - - // Verify Data transfer on two peer sinks and one source - cis_count_out = 2; - cis_count_in = 2; - TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920, 40); - - log::info("End call"); - LeAudioClient::Get()->SetInCall(false); - UpdateLocalSourceMetadata(AUDIO_USAGE_UNKNOWN, AUDIO_CONTENT_TYPE_UNKNOWN, false); - UpdateLocalSinkMetadata(std::nullopt); - // Stop - StopStreaming(group_id, true); - - log::info("Switch back to MEDIA"); - ccids = {.sink = {gmcs_ccid}, .source = {}}; - types::BidirectionalPair<types::AudioContexts> contexts = { - .sink = types::AudioContexts(types::LeAudioContextType::MEDIA), - .source = types::AudioContexts()}; - EXPECT_CALL(mock_state_machine_, - ConfigureStream(_, bluetooth::le_audio::types::LeAudioContextType::MEDIA, contexts, - ccids, _)) - .Times(1); - StartStreaming(AUDIO_USAGE_MEDIA, AUDIO_CONTENT_TYPE_MUSIC, group_id, AUDIO_SOURCE_INVALID, true); - - SyncOnMainLoop(); - Mock::VerifyAndClearExpectations(&mock_state_machine_); - Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); - Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); -} - TEST_F(UnicastTest, TwoEarbudsStreamingContextSwitchReconfigure_SpeedUpReconfigFlagEnabled) { - com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(true); - uint8_t group_size = 2; int group_id = 2; @@ -10937,79 +10832,7 @@ TEST_F(UnicastTest, SwitchBetweenSoundEffectAndMicrophoneScenario) { * What we can do now is to keep streaming (and reconfigure if needed for the * use case). */ -TEST_F(UnicastTest, UpdateNotSupportedContextTypeUnspecifiedAvailable) { - // TODO(b/352686917). Remove the test when flag will be removing - com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(false); - - const RawAddress test_address0 = GetTestAddress(0); - int group_id = bluetooth::groups::kGroupUnknown; - - available_snk_context_types_ = - (types::LeAudioContextType::RINGTONE | types::LeAudioContextType::CONVERSATIONAL | - types::LeAudioContextType::UNSPECIFIED | types::LeAudioContextType::MEDIA) - .value(); - supported_snk_context_types_ = available_snk_context_types_; - available_src_context_types_ = available_snk_context_types_; - supported_src_context_types_ = available_src_context_types_; - - SetSampleDatabaseEarbudsValid(1, test_address0, codec_spec_conf::kLeAudioLocationStereo, - codec_spec_conf::kLeAudioLocationStereo, default_channel_cnt, - default_channel_cnt, 0x0004, false /*add_csis*/, true /*add_cas*/, - true /*add_pacs*/, default_ase_cnt /*add_ascs_cnt*/, 1 /*set_size*/, - 0 /*rank*/); - EXPECT_CALL(mock_audio_hal_client_callbacks_, - OnConnectionState(ConnectionState::CONNECTED, test_address0)) - .Times(1); - EXPECT_CALL(mock_audio_hal_client_callbacks_, - OnGroupNodeStatus(test_address0, _, GroupNodeStatus::ADDED)) - .WillOnce(DoAll(SaveArg<1>(&group_id))); - - ConnectLeAudio(test_address0); - ASSERT_NE(group_id, bluetooth::groups::kGroupUnknown); - - // Start streaming - uint8_t cis_count_out = 1; - uint8_t cis_count_in = 0; - - LeAudioClient::Get()->SetInCall(true); - - // Audio sessions are started only when device gets active - EXPECT_CALL(*mock_le_audio_source_hal_client_, Start(_, _, _)).Times(1); - EXPECT_CALL(*mock_le_audio_sink_hal_client_, Start(_, _, _)).Times(1); - LeAudioClient::Get()->GroupSetActive(group_id); - SyncOnMainLoop(); - - StartStreaming(AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE, AUDIO_CONTENT_TYPE_UNKNOWN, group_id); - LocalAudioSourceResume(); - LocalAudioSinkResume(); - - Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); - Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); - SyncOnMainLoop(); - - // Verify Data transfer on one audio source cis - TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920); - - LeAudioClient::Get()->SetInCall(false); - LocalAudioSinkSuspend(); - UpdateLocalSinkMetadata(std::nullopt); - - /* We should use GAME configuration, but do not send the GAME context type, as - * it is not available on the remote device. - */ - EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(0); - types::BidirectionalPair<types::AudioContexts> contexts = { - .sink = types::AudioContexts(types::LeAudioContextType::UNSPECIFIED), - .source = types::AudioContexts()}; - EXPECT_CALL(mock_state_machine_, StartStream(_, types::LeAudioContextType::GAME, contexts, _)) - .Times(1); - UpdateLocalSourceMetadata(AUDIO_USAGE_GAME, AUDIO_CONTENT_TYPE_UNKNOWN, false); - SyncOnMainLoop(); -} - TEST_F(UnicastTest, UpdateNotSupportedContextTypeUnspecifiedAvailable_SpeedUpReconfigFlagEnabled) { - com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(true); - const RawAddress test_address0 = GetTestAddress(0); int group_id = bluetooth::groups::kGroupUnknown; @@ -11081,146 +10904,7 @@ TEST_F(UnicastTest, UpdateNotSupportedContextTypeUnspecifiedAvailable_SpeedUpRec * always results with one bidirectional context, so that the remote device * is not confused about our intentions. */ -TEST_F(UnicastTest, UpdateMultipleBidirContextTypes) { - // TODO(b/352686917). Remove the test when flag will be removing - com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(false); - - const RawAddress test_address0 = GetTestAddress(0); - int group_id = bluetooth::groups::kGroupUnknown; - - available_snk_context_types_ = (types::LeAudioContextType::CONVERSATIONAL | - types::LeAudioContextType::GAME | types::LeAudioContextType::LIVE) - .value(); - supported_snk_context_types_ = - available_snk_context_types_ | - types::AudioContexts(types::LeAudioContextType::UNSPECIFIED).value(); - available_src_context_types_ = available_snk_context_types_; - supported_src_context_types_ = - available_src_context_types_ | - types::AudioContexts(types::LeAudioContextType::UNSPECIFIED).value(); - - SetSampleDatabaseEarbudsValid(1, test_address0, codec_spec_conf::kLeAudioLocationAnyLeft, - codec_spec_conf::kLeAudioLocationStereo, default_channel_cnt, - default_channel_cnt, 0x0024, false /*add_csis*/, true /*add_cas*/, - true /*add_pacs*/, default_ase_cnt /*add_ascs_cnt*/, 1 /*set_size*/, - 0 /*rank*/); - EXPECT_CALL(mock_audio_hal_client_callbacks_, - OnConnectionState(ConnectionState::CONNECTED, test_address0)) - .Times(1); - EXPECT_CALL(mock_audio_hal_client_callbacks_, - OnGroupNodeStatus(test_address0, _, GroupNodeStatus::ADDED)) - .WillOnce(DoAll(SaveArg<1>(&group_id))); - - ConnectLeAudio(test_address0); - ASSERT_NE(group_id, bluetooth::groups::kGroupUnknown); - - // Audio sessions are started only when device gets active - EXPECT_CALL(*mock_le_audio_source_hal_client_, Start(_, _, _)).Times(1); - EXPECT_CALL(*mock_le_audio_sink_hal_client_, Start(_, _, _)).Times(1); - LeAudioClient::Get()->GroupSetActive(group_id); - SyncOnMainLoop(); - - // When the local audio sink resumes expect only LIVE context - types::BidirectionalPair<types::AudioContexts> contexts = { - .sink = types::AudioContexts(types::LeAudioContextType::LIVE), - .source = types::AudioContexts(types::LeAudioContextType::LIVE)}; - EXPECT_CALL(mock_state_machine_, - StartStream(_, bluetooth::le_audio::types::LeAudioContextType::LIVE, contexts, _)) - .Times(1); - - // 1) Start the recording. Sink resume will trigger the reconfiguration - // --------------------------------------------------------------------- - ASSERT_NE(nullptr, unicast_sink_hal_cb_); - UpdateLocalSinkMetadata(AUDIO_SOURCE_MIC); - LocalAudioSinkResume(); - - Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); - Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_); - Mock::VerifyAndClearExpectations(&mock_state_machine_); - - /* After the reconfiguration the local Audio Sink HAL has to resume again */ - LocalAudioSourceResume(); - LocalAudioSinkResume(); - - Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); - Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_); - Mock::VerifyAndClearExpectations(&mock_state_machine_); - - // Verify Data transfer on one audio source and sink cis - uint8_t cis_count_out = 1; - uint8_t cis_count_in = 1; - TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920, 40); - - // Stop - StopStreaming(group_id); - Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); - - // 2) Now set in call preference to get CONVERSATIONAL into the mix - // ----------------------------------------------------------------- - LeAudioClient::Get()->SetInCall(true); - - // Verify that we only got CONVERSATIONAL context and no LIVE - contexts = {.sink = types::AudioContexts(types::LeAudioContextType::CONVERSATIONAL), - .source = types::AudioContexts(types::LeAudioContextType::CONVERSATIONAL)}; - EXPECT_CALL(mock_state_machine_, - StartStream(_, bluetooth::le_audio::types::LeAudioContextType::CONVERSATIONAL, - contexts, _)) - .Times(1); - - // Start with ringtone on local source - ASSERT_NE(nullptr, unicast_sink_hal_cb_); - StartStreaming(AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE, AUDIO_CONTENT_TYPE_UNKNOWN, group_id); - - // Resume both directions - LocalAudioSourceResume(); - LocalAudioSinkResume(); - - Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); - Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); - Mock::VerifyAndClearExpectations(&mock_state_machine_); - - // Verify Data transfer on one audio source cis - cis_count_out = 1; - cis_count_in = 1; - TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920, 40); - - // 3) Disable call so we could go to GAME - // --------------------------------------- - LeAudioClient::Get()->SetInCall(false); - - /* Start the game on local source - expect no previous sink (LIVE) metadata */ - EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(0); - contexts = {.sink = types::AudioContexts(types::LeAudioContextType::GAME), - .source = types::AudioContexts(types::LeAudioContextType::GAME)}; - EXPECT_CALL(mock_state_machine_, StartStream(_, types::LeAudioContextType::GAME, contexts, _)) - .Times(1); - UpdateLocalSourceMetadata(AUDIO_USAGE_GAME, AUDIO_CONTENT_TYPE_UNKNOWN, false); - - /* If the above triggers reconfiguration, Audio Hal action is needed to - * restart the stream. - */ - LocalAudioSourceResume(); - LocalAudioSinkResume(); - Mock::VerifyAndClearExpectations(&mock_state_machine_); - - // 4) Stop streaming - // ------------------ - StopStreaming(group_id); - Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); - - // Release - 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); - do_in_main_thread(base::BindOnce( - [](LeAudioClient* client) { client->GroupSetActive(bluetooth::groups::kGroupUnknown); }, - LeAudioClient::Get())); - SyncOnMainLoop(); -} - TEST_F(UnicastTest, UpdateMultipleBidirContextTypes_SpeedUpReconfigFlagEnabled) { - com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(true); - const RawAddress test_address0 = GetTestAddress(0); int group_id = bluetooth::groups::kGroupUnknown; @@ -11444,154 +11128,7 @@ TEST_F(UnicastTest, UpdateDisableLocalAudioSinkOnGame) { } /* Start music when in a call, end the call, continue with music only */ -TEST_F(UnicastTest, MusicDuringCallContextTypes) { - // TODO(b/352686917). Remove the test when flag will be removing - com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(false); - - const RawAddress test_address0 = GetTestAddress(0); - int group_id = bluetooth::groups::kGroupUnknown; - - available_snk_context_types_ = - (types::LeAudioContextType::CONVERSATIONAL | types::LeAudioContextType::RINGTONE | - types::LeAudioContextType::GAME | types::LeAudioContextType::MEDIA | - types::LeAudioContextType::LIVE | types::LeAudioContextType::NOTIFICATIONS) - .value(); - supported_snk_context_types_ = - available_snk_context_types_ | - types::AudioContexts(types::LeAudioContextType::UNSPECIFIED).value(); - available_src_context_types_ = available_snk_context_types_; - available_src_context_types_ &= - ~((types::LeAudioContextType::NOTIFICATIONS | types::LeAudioContextType::MEDIA).value()); - supported_src_context_types_ = - available_src_context_types_ | - types::AudioContexts(types::LeAudioContextType::UNSPECIFIED).value(); - - SetSampleDatabaseEarbudsValid(1, test_address0, codec_spec_conf::kLeAudioLocationAnyLeft, - codec_spec_conf::kLeAudioLocationStereo, default_channel_cnt, - default_channel_cnt, 0x0024, false /*add_csis*/, true /*add_cas*/, - true /*add_pacs*/, default_ase_cnt /*add_ascs_cnt*/, 1 /*set_size*/, - 0 /*rank*/); - EXPECT_CALL(mock_audio_hal_client_callbacks_, - OnConnectionState(ConnectionState::CONNECTED, test_address0)) - .Times(1); - EXPECT_CALL(mock_audio_hal_client_callbacks_, - OnGroupNodeStatus(test_address0, _, GroupNodeStatus::ADDED)) - .WillOnce(DoAll(SaveArg<1>(&group_id))); - - ConnectLeAudio(test_address0); - ASSERT_NE(group_id, bluetooth::groups::kGroupUnknown); - - // Audio sessions are started only when device gets active - EXPECT_CALL(*mock_le_audio_source_hal_client_, Start(_, _, _)).Times(1); - EXPECT_CALL(*mock_le_audio_sink_hal_client_, Start(_, _, _)).Times(1); - LeAudioClient::Get()->GroupSetActive(group_id); - SyncOnMainLoop(); - - log::info("TESTPOINT 1: Start with the call first"); - // ----------------------------- - // CONVERSATIONAL is from In Call preference, and RINGTONE is from metadata - LeAudioClient::Get()->SetInCall(true); - types::BidirectionalPair<types::AudioContexts> contexts = { - .sink = types::AudioContexts(types::LeAudioContextType::RINGTONE | - types::LeAudioContextType::CONVERSATIONAL), - .source = types::AudioContexts(types::LeAudioContextType::CONVERSATIONAL)}; - EXPECT_CALL(mock_state_machine_, - StartStream(_, bluetooth::le_audio::types::LeAudioContextType::CONVERSATIONAL, - contexts, _)) - .Times(1); - StartStreaming(AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE, AUDIO_CONTENT_TYPE_UNKNOWN, group_id); - LocalAudioSinkResume(); - - // Verify - Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); - Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); - Mock::VerifyAndClearExpectations(&mock_state_machine_); - - // Verify Data transfer - uint8_t cis_count_out = 1; - uint8_t cis_count_in = 1; - TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920, 40); - - log::info("TESTPOINT 2: Start MEDIA during the call, expect MEDIA only on the remote sink"); - contexts = {.sink = types::AudioContexts(types::LeAudioContextType::CONVERSATIONAL | - types::LeAudioContextType::MEDIA), - .source = types::AudioContexts(types::LeAudioContextType::CONVERSATIONAL)}; - EXPECT_CALL(mock_state_machine_, - StartStream(_, bluetooth::le_audio::types::LeAudioContextType::CONVERSATIONAL, - contexts, _)) - .Times(1); - UpdateLocalSourceMetadata(AUDIO_USAGE_MEDIA, AUDIO_CONTENT_TYPE_MUSIC, false); - SyncOnMainLoop(); - - Mock::VerifyAndClearExpectations(&mock_state_machine_); - Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); - Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_); - - log::info( - "TESTPOINT 3: Disable In Call preference but do not suspend the local sink. Play " - "notification on the same stream."); - // Verify both context are sent as the metadata. - // --------------------------------------- - LeAudioClient::Get()->SetInCall(false); - - EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(0); - contexts = {.sink = types::AudioContexts(types::LeAudioContextType::NOTIFICATIONS | - types::LeAudioContextType::CONVERSATIONAL), - .source = types::AudioContexts(types::LeAudioContextType::CONVERSATIONAL)}; - EXPECT_CALL(mock_state_machine_, - StartStream(_, types::LeAudioContextType::CONVERSATIONAL, contexts, _)) - .Times(1); - UpdateLocalSourceMetadata(AUDIO_USAGE_NOTIFICATION, AUDIO_CONTENT_TYPE_UNKNOWN, - /*reconfigure=*/false); - Mock::VerifyAndClearExpectations(&mock_state_machine_); - Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); - Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_); - - log::info("TESTPOINT 4: Disable call so we could go back to MEDIA"); - // --------------------------------------- - // Suspend should stop the stream - EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(1); - UpdateLocalSinkMetadata(std::nullopt); - LocalAudioSourceSuspend(); - LocalAudioSinkSuspend(); - // simulate suspend timeout passed, alarm executing - fake_osi_alarm_set_on_mloop_.cb(fake_osi_alarm_set_on_mloop_.data); - Mock::VerifyAndClearExpectations(&mock_state_machine_); - - // Restart the stream with MEDIA - contexts = {.sink = types::AudioContexts(types::LeAudioContextType::MEDIA), - .source = types::AudioContexts()}; - EXPECT_CALL(mock_state_machine_, StartStream(_, types::LeAudioContextType::MEDIA, contexts, _)) - .Times(1); - UpdateLocalSourceMetadata(AUDIO_USAGE_MEDIA, AUDIO_CONTENT_TYPE_MUSIC, - /*reconfigure=*/false); - Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); - Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_); - - /* The source needs to resume to reconfigure to MEDIA */ - LocalAudioSourceResume(/*expect_confirm=*/false); - LocalAudioSourceResume(/*expect_confirm=*/true); - Mock::VerifyAndClearExpectations(&mock_state_machine_); - Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); - Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_); - - log::info("TESTPOINT 5: Stop streaming"); - // ------------------ - StopStreaming(group_id); - Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); - - // Release - 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); - do_in_main_thread(base::BindOnce( - [](LeAudioClient* client) { client->GroupSetActive(bluetooth::groups::kGroupUnknown); }, - LeAudioClient::Get())); - SyncOnMainLoop(); -} - TEST_F(UnicastTest, MetadataUpdateDuringReconfiguration) { - com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(true); const RawAddress test_address0 = GetTestAddress(0); int group_id = bluetooth::groups::kGroupUnknown; @@ -11664,8 +11201,6 @@ TEST_F(UnicastTest, MetadataUpdateDuringReconfiguration) { } TEST_F(UnicastTest, MusicDuringCallContextTypes_SpeedUpReconfigFlagEnabled) { - com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(true); - const RawAddress test_address0 = GetTestAddress(0); int group_id = bluetooth::groups::kGroupUnknown; |