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

Commit 56e35576 authored by Beth Thibodeau's avatar Beth Thibodeau
Browse files

Fix arrow layout in landscape and hide if scroll is disabled

- Add missing constraint in landscape layout that had resulted in overlap with
  text with a larger display/font size
- If scrolling is not allowed for the media host, always hide the pager arrows

Bug: 383974508
Flag: com.android.systemui.media_carousel_arrows
Test: atest MediaCarouselControllerTest
Test: manual - check phone landscape with max size

Change-Id: Ib0e860cbbb1f1207de43b1cd54b377fd3f4fdc83
parent 4e13a4e0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@
        android:layout_marginEnd="@dimen/qs_media_padding"
        app:layout_constraintEnd_toStartOf="@id/action_button_guideline"
        app:layout_constrainedWidth="true"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintStart_toEndOf="@id/page_left"
        app:layout_constraintBottom_toTopOf="@id/header_artist"
        app:layout_constraintHorizontal_bias="0" />

+2 −2
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ constructor(
    /** Is the player currently visible (at the end of the transformation */
    private var playersVisible: Boolean = false

    /** Are we currently disabling scolling, only allowing the first media session to show */
    /** Are we currently disabling scrolling, only allowing the first media session to show */
    private var currentlyDisableScrolling: Boolean = false

    /**
@@ -957,7 +957,7 @@ constructor(

        val nPlayers = MediaPlayerData.players().size
        MediaPlayerData.players().forEachIndexed { index, mediaPlayer ->
            if (nPlayers == 1) {
            if (nPlayers == 1 || currentlyDisableScrolling) {
                mediaPlayer.setPageArrowsVisible(false)
            } else {
                mediaPlayer.setPageArrowsVisible(true)
+42 −0
Original line number Diff line number Diff line
@@ -1025,6 +1025,48 @@ class MediaCarouselControllerTest : SysuiTestCase() {
        }
    }

    @EnableFlags(Flags.FLAG_MEDIA_CAROUSEL_ARROWS)
    @DisableSceneContainer
    @Test
    fun multipleMediaPlayers_disableScrolling_noPageArrows() {
        verify(mediaDataManager).addListener(capture(listener))

        // Set carousel host to disable scrolling
        whenever(mediaHostStatesManager.mediaHostStates)
            .thenReturn(mutableMapOf(LOCATION_QS to mediaHostState))
        whenever(mediaHostState.disableScrolling).thenReturn(true)
        mediaCarouselController.currentEndLocation = LOCATION_QS
        mediaCarouselController.setCurrentState(LOCATION_QS, LOCATION_QS, 1.0f, true)

        listener.value.onMediaDataLoaded(
            PLAYING_LOCAL,
            null,
            DATA.copy(
                active = true,
                isPlaying = true,
                playbackLocation = MediaData.PLAYBACK_LOCAL,
                resumption = false,
            ),
        )
        listener.value.onMediaDataLoaded(
            PAUSED_LOCAL,
            null,
            DATA.copy(
                active = true,
                isPlaying = false,
                playbackLocation = MediaData.PLAYBACK_LOCAL,
                resumption = false,
            ),
        )
        runAllReady()

        assertEquals(2, MediaPlayerData.players().size)
        MediaPlayerData.players().forEachIndexed { index, mediaPlayer ->
            verify(mediaPlayer, atLeast(1)).setPageArrowsVisible(eq(false))
            verify(mediaPlayer, never()).setPageArrowsVisible(eq(true))
        }
    }

    /**
     * Helper method when a configuration change occurs.
     *