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

Commit e5164411 authored by Sherry Zhou's avatar Sherry Zhou
Browse files

Fix Magic Portrait stopped repositioning according to the lock screen space after reboot

Bug: 405090183
Test: atest WallpaperFocalAreaViewModelTest
Flag: com.android.systemui.shared.extended_wallpaper_effects

Change-Id: I2dca0361dc7d2d6b2c592512a5de99aa41549cab
parent e01e46dc
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -216,6 +216,15 @@ class WallpaperFocalAreaViewModelTest : SysuiTestCase() {
            assertThat(bounds).isNotNull()
        }

    @Test
    fun onReboot_sendFocalBounds() =
        testScope.runTest {
            val bounds by collectLastValue(underTest.wallpaperFocalAreaBounds)
            kosmos.wallpaperFocalAreaRepository.setHasFocalArea(true)
            setTestFocalAreaBounds()
            assertThat(bounds).isNotNull()
        }

    private fun setTestFocalAreaBounds(
        shadeLayoutWide: Boolean = false,
        activeNotifs: Int = 0,
+2 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onStart
@@ -177,6 +178,7 @@ constructor(

    override val shouldSendFocalArea =
        lockscreenWallpaperInfo
            .filterNotNull()
            .map {
                val focalAreaTarget = context.resources.getString(SysUIR.string.focal_area_target)
                val shouldSendNotificationLayout = it?.component?.className == focalAreaTarget
+6 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInterac
import com.android.systemui.keyguard.shared.model.Edge
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.shared.model.TransitionState
import com.android.systemui.keyguard.shared.model.TransitionStep
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.wallpapers.domain.interactor.WallpaperFocalAreaInteractor
import javax.inject.Inject
@@ -29,6 +30,7 @@ import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.emptyFlow
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.onStart

class WallpaperFocalAreaViewModel
@Inject
@@ -55,6 +57,10 @@ constructor(
                            .filter { it.transitionState == TransitionState.FINISHED },
                        ::Pair,
                    )
                    // Enforce collecting wallpaperFocalAreaBounds after rebooting
                    .onStart {
                        emit(Pair(TransitionStep(to = KeyguardState.LOCKSCREEN), TransitionStep()))
                    }
                    .flatMapLatest { (startedStep, _) ->
                        // Subscribe to bounds within the period of transitioning to the lockscreen,
                        // prior to any transitions away.