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

Commit e2f64614 authored by Anton Potapov's avatar Anton Potapov Committed by Android (Google) Code Review
Browse files

Merge "Deprecase STREAM_BLUETOOTH_SCO in SystemUI volume" into main

parents fddff9e6 da106176
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -125,7 +125,6 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
    static final ArrayMap<Integer, Integer> STREAMS = new ArrayMap<>();
    static {
        STREAMS.put(AudioSystem.STREAM_ALARM, R.string.stream_alarm);
        STREAMS.put(AudioSystem.STREAM_BLUETOOTH_SCO, R.string.stream_bluetooth_sco);
        STREAMS.put(AudioSystem.STREAM_DTMF, R.string.stream_dtmf);
        STREAMS.put(AudioSystem.STREAM_MUSIC, R.string.stream_music);
        STREAMS.put(AudioSystem.STREAM_ACCESSIBILITY, R.string.stream_accessibility);
@@ -654,7 +653,6 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
    private static boolean isLogWorthy(int stream) {
        switch (stream) {
            case AudioSystem.STREAM_ALARM:
            case AudioSystem.STREAM_BLUETOOTH_SCO:
            case AudioSystem.STREAM_MUSIC:
            case AudioSystem.STREAM_RING:
            case AudioSystem.STREAM_SYSTEM:
+0 −2
Original line number Diff line number Diff line
@@ -704,8 +704,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
                addRow(AudioManager.STREAM_VOICE_CALL,
                        com.android.internal.R.drawable.ic_phone,
                        com.android.internal.R.drawable.ic_phone, false, false);
                addRow(AudioManager.STREAM_BLUETOOTH_SCO,
                        R.drawable.ic_volume_bt_sco, R.drawable.ic_volume_bt_sco, false, false);
                addRow(AudioManager.STREAM_SYSTEM, R.drawable.ic_volume_system,
                        R.drawable.ic_volume_system_mute, false, false);
            }
+3 −15
Original line number Diff line number Diff line
@@ -16,9 +16,7 @@

package com.android.systemui.volume.panel.component.volume.domain.interactor

import android.media.AudioDeviceInfo
import android.media.AudioManager
import com.android.settingslib.volume.data.repository.AudioRepository
import com.android.settingslib.volume.domain.interactor.AudioModeInteractor
import com.android.settingslib.volume.shared.model.AudioStream
import com.android.systemui.volume.panel.component.mediaoutput.domain.interactor.MediaOutputInteractor
@@ -42,7 +40,6 @@ class AudioSlidersInteractor
constructor(
    @VolumePanelScope scope: CoroutineScope,
    mediaOutputInteractor: MediaOutputInteractor,
    audioRepository: AudioRepository,
    audioModeInteractor: AudioModeInteractor,
) {

@@ -50,13 +47,12 @@ constructor(
        combineTransform(
                mediaOutputInteractor.activeMediaDeviceSessions,
                mediaOutputInteractor.defaultActiveMediaSession.filterData(),
                audioRepository.communicationDevice,
                audioModeInteractor.isOngoingCall,
            ) { activeSessions, defaultSession, communicationDevice, isOngoingCall ->
            ) { activeSessions, defaultSession, isOngoingCall ->
                coroutineScope {
                    val viewModels = buildList {
                        if (isOngoingCall) {
                            addCall(communicationDevice?.type)
                            addStream(AudioManager.STREAM_VOICE_CALL)
                        }

                        if (defaultSession?.isTheSameSession(activeSessions.remote) == true) {
@@ -68,7 +64,7 @@ constructor(
                        }

                        if (!isOngoingCall) {
                            addCall(communicationDevice?.type)
                            addStream(AudioManager.STREAM_VOICE_CALL)
                        }

                        addStream(AudioManager.STREAM_RING)
@@ -80,14 +76,6 @@ constructor(
            }
            .stateIn(scope, SharingStarted.Eagerly, emptyList())

    private fun MutableList<SliderType>.addCall(communicationDeviceType: Int?) {
        if (communicationDeviceType == AudioDeviceInfo.TYPE_BLUETOOTH_SCO) {
            addStream(AudioManager.STREAM_BLUETOOTH_SCO)
        } else {
            addStream(AudioManager.STREAM_VOICE_CALL)
        }
    }

    private fun MutableList<SliderType>.addSession(remoteMediaDeviceSession: MediaDeviceSession?) {
        if (remoteMediaDeviceSession?.canAdjustVolume == true) {
            add(SliderType.MediaDeviceCast(remoteMediaDeviceSession))
+0 −4
Original line number Diff line number Diff line
@@ -66,7 +66,6 @@ constructor(
        mapOf(
            AudioStream(AudioManager.STREAM_MUSIC) to R.drawable.ic_music_note,
            AudioStream(AudioManager.STREAM_VOICE_CALL) to R.drawable.ic_call,
            AudioStream(AudioManager.STREAM_BLUETOOTH_SCO) to R.drawable.ic_call,
            AudioStream(AudioManager.STREAM_RING) to R.drawable.ic_ring_volume,
            AudioStream(AudioManager.STREAM_NOTIFICATION) to R.drawable.ic_volume_ringer,
            AudioStream(AudioManager.STREAM_ALARM) to R.drawable.ic_volume_alarm,
@@ -75,7 +74,6 @@ constructor(
        mapOf(
            AudioStream(AudioManager.STREAM_MUSIC) to R.string.stream_music,
            AudioStream(AudioManager.STREAM_VOICE_CALL) to R.string.stream_voice_call,
            AudioStream(AudioManager.STREAM_BLUETOOTH_SCO) to R.string.stream_voice_call,
            AudioStream(AudioManager.STREAM_RING) to R.string.stream_ring,
            AudioStream(AudioManager.STREAM_NOTIFICATION) to R.string.stream_notification,
            AudioStream(AudioManager.STREAM_ALARM) to R.string.stream_alarm,
@@ -91,8 +89,6 @@ constructor(
                VolumePanelUiEvent.VOLUME_PANEL_MUSIC_SLIDER_TOUCHED,
            AudioStream(AudioManager.STREAM_VOICE_CALL) to
                VolumePanelUiEvent.VOLUME_PANEL_VOICE_CALL_SLIDER_TOUCHED,
            AudioStream(AudioManager.STREAM_BLUETOOTH_SCO) to
                VolumePanelUiEvent.VOLUME_PANEL_VOICE_CALL_SLIDER_TOUCHED,
            AudioStream(AudioManager.STREAM_RING) to
                VolumePanelUiEvent.VOLUME_PANEL_RING_SLIDER_TOUCHED,
            AudioStream(AudioManager.STREAM_NOTIFICATION) to
+3 −3
Original line number Diff line number Diff line
@@ -257,13 +257,13 @@ public class VolumeDialogImplTest extends SysuiTestCase {

    private State createShellState() {
        State state = new VolumeDialogController.State();
        for (int i = AudioManager.STREAM_VOICE_CALL; i <= AudioManager.STREAM_ACCESSIBILITY; i++) {
        for (int stream : STREAMS.keySet()) {
            VolumeDialogController.StreamState ss = new VolumeDialogController.StreamState();
            ss.name = STREAMS.get(i);
            ss.name = STREAMS.get(stream);
            ss.level = 1;
            ss.levelMin = 0;
            ss.levelMax = 25;
            state.states.append(i, ss);
            state.states.append(stream, ss);
        }
        return state;
    }
Loading