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

Commit 504169f6 authored by Jakub Tyszkowski's avatar Jakub Tyszkowski
Browse files

broadcaster: Fix stopping audio session

This shouls be triggered on STOPPED state change and not on PAUSED.

Bug: 150670922
Tag: #feature
Test: atest BluetoothInstrumentationTests
Sponsor: jpawlowski@
Change-Id: I37609e05103eeb017fbba99291a38bbbc30525f7
parent 284303f9
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -1170,17 +1170,10 @@ public class LeAudioService extends ProfileService {

            if (state == LeAudioStackEvent.BROADCAST_STATE_STOPPED) {
                if (DBG) Log.d(TAG, "Broadcast Instance id: " + instanceId + " stopped.");
                destroyBroadcast(instanceId);

            } else if (state == LeAudioStackEvent.BROADCAST_STATE_CONFIGURING) {
                if (DBG) Log.d(TAG, "Broadcast Instance id: " + instanceId + " configuring.");

            } else if (state == LeAudioStackEvent.BROADCAST_STATE_PAUSED) {
                if (DBG) Log.d(TAG, "Broadcast Instance id: " + instanceId + " paused.");

                // Playback paused
                // Playback stopped
                mBroadcastsPlaybackMap.put(instanceId, false);
                notifyPlaybackStopped(instanceId, BluetoothStatusCodes.REASON_LOCAL_STACK_REQUEST);
                notifyPlaybackStopped(instanceId, BluetoothStatusCodes.REASON_LOCAL_APP_REQUEST);

                // Notify audio manager
                if (Collections.frequency(mBroadcastsPlaybackMap.values(), true) == 0) {
@@ -1194,6 +1187,18 @@ public class LeAudioService extends ProfileService {
                    }
                }

                destroyBroadcast(instanceId);

            } else if (state == LeAudioStackEvent.BROADCAST_STATE_CONFIGURING) {
                if (DBG) Log.d(TAG, "Broadcast Instance id: " + instanceId + " configuring.");

            } else if (state == LeAudioStackEvent.BROADCAST_STATE_PAUSED) {
                if (DBG) Log.d(TAG, "Broadcast Instance id: " + instanceId + " paused.");

                // Playback paused
                mBroadcastsPlaybackMap.put(instanceId, false);
                notifyPlaybackStopped(instanceId, BluetoothStatusCodes.REASON_LOCAL_STACK_REQUEST);

            } else if (state == LeAudioStackEvent.BROADCAST_STATE_STOPPING) {
                if (DBG) Log.d(TAG, "Broadcast Instance id: " + instanceId + " stopping.");