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

Commit 9bcecce4 authored by chelseahao's avatar chelseahao
Browse files

Handle cases where one buds has a streaming source and the other one has a paused source.

In this case we show "listening now".

Flag: com.android.settingslib.flags.audio_stream_play_pause_by_modify_source
Test: atest
Bug: 384976631
Change-Id: Idd27198ebdf2af4d7f4b1281127204934699efd4
parent 79d07018
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -473,9 +473,8 @@ public class AudioStreamMediaService extends Service {
                        .setSmallIcon(com.android.settingslib.R.drawable.ic_bt_le_audio_sharing)
                        .setStyle(mediaStyle)
                        .setContentText(getString(
                                (isAnyDeviceReceiverPaused() || isAllDeviceHysteresis())
                                        ? BROADCAST_STREAM_PAUSED_TEXT
                                        : BROADCAST_LISTENING_NOW_TEXT))
                                isAnyDeviceStreaming() ? BROADCAST_LISTENING_NOW_TEXT
                                        : BROADCAST_STREAM_PAUSED_TEXT))
                        .setSilent(true);
        return notificationBuilder.build();
    }
+6 −4
Original line number Diff line number Diff line
@@ -616,16 +616,18 @@ public class AudioStreamsProgressCategoryController extends BasePreferenceContro
                    handleSourceFromQrCodeIfExists();
                    Map<BluetoothDevice, List<BluetoothLeBroadcastReceiveState>> sources =
                            mAudioStreamsHelper.getAllSourcesByDevice();
                    getStreamSourcesByDevice(sources).forEach(
                            (device, stateList) ->
                                    stateList.forEach(
                                            state -> handleSourceStreaming(device, state)));
                    if (mHysteresisModeFixAvailable) {
                        getPausedSourcesByDevice(sources).forEach(
                                (device, stateList) ->
                                        stateList.forEach(
                                                state -> handleSourcePaused(device, state)));
                    }
                    // If a source is streaming in one device and paused in another, we handle the
                    // source as it's streaming
                    getStreamSourcesByDevice(sources).forEach(
                            (device, stateList) ->
                                    stateList.forEach(
                                            state -> handleSourceStreaming(device, state)));
                    if (DEBUG) {
                        Log.d(TAG, "startScanning()");
                    }