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

Commit a2d01053 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin Committed by Ale Nijamkin
Browse files

[flexiglass] Removes LS -> Communal swipe navigation

Fix: 394159837
Test: unit tests updated
Test: manually verified inability to swipe left to go from lockscreen to
communal
Flag: com.android.systemui.scene_container

Change-Id: Ice3243a8c0bb4fd1d896eebf3c7bdb6bb1c780a6
parent a10033c1
Loading
Loading
Loading
Loading
+6 −55
Original line number Original line Diff line number Diff line
@@ -29,7 +29,6 @@ import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.SysuiTestCase
import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository
import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.communal.domain.interactor.setCommunalAvailable
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.deviceentry.data.repository.fakeDeviceEntryRepository
import com.android.systemui.deviceentry.data.repository.fakeDeviceEntryRepository
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.flags.EnableSceneContainer
@@ -65,13 +64,12 @@ import platform.test.runner.parameterized.Parameters
class LockscreenUserActionsViewModelTest : SysuiTestCase() {
class LockscreenUserActionsViewModelTest : SysuiTestCase() {


    companion object {
    companion object {
        private const val parameterCount = 7
        private const val parameterCount = 6


        @Parameters(
        @Parameters(
            name =
            name =
                "canSwipeToEnter={0}, downWithTwoPointers={1}, downFromEdge={2}," +
                "canSwipeToEnter={0}, downWithTwoPointers={1}, downFromEdge={2}," +
                    " isSingleShade={3}, isCommunalAvailable={4}, isShadeTouchable={5}," +
                    " isSingleShade={3}, isShadeTouchable={4}, isOccluded={6}"
                    " isOccluded={6}"
        )
        )
        @JvmStatic
        @JvmStatic
        fun combinations() = buildList {
        fun combinations() = buildList {
@@ -82,9 +80,8 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() {
                            /* downWithTwoPointers= */ combination and 2 != 0,
                            /* downWithTwoPointers= */ combination and 2 != 0,
                            /* downFromEdge= */ combination and 4 != 0,
                            /* downFromEdge= */ combination and 4 != 0,
                            /* isSingleShade= */ combination and 8 != 0,
                            /* isSingleShade= */ combination and 8 != 0,
                            /* isCommunalAvailable= */ combination and 16 != 0,
                            /* isShadeTouchable= */ combination and 16 != 0,
                            /* isShadeTouchable= */ combination and 32 != 0,
                            /* isOccluded= */ combination and 32 != 0,
                            /* isOccluded= */ combination and 64 != 0,
                        )
                        )
                        .also { check(it.size == parameterCount) }
                        .also { check(it.size == parameterCount) }
                )
                )
@@ -145,17 +142,6 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() {
                else -> Scenes.Bouncer
                else -> Scenes.Bouncer
            }
            }
        }
        }

        private fun expectedStartDestination(
            isCommunalAvailable: Boolean,
            isShadeTouchable: Boolean,
        ): SceneKey? {
            return when {
                !isShadeTouchable -> null
                isCommunalAvailable -> Scenes.Communal
                else -> null
            }
        }
    }
    }


    private val kosmos = testKosmos()
    private val kosmos = testKosmos()
@@ -166,9 +152,8 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() {
    @JvmField @Parameter(1) var downWithTwoPointers: Boolean = false
    @JvmField @Parameter(1) var downWithTwoPointers: Boolean = false
    @JvmField @Parameter(2) var downFromEdge: Boolean = false
    @JvmField @Parameter(2) var downFromEdge: Boolean = false
    @JvmField @Parameter(3) var isNarrowScreen: Boolean = true
    @JvmField @Parameter(3) var isNarrowScreen: Boolean = true
    @JvmField @Parameter(4) var isCommunalAvailable: Boolean = false
    @JvmField @Parameter(4) var isShadeTouchable: Boolean = false
    @JvmField @Parameter(5) var isShadeTouchable: Boolean = false
    @JvmField @Parameter(5) var isOccluded: Boolean = false
    @JvmField @Parameter(6) var isOccluded: Boolean = false


    private val underTest by lazy { kosmos.lockscreenUserActionsViewModel }
    private val underTest by lazy { kosmos.lockscreenUserActionsViewModel }


@@ -188,7 +173,6 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() {
            )
            )
            sceneInteractor.changeScene(Scenes.Lockscreen, "reason")
            sceneInteractor.changeScene(Scenes.Lockscreen, "reason")
            kosmos.shadeRepository.setShadeLayoutWide(!isNarrowScreen)
            kosmos.shadeRepository.setShadeLayoutWide(!isNarrowScreen)
            kosmos.setCommunalAvailable(isCommunalAvailable)
            kosmos.fakePowerRepository.updateWakefulness(
            kosmos.fakePowerRepository.updateWakefulness(
                rawState =
                rawState =
                    if (isShadeTouchable) {
                    if (isShadeTouchable) {
@@ -246,22 +230,6 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() {
                        isShadeTouchable = isShadeTouchable,
                        isShadeTouchable = isShadeTouchable,
                    )
                    )
                )
                )

            val startScene by
                collectLastValue(
                    (userActions?.get(Swipe.Start) as? UserActionResult.ChangeScene)
                        ?.toScene
                        ?.let { scene -> kosmos.sceneInteractor.resolveSceneFamily(scene) }
                        ?: flowOf(null)
                )

            assertThat(startScene)
                .isEqualTo(
                    expectedStartDestination(
                        isCommunalAvailable = isCommunalAvailable,
                        isShadeTouchable = isShadeTouchable,
                    )
                )
        }
        }


    @Test
    @Test
@@ -279,7 +247,6 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() {
            )
            )
            sceneInteractor.changeScene(Scenes.Lockscreen, "reason")
            sceneInteractor.changeScene(Scenes.Lockscreen, "reason")
            kosmos.enableDualShade(wideLayout = !isNarrowScreen)
            kosmos.enableDualShade(wideLayout = !isNarrowScreen)
            kosmos.setCommunalAvailable(isCommunalAvailable)
            kosmos.fakePowerRepository.updateWakefulness(
            kosmos.fakePowerRepository.updateWakefulness(
                rawState =
                rawState =
                    if (isShadeTouchable) {
                    if (isShadeTouchable) {
@@ -340,21 +307,5 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() {
                        isShadeTouchable = isShadeTouchable,
                        isShadeTouchable = isShadeTouchable,
                    )
                    )
                )
                )

            val startScene by
                collectLastValue(
                    (userActions?.get(Swipe.Start) as? UserActionResult.ChangeScene)
                        ?.toScene
                        ?.let { scene -> kosmos.sceneInteractor.resolveSceneFamily(scene) }
                        ?: flowOf(null)
                )

            assertThat(startScene)
                .isEqualTo(
                    expectedStartDestination(
                        isCommunalAvailable = isCommunalAvailable,
                        isShadeTouchable = isShadeTouchable,
                    )
                )
        }
        }
}
}
+1 −8
Original line number Original line Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.systemui.keyguard.ui.viewmodel
import com.android.compose.animation.scene.Swipe
import com.android.compose.animation.scene.Swipe
import com.android.compose.animation.scene.UserAction
import com.android.compose.animation.scene.UserAction
import com.android.compose.animation.scene.UserActionResult
import com.android.compose.animation.scene.UserActionResult
import com.android.systemui.communal.domain.interactor.CommunalInteractor
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor
import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor
import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.scene.shared.model.Scenes
@@ -43,7 +42,6 @@ class LockscreenUserActionsViewModel
@AssistedInject
@AssistedInject
constructor(
constructor(
    private val deviceEntryInteractor: DeviceEntryInteractor,
    private val deviceEntryInteractor: DeviceEntryInteractor,
    private val communalInteractor: CommunalInteractor,
    private val shadeInteractor: ShadeInteractor,
    private val shadeInteractor: ShadeInteractor,
    private val shadeModeInteractor: ShadeModeInteractor,
    private val shadeModeInteractor: ShadeModeInteractor,
    private val occlusionInteractor: SceneContainerOcclusionInteractor,
    private val occlusionInteractor: SceneContainerOcclusionInteractor,
@@ -58,15 +56,10 @@ constructor(


                combine(
                combine(
                    deviceEntryInteractor.isUnlocked,
                    deviceEntryInteractor.isUnlocked,
                    communalInteractor.isCommunalAvailable,
                    shadeModeInteractor.shadeMode,
                    shadeModeInteractor.shadeMode,
                    occlusionInteractor.isOccludingActivityShown,
                    occlusionInteractor.isOccludingActivityShown,
                ) { isDeviceUnlocked, isCommunalAvailable, shadeMode, isOccluded ->
                ) { isDeviceUnlocked, shadeMode, isOccluded ->
                    buildList {
                    buildList {
                            if (isCommunalAvailable) {
                                add(Swipe.Start to Scenes.Communal)
                            }

                            add(Swipe.Up to if (isDeviceUnlocked) Scenes.Gone else Scenes.Bouncer)
                            add(Swipe.Up to if (isDeviceUnlocked) Scenes.Gone else Scenes.Bouncer)


                            addAll(
                            addAll(
+0 −2
Original line number Original line Diff line number Diff line
@@ -16,7 +16,6 @@


package com.android.systemui.keyguard.ui.viewmodel
package com.android.systemui.keyguard.ui.viewmodel


import com.android.systemui.communal.domain.interactor.communalInteractor
import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor
import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos.Fixture
import com.android.systemui.kosmos.Kosmos.Fixture
@@ -27,7 +26,6 @@ import com.android.systemui.shade.domain.interactor.shadeModeInteractor
val Kosmos.lockscreenUserActionsViewModel by Fixture {
val Kosmos.lockscreenUserActionsViewModel by Fixture {
    LockscreenUserActionsViewModel(
    LockscreenUserActionsViewModel(
        deviceEntryInteractor = deviceEntryInteractor,
        deviceEntryInteractor = deviceEntryInteractor,
        communalInteractor = communalInteractor,
        shadeInteractor = shadeInteractor,
        shadeInteractor = shadeInteractor,
        shadeModeInteractor = shadeModeInteractor,
        shadeModeInteractor = shadeModeInteractor,
        occlusionInteractor = sceneContainerOcclusionInteractor,
        occlusionInteractor = sceneContainerOcclusionInteractor,