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

Commit 0661edf5 authored by Prince Donkor's avatar Prince Donkor Committed by Android (Google) Code Review
Browse files

Merge "Logs when the Glanceable Hub times out" into main

parents 1902cd5b de80a39a
Loading
Loading
Loading
Loading
+22 −16
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ import android.platform.test.annotations.EnableFlags
import android.provider.Settings
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.internal.logging.uiEventLogger
import com.android.internal.logging.uiEventLoggerFake
import com.android.systemui.Flags.FLAG_COMMUNAL_HUB
import com.android.systemui.Flags.FLAG_COMMUNAL_SCENE_KTF_REFACTOR
import com.android.systemui.SysuiTestCase
@@ -28,6 +30,7 @@ import com.android.systemui.communal.domain.interactor.communalInteractor
import com.android.systemui.communal.domain.interactor.communalSceneInteractor
import com.android.systemui.communal.domain.interactor.communalSettingsInteractor
import com.android.systemui.communal.domain.interactor.setCommunalAvailable
import com.android.systemui.communal.shared.log.CommunalUiEvent
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.communal.shared.model.EditModeState
import com.android.systemui.coroutines.collectLastValue
@@ -35,7 +38,6 @@ import com.android.systemui.dock.dockManager
import com.android.systemui.dock.fakeDockManager
import com.android.systemui.flags.Flags.COMMUNAL_SERVICE_ENABLED
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.flags.featureFlagsClassic
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
@@ -93,6 +95,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                        bgScope = applicationCoroutineScope,
                        mainDispatcher = testDispatcher,
                        centralSurfacesOpt = centralSurfacesOptional,
                        uiEventLogger = uiEventLoggerFake,
                    )
                    .apply { start() }

@@ -119,7 +122,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.PRIMARY_BOUNCER,
                    to = KeyguardState.GONE,
                    testScope = this
                    testScope = this,
                )

                assertThat(scene).isEqualTo(CommunalScenes.Communal)
@@ -140,7 +143,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.PRIMARY_BOUNCER,
                    to = KeyguardState.GONE,
                    testScope = this
                    testScope = this,
                )

                assertThat(scene).isEqualTo(CommunalScenes.Communal)
@@ -161,7 +164,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.PRIMARY_BOUNCER,
                    to = KeyguardState.GONE,
                    testScope = this
                    testScope = this,
                )

                assertThat(scene).isEqualTo(CommunalScenes.Blank)
@@ -181,7 +184,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.ALTERNATE_BOUNCER,
                    to = KeyguardState.GONE,
                    testScope = this
                    testScope = this,
                )
                // Scene change will be handled in EditWidgetsActivity not here
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
@@ -200,7 +203,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GONE,
                    to = KeyguardState.LOCKSCREEN,
                    testScope = this
                    testScope = this,
                )
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
            }
@@ -220,7 +223,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GLANCEABLE_HUB,
                    to = KeyguardState.OCCLUDED,
                    testScope = this
                    testScope = this,
                )
                assertThat(scene).isEqualTo(CommunalScenes.Blank)
            }
@@ -240,7 +243,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GLANCEABLE_HUB,
                    to = KeyguardState.OCCLUDED,
                    testScope = this
                    testScope = this,
                )
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
            }
@@ -258,7 +261,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GLANCEABLE_HUB,
                    to = KeyguardState.LOCKSCREEN,
                    testScope = this
                    testScope = this,
                )
                assertThat(scene).isEqualTo(CommunalScenes.Blank)
            }
@@ -276,7 +279,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GLANCEABLE_HUB,
                    to = KeyguardState.OFF,
                    testScope = this
                    testScope = this,
                )
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

@@ -298,7 +301,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GLANCEABLE_HUB,
                    to = KeyguardState.OFF,
                    testScope = this
                    testScope = this,
                )
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
                advanceTimeBy(CommunalSceneStartable.AWAKE_DEBOUNCE_DELAY / 2)
@@ -307,7 +310,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.OFF,
                    to = KeyguardState.GLANCEABLE_HUB,
                    testScope = this
                    testScope = this,
                )

                advanceTimeBy(CommunalSceneStartable.AWAKE_DEBOUNCE_DELAY)
@@ -327,7 +330,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GLANCEABLE_HUB,
                    to = KeyguardState.LOCKSCREEN,
                    testScope = this
                    testScope = this,
                )
                updateDocked(true)

@@ -349,7 +352,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GLANCEABLE_HUB,
                    to = KeyguardState.LOCKSCREEN,
                    testScope = this
                    testScope = this,
                )
                updateDocked(true)

@@ -361,7 +364,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.LOCKSCREEN,
                    to = KeyguardState.DREAMING,
                    testScope = this
                    testScope = this,
                )
                advanceTimeBy(CommunalSceneStartable.DOCK_DEBOUNCE_DELAY)
                assertThat(scene).isEqualTo(CommunalScenes.Blank)
@@ -511,6 +514,9 @@ class CommunalSceneStartableTest : SysuiTestCase() {

                advanceTimeBy(SCREEN_TIMEOUT.milliseconds)
                assertThat(scene).isEqualTo(CommunalScenes.Blank)
                assertThat(uiEventLoggerFake.logs.first().eventId)
                    .isEqualTo(CommunalUiEvent.COMMUNAL_HUB_TIMEOUT.id)
                assertThat(uiEventLoggerFake.numLogs()).isEqualTo(1)
            }
        }

@@ -526,7 +532,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.DOZING,
                    to = KeyguardState.GLANCEABLE_HUB,
                    testScope = this
                    testScope = this,
                )

                assertThat(scene).isEqualTo(CommunalScenes.Communal)
+5 −0
Original line number Diff line number Diff line
@@ -19,11 +19,13 @@ package com.android.systemui.communal
import android.provider.Settings
import com.android.compose.animation.scene.SceneKey
import com.android.compose.animation.scene.TransitionKey
import com.android.internal.logging.UiEventLogger
import com.android.systemui.CoreStartable
import com.android.systemui.Flags.communalSceneKtfRefactor
import com.android.systemui.communal.domain.interactor.CommunalInteractor
import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor
import com.android.systemui.communal.domain.interactor.CommunalSettingsInteractor
import com.android.systemui.communal.shared.log.CommunalUiEvent
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.communal.shared.model.CommunalTransitionKeys
import com.android.systemui.communal.shared.model.EditModeState
@@ -84,6 +86,7 @@ constructor(
    @Application private val applicationScope: CoroutineScope,
    @Background private val bgScope: CoroutineScope,
    @Main private val mainDispatcher: CoroutineDispatcher,
    private val uiEventLogger: UiEventLogger,
) : CoreStartable {
    private var screenTimeout: Int = DEFAULT_SCREEN_TIMEOUT

@@ -184,6 +187,7 @@ constructor(
                            CommunalScenes.Blank,
                            "dream started after timeout",
                        )
                        uiEventLogger.log(CommunalUiEvent.COMMUNAL_HUB_TIMEOUT)
                    }
                }
        }
@@ -212,6 +216,7 @@ constructor(
                            newScene = CommunalScenes.Blank,
                            loggingReason = "hub timeout",
                        )
                        uiEventLogger.log(CommunalUiEvent.COMMUNAL_HUB_TIMEOUT)
                    }
                    timeoutJob = null
                }