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

Commit 23b865cf authored by William Xiao's avatar William Xiao Committed by Android (Google) Code Review
Browse files

Merge "Fix hub touch handling breaking after using gestures on hub over dream" into main

parents 28d9534c 8c690459
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -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
+3 −1
Original line number Diff line number Diff line
@@ -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(