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

Commit 7212fb02 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

[flexiglass] Clicks on shade empty space go back to lockscreen.

Instead of attempting to enter the device and/or show the bouncer.

It doesn't quite fix b/330696389 yet because the clicks aren't being
passed to the clickable in the shade scene composable yet.

Bug: 330696389
Test: unit tests ammended
Test: manually verified that clicking on the empty space in the shade
below the notifications still doesn't do anything, so no damage done
Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT

Change-Id: Id4e6a2abf77d43818a172381751a0aebed9196cf
parent ee98de19
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -261,6 +261,7 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() {
                shadeInteractor = kosmos.shadeInteractor,
                footerActionsController = kosmos.footerActionsController,
                footerActionsViewModelFactory = kosmos.footerActionsViewModelFactory,
                sceneInteractor = sceneInteractor,
            )

        kosmos.fakeDeviceEntryRepository.setUnlocked(false)
+3 −17
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ class ShadeSceneViewModelTest : SysuiTestCase() {
                shadeInteractor = kosmos.shadeInteractor,
                footerActionsViewModelFactory = kosmos.footerActionsViewModelFactory,
                footerActionsController = kosmos.footerActionsController,
                sceneInteractor = kosmos.sceneInteractor,
            )
    }

@@ -215,22 +216,7 @@ class ShadeSceneViewModelTest : SysuiTestCase() {
        }

    @Test
    fun onContentClicked_deviceUnlocked_switchesToGone() =
        testScope.runTest {
            val currentScene by collectLastValue(sceneInteractor.currentScene)
            kosmos.fakeAuthenticationRepository.setAuthenticationMethod(
                AuthenticationMethodModel.Pin
            )
            kosmos.fakeDeviceEntryRepository.setUnlocked(true)
            runCurrent()

            underTest.onContentClicked()

            assertThat(currentScene).isEqualTo(Scenes.Gone)
        }

    @Test
    fun onContentClicked_deviceLockedSecurely_switchesToBouncer() =
    fun onContentClicked_deviceLockedSecurely_switchesToLockscreen() =
        testScope.runTest {
            val currentScene by collectLastValue(sceneInteractor.currentScene)
            kosmos.fakeAuthenticationRepository.setAuthenticationMethod(
@@ -241,7 +227,7 @@ class ShadeSceneViewModelTest : SysuiTestCase() {

            underTest.onContentClicked()

            assertThat(currentScene).isEqualTo(Scenes.Bouncer)
            assertThat(currentScene).isEqualTo(Scenes.Lockscreen)
        }

    @Test
+10 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import com.android.systemui.media.controls.domain.pipeline.MediaDataManager
import com.android.systemui.qs.FooterActionsController
import com.android.systemui.qs.footer.ui.viewmodel.FooterActionsViewModel
import com.android.systemui.qs.ui.adapter.QSSceneAdapter
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.shade.shared.model.ShadeMode
@@ -52,7 +53,7 @@ class ShadeSceneViewModel
@Inject
constructor(
    @Application private val applicationScope: CoroutineScope,
    private val deviceEntryInteractor: DeviceEntryInteractor,
    deviceEntryInteractor: DeviceEntryInteractor,
    val qsSceneAdapter: QSSceneAdapter,
    val shadeHeaderViewModel: ShadeHeaderViewModel,
    val notifications: NotificationsPlaceholderViewModel,
@@ -60,6 +61,7 @@ constructor(
    shadeInteractor: ShadeInteractor,
    private val footerActionsViewModelFactory: FooterActionsViewModel.Factory,
    private val footerActionsController: FooterActionsController,
    private val sceneInteractor: SceneInteractor,
) {
    val destinationScenes: StateFlow<Map<UserAction, UserActionResult>> =
        combine(
@@ -103,7 +105,13 @@ constructor(
    val shadeMode: StateFlow<ShadeMode> = shadeInteractor.shadeMode

    /** Notifies that some content in the shade was clicked. */
    fun onContentClicked() = deviceEntryInteractor.attemptDeviceEntry()
    fun onContentClicked() {
        if (!isClickable.value) {
            return
        }

        sceneInteractor.changeScene(Scenes.Lockscreen, "Shade empty content clicked")
    }

    fun isMediaVisible(): Boolean {
        // TODO(b/296122467): handle updates to carousel visibility while scene is still visible