Loading packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayServiceTest.kt +25 −0 Original line number Diff line number Diff line Loading @@ -689,6 +689,31 @@ class DreamOverlayServiceTest : SysuiTestCase() { ) } // Verifies that the touch handling lifecycle is STARTED even if the dream starts while not // focused. @Test fun testLifecycle_dreamNotFocusedOnStart_isStarted() { val transitionState: MutableStateFlow<ObservableTransitionState> = MutableStateFlow(ObservableTransitionState.Idle(CommunalScenes.Blank)) communalRepository.setTransitionState(transitionState) // Communal becomes visible. transitionState.value = ObservableTransitionState.Idle(CommunalScenes.Communal) testScope.runCurrent() mMainExecutor.runAllReady() // Start dreaming. val client = client client.startDream( mWindowParams, mDreamOverlayCallback, DREAM_COMPONENT, false /*shouldShowComplication*/ ) mMainExecutor.runAllReady() assertThat(lifecycleRegistry.currentState).isEqualTo(Lifecycle.State.STARTED) } @Test fun testLifecycle_destroyedAfterOnDestroy() { val client = client Loading packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayService.java +3 −1 Original line number Diff line number Diff line Loading @@ -359,7 +359,9 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ return; } setLifecycleStateLocked(Lifecycle.State.RESUMED); // Set lifecycle to resumed only if there's nothing covering the dream, ex. shade, bouncer, // or hub. These updates can come in before onStartDream runs. updateLifecycleStateLocked(); mStateController.setOverlayActive(true); final ComponentName dreamComponent = getDreamComponent(); mStateController.setLowLightActive( Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayServiceTest.kt +25 −0 Original line number Diff line number Diff line Loading @@ -689,6 +689,31 @@ class DreamOverlayServiceTest : SysuiTestCase() { ) } // Verifies that the touch handling lifecycle is STARTED even if the dream starts while not // focused. @Test fun testLifecycle_dreamNotFocusedOnStart_isStarted() { val transitionState: MutableStateFlow<ObservableTransitionState> = MutableStateFlow(ObservableTransitionState.Idle(CommunalScenes.Blank)) communalRepository.setTransitionState(transitionState) // Communal becomes visible. transitionState.value = ObservableTransitionState.Idle(CommunalScenes.Communal) testScope.runCurrent() mMainExecutor.runAllReady() // Start dreaming. val client = client client.startDream( mWindowParams, mDreamOverlayCallback, DREAM_COMPONENT, false /*shouldShowComplication*/ ) mMainExecutor.runAllReady() assertThat(lifecycleRegistry.currentState).isEqualTo(Lifecycle.State.STARTED) } @Test fun testLifecycle_destroyedAfterOnDestroy() { val client = client Loading
packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayService.java +3 −1 Original line number Diff line number Diff line Loading @@ -359,7 +359,9 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ return; } setLifecycleStateLocked(Lifecycle.State.RESUMED); // Set lifecycle to resumed only if there's nothing covering the dream, ex. shade, bouncer, // or hub. These updates can come in before onStartDream runs. updateLifecycleStateLocked(); mStateController.setOverlayActive(true); final ComponentName dreamComponent = getDreamComponent(); mStateController.setLowLightActive( Loading