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

Commit 6e6d48ab authored by Grzegorz Kołodziejczyk's avatar Grzegorz Kołodziejczyk
Browse files

bass: Collect and remove sources while stopping receivers

Remove source method can try to remove group managed source before
marking them as paused. Sources first have to be marked as paused if
needed then removed.

Tag: #feature
Test: atest LeAudioServiceTest LeAudioBroadcastServiceTest
Bug: 298080973
Bug: 308171251
Change-Id: Ied9a53f3d301a42d8c51a257bd05f45c1223ea3e
parent fd938220
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -1602,17 +1602,22 @@ public class BassClientService extends ProfileService {
            mPausedBroadcastSinks.clear();
        }

        Map<BluetoothDevice, Integer> sourcesToRemove = new HashMap<>();

        for (BluetoothDevice device : getConnectedDevices()) {
            for (BluetoothLeBroadcastReceiveState receiveState : getAllSources(device)) {
                /* Check if local/last broadcast is the synced one */
                if (receiveState.getBroadcastId() != broadcastId) continue;

                removeSource(device, receiveState.getSourceId());

                if (store && !mPausedBroadcastSinks.contains(device)) {
                    mPausedBroadcastSinks.add(device);
                }

                sourcesToRemove.put(device, receiveState.getSourceId());
            }
        }
        for (Map.Entry<BluetoothDevice, Integer> entry : sourcesToRemove.entrySet()) {
            removeSource(entry.getKey(), entry.getValue());
        }
    }