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

Commit 8d753ef4 authored by Anton Potapov's avatar Anton Potapov
Browse files

Debounce volume updates in the dialog

This change makes the coroutine to suspend until the volume changes, so
only the last volume change remains. This brings Volume Dialog behaviour
onpar with the Volume Panel.

Flag: com.android.systemui.volume_redesign
Fixes: 419818348
Test: manual on foldable. Rapidly adjust volume and observe that there
are no movements after the grace period

Change-Id: Ibc668eb2233536e5b712320dcf34e8aac98a1904
parent 7cfe707c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -318,7 +318,7 @@ public class VolumeDialogControllerImplTest extends SysuiTestCase {
    @Test
    public void testSetStreamVolume_setSecondaryDeviceVolume() {
        mVolumeController.setStreamVolume(
                VolumeDialogControllerImpl.DYNAMIC_STREAM_BROADCAST, /* level= */ 100);
                VolumeDialogControllerImpl.DYNAMIC_STREAM_BROADCAST, /* level= */ 100, false);
        Objects.requireNonNull(TestableLooper.get(this)).processAllMessages();
        mTestScope.getTestScheduler().advanceUntilIdle();

+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ class VolumeDialogStateInteractorTest : SysuiTestCase() {
    fun dialogState_collectedEagerly() =
        kosmos.runTest {
            val nonDefaultActiveStream = 123
            fakeVolumeDialogController.setActiveStream(123)
            fakeVolumeDialogController.setActiveStream(123, true)

            val volumeDialogStateModel by collectLastValue(underTest.volumeDialogState)

+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ class VolumeDialogRingerInteractorTest : SysuiTestCase() {
    @Before
    fun setUp() {
        underTest = kosmos.volumeDialogRingerInteractor
        controller.setStreamVolume(STREAM_RING, 50)
        controller.setStreamVolume(STREAM_RING, 50, true)
    }

    @Test
+1 −1
Original line number Diff line number Diff line
@@ -162,7 +162,7 @@ class VolumeDialogRingerDrawerViewModelTest : SysuiTestCase() {
    }

    private fun TestScope.setUpRingerMode(selectedRingerMode: RingerMode) {
        controller.setStreamVolume(STREAM_RING, 50)
        controller.setStreamVolume(STREAM_RING, 50, true)
        controller.setRingerMode(selectedRingerMode.value, false)
        runCurrent()
    }
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ class VolumeDialogSliderInteractorTest : SysuiTestCase() {
    fun settingStreamVolume_setsActiveStream() =
        kosmos.runTest {
            // initialize the stream model
            fakeVolumeDialogController.setStreamVolume(volumeDialogSliderType.audioStream, 0)
            fakeVolumeDialogController.setStreamVolume(volumeDialogSliderType.audioStream, 0, true)

            val sliderModel by collectLastValue(underTest.slider)
            underTest.setStreamVolume(1)
Loading