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

Commit 2c2767ec authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add logging for communal scene changes" into main

parents d208ee5f 595846cc
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1410,7 +1410,10 @@ fun AccessibilityContainer(viewModel: BaseCommunalViewModel, content: @Composabl
                                    R.string.accessibility_action_label_close_communal_hub
                                )
                            ) {
                                viewModel.changeScene(CommunalScenes.Blank)
                                viewModel.changeScene(
                                    CommunalScenes.Blank,
                                    "closed by accessibility"
                                )
                                true
                            },
                            CustomAccessibilityAction(
+18 −18
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)

                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                communalSceneInteractor.setEditModeState(EditModeState.STARTING)
@@ -133,7 +133,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)

                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                communalSceneInteractor.setIsLaunchingWidget(true)
@@ -154,7 +154,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)

                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                communalSceneInteractor.setIsLaunchingWidget(false)
@@ -174,7 +174,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
        with(kosmos) {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)
                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                communalInteractor.setEditModeOpen(true)
@@ -213,7 +213,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
            testScope.runTest {
                whenever(centralSurfaces.isLaunchingActivityOverLockscreen).thenReturn(false)
                val scene by collectLastValue(communalSceneInteractor.currentScene)
                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                updateDocked(true)
@@ -233,7 +233,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
            testScope.runTest {
                whenever(centralSurfaces.isLaunchingActivityOverLockscreen).thenReturn(true)
                val scene by collectLastValue(communalSceneInteractor.currentScene)
                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                updateDocked(true)
@@ -270,7 +270,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
        with(kosmos) {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)
                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                fakeKeyguardTransitionRepository.sendTransitionSteps(
@@ -292,7 +292,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
        with(kosmos) {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)
                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                fakeKeyguardTransitionRepository.sendTransitionSteps(
@@ -320,7 +320,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
    fun dockingOnLockscreen_forcesCommunal() =
        with(kosmos) {
            testScope.runTest {
                communalSceneInteractor.changeScene(CommunalScenes.Blank)
                communalSceneInteractor.changeScene(CommunalScenes.Blank, "test")
                val scene by collectLastValue(communalSceneInteractor.currentScene)

                // device is docked while on the lockscreen
@@ -342,7 +342,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
    fun dockingOnLockscreen_doesNotForceCommunalIfDreamStarts() =
        with(kosmos) {
            testScope.runTest {
                communalSceneInteractor.changeScene(CommunalScenes.Blank)
                communalSceneInteractor.changeScene(CommunalScenes.Blank, "test")
                val scene by collectLastValue(communalSceneInteractor.currentScene)

                // device is docked while on the lockscreen
@@ -374,7 +374,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
            testScope.runTest {
                // Device is dreaming and on communal.
                updateDreaming(true)
                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")

                val scene by collectLastValue(communalSceneInteractor.currentScene)
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
@@ -391,7 +391,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
            testScope.runTest {
                // Device is not dreaming and on communal.
                updateDreaming(false)
                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")

                // Scene stays as Communal
                advanceTimeBy(SCREEN_TIMEOUT.milliseconds)
@@ -406,7 +406,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
            testScope.runTest {
                // Device is dreaming and on communal.
                updateDreaming(true)
                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")

                val scene by collectLastValue(communalSceneInteractor.currentScene)
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
@@ -429,7 +429,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
            testScope.runTest {
                // Device is on communal, but not dreaming.
                updateDreaming(false)
                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")

                val scene by collectLastValue(communalSceneInteractor.currentScene)
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
@@ -450,7 +450,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
        with(kosmos) {
            testScope.runTest {
                // Device is on communal.
                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")

                // Device stays on the hub after the timeout since we're not dreaming.
                advanceTimeBy(SCREEN_TIMEOUT.milliseconds * 2)
@@ -471,7 +471,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
            testScope.runTest {
                // Device is dreaming and on communal.
                updateDreaming(true)
                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")

                val scene by collectLastValue(communalSceneInteractor.currentScene)
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
@@ -500,7 +500,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {

                // Device is dreaming and on communal.
                updateDreaming(true)
                communalSceneInteractor.changeScene(CommunalScenes.Communal)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")

                val scene by collectLastValue(communalSceneInteractor.currentScene)
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
@@ -520,7 +520,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
        with(kosmos) {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)
                communalSceneInteractor.changeScene(CommunalScenes.Blank)
                communalSceneInteractor.changeScene(CommunalScenes.Blank, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Blank)

                fakeKeyguardTransitionRepository.sendTransitionSteps(
+5 −5
Original line number Diff line number Diff line
@@ -482,7 +482,7 @@ class CommunalInteractorTest : SysuiTestCase() {
        testScope.runTest {
            val targetScene = CommunalScenes.Communal

            underTest.changeScene(targetScene)
            underTest.changeScene(targetScene, "test")

            val desiredScene = collectLastValue(communalRepository.currentScene)
            runCurrent()
@@ -635,7 +635,7 @@ class CommunalInteractorTest : SysuiTestCase() {
            runCurrent()
            assertThat(isCommunalShowing()).isEqualTo(false)

            underTest.changeScene(CommunalScenes.Communal)
            underTest.changeScene(CommunalScenes.Communal, "test")

            isCommunalShowing = collectLastValue(underTest.isCommunalShowing)
            runCurrent()
@@ -659,12 +659,12 @@ class CommunalInteractorTest : SysuiTestCase() {
            assertThat(isCommunalShowing).isFalse()

            // Verify scene changes (without the flag) to communal sets the value to true
            underTest.changeScene(CommunalScenes.Communal)
            underTest.changeScene(CommunalScenes.Communal, "test")
            runCurrent()
            assertThat(isCommunalShowing).isTrue()

            // Verify scene changes (without the flag) to blank sets the value back to false
            underTest.changeScene(CommunalScenes.Blank)
            underTest.changeScene(CommunalScenes.Blank, "test")
            runCurrent()
            assertThat(isCommunalShowing).isFalse()
        }
@@ -679,7 +679,7 @@ class CommunalInteractorTest : SysuiTestCase() {
            assertThat(isCommunalShowing).isFalse()

            // Verify scene changes without the flag doesn't have any impact
            underTest.changeScene(CommunalScenes.Communal)
            underTest.changeScene(CommunalScenes.Communal, "test")
            runCurrent()
            assertThat(isCommunalShowing).isFalse()

+5 −4
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
            val currentScene by collectLastValue(underTest.currentScene)
            assertThat(currentScene).isEqualTo(CommunalScenes.Blank)

            underTest.changeScene(CommunalScenes.Communal)
            underTest.changeScene(CommunalScenes.Communal, "test")
            assertThat(currentScene).isEqualTo(CommunalScenes.Communal)
        }

@@ -63,7 +63,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
            val currentScene by collectLastValue(underTest.currentScene)
            assertThat(currentScene).isEqualTo(CommunalScenes.Blank)

            underTest.snapToScene(CommunalScenes.Communal)
            underTest.snapToScene(CommunalScenes.Communal, "test")
            assertThat(currentScene).isEqualTo(CommunalScenes.Communal)
        }

@@ -75,6 +75,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
            assertThat(currentScene).isEqualTo(CommunalScenes.Blank)
            underTest.snapToScene(
                CommunalScenes.Communal,
                "test",
                ActivityTransitionAnimator.TIMINGS.totalDuration
            )
            assertThat(currentScene).isEqualTo(CommunalScenes.Blank)
@@ -86,7 +87,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
    fun changeSceneForActivityStartOnDismissKeyguard() =
        testScope.runTest {
            val currentScene by collectLastValue(underTest.currentScene)
            underTest.snapToScene(CommunalScenes.Communal)
            underTest.snapToScene(CommunalScenes.Communal, "test")
            assertThat(currentScene).isEqualTo(CommunalScenes.Communal)

            underTest.changeSceneForActivityStartOnDismissKeyguard()
@@ -97,7 +98,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
    fun changeSceneForActivityStartOnDismissKeyguard_willNotChangeScene_forEditModeActivity() =
        testScope.runTest {
            val currentScene by collectLastValue(underTest.currentScene)
            underTest.snapToScene(CommunalScenes.Communal)
            underTest.snapToScene(CommunalScenes.Communal, "test")
            assertThat(currentScene).isEqualTo(CommunalScenes.Communal)

            underTest.setEditModeState(EditModeState.STARTING)
+4 −4
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ class CommunalTutorialInteractorTest : SysuiTestCase() {
            kosmos.setCommunalAvailable(true)
            communalTutorialRepository.setTutorialSettingState(HUB_MODE_TUTORIAL_NOT_STARTED)

            communalInteractor.changeScene(CommunalScenes.Blank)
            communalInteractor.changeScene(CommunalScenes.Blank, "test")

            assertThat(tutorialSettingState).isEqualTo(HUB_MODE_TUTORIAL_NOT_STARTED)
        }
@@ -171,7 +171,7 @@ class CommunalTutorialInteractorTest : SysuiTestCase() {
            goToCommunal()
            communalTutorialRepository.setTutorialSettingState(HUB_MODE_TUTORIAL_STARTED)

            communalInteractor.changeScene(CommunalScenes.Blank)
            communalInteractor.changeScene(CommunalScenes.Blank, "test")

            assertThat(tutorialSettingState).isEqualTo(HUB_MODE_TUTORIAL_COMPLETED)
        }
@@ -184,13 +184,13 @@ class CommunalTutorialInteractorTest : SysuiTestCase() {
            goToCommunal()
            communalTutorialRepository.setTutorialSettingState(HUB_MODE_TUTORIAL_COMPLETED)

            communalInteractor.changeScene(CommunalScenes.Blank)
            communalInteractor.changeScene(CommunalScenes.Blank, "test")

            assertThat(tutorialSettingState).isEqualTo(HUB_MODE_TUTORIAL_COMPLETED)
        }

    private suspend fun goToCommunal() {
        kosmos.setCommunalAvailable(true)
        communalInteractor.changeScene(CommunalScenes.Communal)
        communalInteractor.changeScene(CommunalScenes.Communal, "test")
    }
}
Loading