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

Commit 33d69325 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

leaudio: Fix audio config notification to Java

With this patch, we make sure that proper supported contexts are sent
up to the Java layer.
It could happen that following updates would override proper context
leading to Out Device being disabled.

Bug: 236595523
Test: atest BluetoothInstrumentationTests
Tag: #feature
Change-Id: Ie8ccaa359f25635637677c6529173311094ce134
parent 2c0ce6f8
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -388,7 +388,7 @@ class LeAudioClientImpl : public LeAudioClient {
      callbacks_->OnAudioConf(group->audio_directions_, group->group_id_,
                              group->snk_audio_locations_.to_ulong(),
                              group->src_audio_locations_.to_ulong(),
                              new_group_updated_contexts->to_ulong());
                              group->GetActiveContexts().to_ulong());
    }
  }

@@ -1106,9 +1106,13 @@ class LeAudioClientImpl : public LeAudioClient {
       * Read of available context during initial attribute discovery.
       * Group would be assigned once service search is completed.
       */
      if (group)
        group->UpdateActiveContextsMap(leAudioDevice->GetAvailableContexts());

      if (group && group->UpdateActiveContextsMap(
                       leAudioDevice->GetAvailableContexts())) {
        callbacks_->OnAudioConf(group->audio_directions_, group->group_id_,
                                group->snk_audio_locations_.to_ulong(),
                                group->src_audio_locations_.to_ulong(),
                                group->GetActiveContexts().to_ulong());
      }
      return;
    }

@@ -1133,9 +1137,13 @@ class LeAudioClientImpl : public LeAudioClient {
       * Read of available context during initial attribute discovery.
       * Group would be assigned once service search is completed.
       */
      if (group)
        group->UpdateActiveContextsMap(leAudioDevice->GetAvailableContexts());

      if (group && group->UpdateActiveContextsMap(
                       leAudioDevice->GetAvailableContexts())) {
        callbacks_->OnAudioConf(group->audio_directions_, group->group_id_,
                                group->snk_audio_locations_.to_ulong(),
                                group->src_audio_locations_.to_ulong(),
                                group->GetActiveContexts().to_ulong());
      }
      return;
    }

@@ -3466,7 +3474,7 @@ class LeAudioClientImpl : public LeAudioClient {
        callbacks_->OnAudioConf(group->audio_directions_, group->group_id_,
                                group->snk_audio_locations_.to_ulong(),
                                group->src_audio_locations_.to_ulong(),
                                updated_contexts->to_ulong());
                                group->GetActiveContexts().to_ulong());
      }

      group->SetPendingUpdateAvailableContexts(std::nullopt);