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

Commit 0e40838d authored by Jeremy Wu's avatar Jeremy Wu
Browse files

floss: |set_group_volume| on vc/group connection

When devices join a group, they can be using a volume different from the
group volume. This CL calls |set_group_volume| in such cases.

Bug: 317682584
Test: m Bluetooth
Change-Id: Ib3fab843e909f8eb32b7a8446ad84000d0916cba
parent ea2fae34
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -811,6 +811,16 @@ impl BluetoothMedia {
                match state {
                    BtVcConnectionState::Connected => {
                        self.vc_states.insert(addr, state);

                        let group_id = *self
                            .le_audio_node_to_group
                            .get(&addr)
                            .unwrap_or(&LEA_UNKNOWN_GROUP_ID);

                        // Sync group volume in case this new member has not been adjusted.
                        if let Some(volume) = self.le_audio_group_volume.get(&group_id) {
                            self.set_group_volume(group_id, *volume);
                        }
                    }
                    BtVcConnectionState::Disconnected => {
                        self.vc_states.remove(&addr);
@@ -1025,6 +1035,10 @@ impl BluetoothMedia {
                        }

                        self.le_audio_groups.entry(group_id).or_insert(HashSet::new()).insert(addr);

                        if let Some(volume) = self.le_audio_group_volume.get(&group_id) {
                            self.set_group_volume(group_id, *volume);
                        }
                    }
                    BtLeAudioGroupNodeStatus::Removed => {
                        if let Some(old_group_id) = self.le_audio_node_to_group.remove(&addr) {