Loading system/bta/le_audio/client.cc +12 −9 Original line number Diff line number Diff line Loading @@ -4736,8 +4736,6 @@ public: local_metadata_context_types_.sink = ChooseMetadataContextType(local_metadata_context_types_.sink); local_metadata_context_types_.source = ChooseMetadataContextType(local_metadata_context_types_.source); /* Reconfigure or update only if the stream is already started * otherwise wait for the local sink to resume. Loading Loading @@ -4784,20 +4782,25 @@ public: SetInVoipCall(false); } BidirectionalPair<AudioContexts> remote_metadata = { .sink = local_metadata_context_types_.source, .source = local_metadata_context_types_.sink}; /* Make sure we have CONVERSATIONAL when in a call and it is not mixed * with any other bidirectional context */ if (IsInCall() || IsInVoipCall()) { log::debug("In Call preference used: {}, voip call: {}", IsInCall(), IsInVoipCall()); local_metadata_context_types_.sink.unset_all(kLeAudioContextAllBidir); local_metadata_context_types_.source.unset_all(kLeAudioContextAllBidir); local_metadata_context_types_.sink.set(LeAudioContextType::CONVERSATIONAL); local_metadata_context_types_.source.set(LeAudioContextType::CONVERSATIONAL); remote_metadata.sink.unset_all(kLeAudioContextAllBidir); remote_metadata.source.unset_all(kLeAudioContextAllBidir); remote_metadata.sink.set(LeAudioContextType::CONVERSATIONAL); remote_metadata.source.set(LeAudioContextType::CONVERSATIONAL); } BidirectionalPair<AudioContexts> remote_metadata = { .sink = local_metadata_context_types_.source, .source = local_metadata_context_types_.sink}; if (!com::android::bluetooth::flags::leaudio_speed_up_reconfiguration_between_call()) { local_metadata_context_types_.sink = remote_metadata.source; local_metadata_context_types_.source = remote_metadata.sink; } if (IsInVoipCall()) { log::debug("Unsetting RINGTONE from remote sink"); Loading system/bta/le_audio/le_audio_client_test.cc +20 −14 Original line number Diff line number Diff line Loading @@ -1028,9 +1028,13 @@ protected: metadata_context_types, types::BidirectionalPair<std::vector<uint8_t>> ccid_lists) { auto group_state = group->GetState(); log::info("StartStream: group {} state {}, context type {}", group->group_id_, bluetooth::common::ToString(group_state), bluetooth::common::ToString(context_type)); log::info( "StartStream: group {} state {}, context type {} sink metadata_ctx {}, " "source metadata_ctx {}", group->group_id_, bluetooth::common::ToString(group_state), bluetooth::common::ToString(context_type), bluetooth::common::ToString(metadata_context_types.sink), bluetooth::common::ToString(metadata_context_types.source)); /* Do nothing if already streaming - the implementation would * probably update the metadata. Loading Loading @@ -10432,7 +10436,7 @@ TEST_F(UnicastTest, MusicDuringCallContextTypes) { available_snk_context_types_ = (types::LeAudioContextType::CONVERSATIONAL | types::LeAudioContextType::RINGTONE | types::LeAudioContextType::GAME | types::LeAudioContextType::MEDIA | types::LeAudioContextType::LIVE) types::LeAudioContextType::LIVE | types::LeAudioContextType::NOTIFICATIONS) .value(); supported_snk_context_types_ = available_snk_context_types_ | Loading Loading @@ -10463,7 +10467,7 @@ TEST_F(UnicastTest, MusicDuringCallContextTypes) { LeAudioClient::Get()->GroupSetActive(group_id); SyncOnMainLoop(); // 1) Start with the call first log::info("TESTPOINT 1: Start with the call first"); // ----------------------------- // CONVERSATIONAL is from In Call preference, and RINGTONE is from metadata LeAudioClient::Get()->SetInCall(true); Loading @@ -10489,7 +10493,7 @@ TEST_F(UnicastTest, MusicDuringCallContextTypes) { uint8_t cis_count_in = 1; TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920, 40); // 2) Start MEDIA during the call, expect MEDIA only on the remote sink 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)}; Loading @@ -10504,25 +10508,27 @@ TEST_F(UnicastTest, MusicDuringCallContextTypes) { Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_); // 2) Disable In Call preference but do not suspend the local sink // We should stay in CONVERSATIONAL until the local sink suspends 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::MEDIA | 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_MEDIA, AUDIO_CONTENT_TYPE_MUSIC, 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_); // 3) Disable call so we could go back to MEDIA log::info("TESTPOING 4: Disable call so we could go back to MEDIA"); // --------------------------------------- // Suspend should stop the stream EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(1); Loading @@ -10549,7 +10555,7 @@ TEST_F(UnicastTest, MusicDuringCallContextTypes) { Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_); // 4) Stop streaming log::info("TESTPOINT 5: Stop streaming"); // ------------------ StopStreaming(group_id); Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); Loading @@ -10573,7 +10579,7 @@ TEST_F(UnicastTest, MusicDuringCallContextTypes_SpeedUpReconfigFlagEnabled) { available_snk_context_types_ = (types::LeAudioContextType::CONVERSATIONAL | types::LeAudioContextType::RINGTONE | types::LeAudioContextType::GAME | types::LeAudioContextType::MEDIA | types::LeAudioContextType::LIVE) types::LeAudioContextType::LIVE | types::LeAudioContextType::NOTIFICATIONS) .value(); supported_snk_context_types_ = available_snk_context_types_ | Loading Loading @@ -10659,7 +10665,7 @@ TEST_F(UnicastTest, MusicDuringCallContextTypes_SpeedUpReconfigFlagEnabled) { Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_); log::info("Step 2) Disable call so we could go back to MEDIA"); log::info("Step 3) Disable call so we could go back to MEDIA"); // --------------------------------------- // Suspend should stop the stream EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(1); Loading Loading
system/bta/le_audio/client.cc +12 −9 Original line number Diff line number Diff line Loading @@ -4736,8 +4736,6 @@ public: local_metadata_context_types_.sink = ChooseMetadataContextType(local_metadata_context_types_.sink); local_metadata_context_types_.source = ChooseMetadataContextType(local_metadata_context_types_.source); /* Reconfigure or update only if the stream is already started * otherwise wait for the local sink to resume. Loading Loading @@ -4784,20 +4782,25 @@ public: SetInVoipCall(false); } BidirectionalPair<AudioContexts> remote_metadata = { .sink = local_metadata_context_types_.source, .source = local_metadata_context_types_.sink}; /* Make sure we have CONVERSATIONAL when in a call and it is not mixed * with any other bidirectional context */ if (IsInCall() || IsInVoipCall()) { log::debug("In Call preference used: {}, voip call: {}", IsInCall(), IsInVoipCall()); local_metadata_context_types_.sink.unset_all(kLeAudioContextAllBidir); local_metadata_context_types_.source.unset_all(kLeAudioContextAllBidir); local_metadata_context_types_.sink.set(LeAudioContextType::CONVERSATIONAL); local_metadata_context_types_.source.set(LeAudioContextType::CONVERSATIONAL); remote_metadata.sink.unset_all(kLeAudioContextAllBidir); remote_metadata.source.unset_all(kLeAudioContextAllBidir); remote_metadata.sink.set(LeAudioContextType::CONVERSATIONAL); remote_metadata.source.set(LeAudioContextType::CONVERSATIONAL); } BidirectionalPair<AudioContexts> remote_metadata = { .sink = local_metadata_context_types_.source, .source = local_metadata_context_types_.sink}; if (!com::android::bluetooth::flags::leaudio_speed_up_reconfiguration_between_call()) { local_metadata_context_types_.sink = remote_metadata.source; local_metadata_context_types_.source = remote_metadata.sink; } if (IsInVoipCall()) { log::debug("Unsetting RINGTONE from remote sink"); Loading
system/bta/le_audio/le_audio_client_test.cc +20 −14 Original line number Diff line number Diff line Loading @@ -1028,9 +1028,13 @@ protected: metadata_context_types, types::BidirectionalPair<std::vector<uint8_t>> ccid_lists) { auto group_state = group->GetState(); log::info("StartStream: group {} state {}, context type {}", group->group_id_, bluetooth::common::ToString(group_state), bluetooth::common::ToString(context_type)); log::info( "StartStream: group {} state {}, context type {} sink metadata_ctx {}, " "source metadata_ctx {}", group->group_id_, bluetooth::common::ToString(group_state), bluetooth::common::ToString(context_type), bluetooth::common::ToString(metadata_context_types.sink), bluetooth::common::ToString(metadata_context_types.source)); /* Do nothing if already streaming - the implementation would * probably update the metadata. Loading Loading @@ -10432,7 +10436,7 @@ TEST_F(UnicastTest, MusicDuringCallContextTypes) { available_snk_context_types_ = (types::LeAudioContextType::CONVERSATIONAL | types::LeAudioContextType::RINGTONE | types::LeAudioContextType::GAME | types::LeAudioContextType::MEDIA | types::LeAudioContextType::LIVE) types::LeAudioContextType::LIVE | types::LeAudioContextType::NOTIFICATIONS) .value(); supported_snk_context_types_ = available_snk_context_types_ | Loading Loading @@ -10463,7 +10467,7 @@ TEST_F(UnicastTest, MusicDuringCallContextTypes) { LeAudioClient::Get()->GroupSetActive(group_id); SyncOnMainLoop(); // 1) Start with the call first log::info("TESTPOINT 1: Start with the call first"); // ----------------------------- // CONVERSATIONAL is from In Call preference, and RINGTONE is from metadata LeAudioClient::Get()->SetInCall(true); Loading @@ -10489,7 +10493,7 @@ TEST_F(UnicastTest, MusicDuringCallContextTypes) { uint8_t cis_count_in = 1; TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920, 40); // 2) Start MEDIA during the call, expect MEDIA only on the remote sink 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)}; Loading @@ -10504,25 +10508,27 @@ TEST_F(UnicastTest, MusicDuringCallContextTypes) { Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_); // 2) Disable In Call preference but do not suspend the local sink // We should stay in CONVERSATIONAL until the local sink suspends 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::MEDIA | 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_MEDIA, AUDIO_CONTENT_TYPE_MUSIC, 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_); // 3) Disable call so we could go back to MEDIA log::info("TESTPOING 4: Disable call so we could go back to MEDIA"); // --------------------------------------- // Suspend should stop the stream EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(1); Loading @@ -10549,7 +10555,7 @@ TEST_F(UnicastTest, MusicDuringCallContextTypes) { Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_); // 4) Stop streaming log::info("TESTPOINT 5: Stop streaming"); // ------------------ StopStreaming(group_id); Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); Loading @@ -10573,7 +10579,7 @@ TEST_F(UnicastTest, MusicDuringCallContextTypes_SpeedUpReconfigFlagEnabled) { available_snk_context_types_ = (types::LeAudioContextType::CONVERSATIONAL | types::LeAudioContextType::RINGTONE | types::LeAudioContextType::GAME | types::LeAudioContextType::MEDIA | types::LeAudioContextType::LIVE) types::LeAudioContextType::LIVE | types::LeAudioContextType::NOTIFICATIONS) .value(); supported_snk_context_types_ = available_snk_context_types_ | Loading Loading @@ -10659,7 +10665,7 @@ TEST_F(UnicastTest, MusicDuringCallContextTypes_SpeedUpReconfigFlagEnabled) { Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_); Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_); log::info("Step 2) Disable call so we could go back to MEDIA"); log::info("Step 3) Disable call so we could go back to MEDIA"); // --------------------------------------- // Suspend should stop the stream EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(1); Loading