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

Commit be8251ab authored by Sherry Zhou's avatar Sherry Zhou Committed by Android (Google) Code Review
Browse files

Merge "Fix Magic Portrait stopped repositioning according to the lock screen...

Merge "Fix Magic Portrait stopped repositioning according to the lock screen space after reboot" into main
parents 58d531db e5164411
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.