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

Commit 39ad1b7f authored by Jakub Tyszkowski's avatar Jakub Tyszkowski
Browse files

LeAudio: Fix checking for valid configs

When a certain configuration availability changes,
configuration ponter is set to null.

Bug: 281686787
Test: atest bluetooth_le_audio_test
Change-Id: I4bebe861f199d6cda36b4e67021e6993555ca9c7
parent 6efb65ca
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -1801,10 +1801,11 @@ LeAudioDeviceGroup::GetCodecConfigurationByDirection(

bool LeAudioDeviceGroup::IsAudioSetConfigurationAvailable(
    types::LeAudioContextType group_context_type) const {
  auto iter = available_context_to_configuration_map.find(group_context_type);
  if (iter == available_context_to_configuration_map.end()) return false;

  return available_context_to_configuration_map.count(group_context_type) != 0;
  if (available_context_to_configuration_map.count(group_context_type) != 0) {
    return available_context_to_configuration_map.at(group_context_type) !=
           nullptr;
  }
  return false;
}

bool LeAudioDeviceGroup::IsMetadataChanged(
+4 −0
Original line number Diff line number Diff line
@@ -1041,6 +1041,8 @@ TEST_F(LeAudioAseConfigurationTest, test_context_update) {
  ASSERT_TRUE(config.has_value());
  ASSERT_EQ(config->num_channels,
            ::le_audio::LeAudioCodecConfiguration::kChannelNumberMono);
  ASSERT_TRUE(
      group_->IsAudioSetConfigurationAvailable(LeAudioContextType::ALERTS));

  /* Block the ALERTS context */
  right->SetAvailableContexts(
@@ -1055,6 +1057,8 @@ TEST_F(LeAudioAseConfigurationTest, test_context_update) {
                       LeAudioContextType::ALERTS,
                       ::le_audio::types::kLeAudioDirectionSink)
                   .has_value());
  ASSERT_FALSE(
      group_->IsAudioSetConfigurationAvailable(LeAudioContextType::ALERTS));
}

TEST_F(LeAudioAseConfigurationTest, test_mono_speaker_ringtone) {