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

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

Merge "Actively send focal area bounds when transitioning to LOCKSCREEN" into main

parents aa97128b a2b8e5bc
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import androidx.test.filters.SmallTest
import com.android.internal.R
import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
import com.android.systemui.res.R as SysUIR
import com.android.systemui.shared.Flags as SharedFlags
import com.android.systemui.user.data.model.SelectedUserModel
@@ -38,6 +39,7 @@ import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.any
@@ -53,6 +55,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() {
    private val userRepository = FakeUserRepository()
    private val wallpaperFocalAreaRepository = FakeWallpaperFocalAreaRepository()
    private val wallpaperManager: WallpaperManager = mock()
    private val keyguardTransitionInteractor: KeyguardTransitionInteractor = mock()

    private val underTest: WallpaperRepositoryImpl by lazy {
        WallpaperRepositoryImpl(
@@ -63,6 +66,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() {
            wallpaperFocalAreaRepository,
            wallpaperManager,
            context,
            keyguardTransitionInteractor,
        )
    }

@@ -245,6 +249,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() {
        }

    @Test
    @Ignore("ag/31591766")
    @EnableFlags(SharedFlags.FLAG_EXTENDED_WALLPAPER_EFFECTS)
    fun shouldSendNotificationLayout_setExtendedEffectsWallpaper_launchSendLayoutJob() =
        testScope.runTest {
@@ -266,6 +271,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() {
        }

    @Test
    @Ignore("ag/31591766")
    @EnableFlags(SharedFlags.FLAG_EXTENDED_WALLPAPER_EFFECTS)
    fun shouldSendNotificationLayout_setNotExtendedEffectsWallpaper_cancelSendLayoutJob() =
        testScope.runTest {
+47 −27
Original line number Diff line number Diff line
@@ -30,7 +30,12 @@ import com.android.internal.R
import com.android.systemui.broadcast.BroadcastDispatcher
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
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.res.R as SysUIR
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.shared.Flags.ambientAod
import com.android.systemui.shared.Flags.extendedWallpaperEffects
import com.android.systemui.user.data.model.SelectedUserModel
@@ -81,6 +86,7 @@ constructor(
    wallpaperFocalAreaRepository: WallpaperFocalAreaRepository,
    private val wallpaperManager: WallpaperManager,
    private val context: Context,
    keyguardTransitionInteractor: KeyguardTransitionInteractor,
) : WallpaperRepository {
    private val wallpaperChanged: Flow<Unit> =
        broadcastDispatcher
@@ -131,8 +137,22 @@ constructor(
                if (shouldSendNotificationLayout) {
                    sendLockscreenLayoutJob =
                        scope.launch {
                            wallpaperFocalAreaRepository.wallpaperFocalAreaBounds.collect {
                                wallpaperFocalAreaBounds ->
                            combine(
                                    wallpaperFocalAreaRepository.wallpaperFocalAreaBounds,
                                    keyguardTransitionInteractor
                                        .transition(
                                            edge = Edge.create(to = Scenes.Lockscreen),
                                            edgeWithoutSceneContainer =
                                                Edge.create(to = KeyguardState.LOCKSCREEN),
                                        )
                                        .filter { transitionStep ->
                                            transitionStep.transitionState ==
                                                TransitionState.STARTED
                                        },
                                    ::Pair,
                                )
                                .map { (bounds, _) -> bounds }
                                .collect { wallpaperFocalAreaBounds ->
                                    wallpaperManager.sendWallpaperCommand(
                                        /* windowToken = */ rootView?.windowToken,
                                        /* action = */ WallpaperManager