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

Commit b6ac59ac authored by Michael Mikhail's avatar Michael Mikhail Committed by Automerger Merge Worker
Browse files

Merge "Check for block location change when configuration changes" into...

Merge "Check for block location change when configuration changes" into tm-qpr-dev am: 4f4d7d3a am: 60eb33e4 am: 1a3da878 am: a18feba7

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



Change-Id: I1a7a408b5b9dd0322badc62a6a60f0f06eb31659
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 1f682f06 a18feba7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -639,7 +639,9 @@ constructor(
    ) =
        traceSection("MediaHierarchyManager#updateDesiredLocation") {
            val desiredLocation = calculateLocation()
            if (desiredLocation != this.desiredLocation || forceStateUpdate) {
            if (
                desiredLocation != this.desiredLocation || forceStateUpdate && !blockLocationChanges
            ) {
                if (this.desiredLocation >= 0 && desiredLocation != this.desiredLocation) {
                    // Only update previous location when it actually changes
                    previousLocation = this.desiredLocation
+51 −0
Original line number Diff line number Diff line
@@ -179,6 +179,57 @@ class MediaHierarchyManagerTest : SysuiTestCase() {
            )
    }

    @Test
    fun testBlockedWhenConfigurationChangesAndScreenOff() {
        // Let's set it onto QS:
        mediaHierarchyManager.qsExpansion = 1.0f
        verify(mediaCarouselController)
            .onDesiredLocationChanged(
                ArgumentMatchers.anyInt(),
                any(MediaHostState::class.java),
                anyBoolean(),
                anyLong(),
                anyLong()
            )
        val observer = wakefullnessObserver.value
        assertNotNull("lifecycle observer wasn't registered", observer)
        observer.onStartedGoingToSleep()
        clearInvocations(mediaCarouselController)
        configurationController.notifyConfigurationChanged()
        verify(mediaCarouselController, times(0))
            .onDesiredLocationChanged(
                ArgumentMatchers.anyInt(),
                any(MediaHostState::class.java),
                anyBoolean(),
                anyLong(),
                anyLong()
            )
    }

    @Test
    fun testAllowedWhenConfigurationChanges() {
        // Let's set it onto QS:
        mediaHierarchyManager.qsExpansion = 1.0f
        verify(mediaCarouselController)
            .onDesiredLocationChanged(
                ArgumentMatchers.anyInt(),
                any(MediaHostState::class.java),
                anyBoolean(),
                anyLong(),
                anyLong()
            )
        clearInvocations(mediaCarouselController)
        configurationController.notifyConfigurationChanged()
        verify(mediaCarouselController)
            .onDesiredLocationChanged(
                ArgumentMatchers.anyInt(),
                any(MediaHostState::class.java),
                anyBoolean(),
                anyLong(),
                anyLong()
            )
    }

    @Test
    fun testAllowedWhenNotTurningOff() {
        // Let's set it onto QS: