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

Commit 9f55ec96 authored by Michał Brzeziński's avatar Michał Brzeziński Committed by Automerger Merge Worker
Browse files

Merge "Fixing Y translation of media when no media is visible in...

Merge "Fixing Y translation of media when no media is visible in previousLocation" into tm-qpr-dev am: 21c45b5c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22238584



Change-Id: I484db047507706ec50df1822a8693185b0abe6ef
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents d3f39b4e 21c45b5c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -317,13 +317,16 @@ constructor(

    /**
     * Returns the amount of translationY of the media container, during the current guided
     * transformation, if running. If there is no guided transformation running, it will return 0.
     * transformation, if running. If there is no guided transformation running, it will return -1.
     */
    fun getGuidedTransformationTranslationY(): Int {
        if (!isCurrentlyInGuidedTransformation()) {
            return -1
        }
        val startHost = getHost(previousLocation) ?: return 0
        val startHost = getHost(previousLocation)
        if (startHost == null || !startHost.visible) {
            return 0
        }
        return targetBounds.top - startHost.currentBounds.top
    }

+9 −0
Original line number Diff line number Diff line
@@ -388,6 +388,15 @@ class MediaHierarchyManagerTest : SysuiTestCase() {
            .isEqualTo(expectedTranslation)
    }

    @Test
    fun getGuidedTransformationTranslationY_previousHostInvisible_returnsZero() {
        goToLockscreen()
        enterGuidedTransformation()
        whenever(lockHost.visible).thenReturn(false)

        assertThat(mediaHierarchyManager.getGuidedTransformationTranslationY()).isEqualTo(0)
    }

    @Test
    fun isCurrentlyInGuidedTransformation_hostsVisible_returnsTrue() {
        goToLockscreen()