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

Commit a0a26017 authored by Ale Nijamkin's avatar Ale Nijamkin
Browse files

[flexiglass] Fixes CentralSurfacesImplTest when flexi is enabled

Fix: 416709420
Test: N/A the whole thing is a test fix
Flag: com.android.systemui.scene_container
Change-Id: I71ddbf77f9e6efe0b88d4fbc542afd111d46450a
parent 36308f7f
Loading
Loading
Loading
Loading
+31 −5
Original line number Diff line number Diff line
@@ -995,18 +995,35 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
    }

    @Test
    public void testOnStartedWakingUp_isNotDozing() {
    @DisableSceneContainer
    public void testOnStartedWakingUp_isNotDozing_withoutSceneContainer() {
        testOnStartedWakingUp_isNotDozing(true);
    }

    @Test
    @EnableSceneContainer
    public void testOnStartedWakingUp_isNotDozing_withSceneContainer() {
        // When the scene framework is enabled, the ShadeController implementation does nothing when
        // told to instantly expand the shade.
        testOnStartedWakingUp_isNotDozing(/* verifyNpvcExpandInvocations= */ false);
    }

    private void testOnStartedWakingUp_isNotDozing(boolean verifyNpvcExpandInvocations) {
        mCentralSurfaces.setBarStateForTest(StatusBarState.KEYGUARD);
        when(mStatusBarStateController.isKeyguardRequested()).thenReturn(true);
        when(mDozeServiceHost.getDozingRequested()).thenReturn(true);
        mCentralSurfaces.updateIsKeyguard();
        if (verifyNpvcExpandInvocations) {
            // TODO: mNotificationPanelView.expand(false) gets called twice. Should be once.
            verify(mNotificationPanelViewController, times(2)).expand(eq(false));
            clearInvocations(mNotificationPanelViewController);
        }

        mCentralSurfaces.mWakefulnessObserver.onStartedWakingUp();
        verify(mDozeServiceHost, never()).stopDozing();
        if (verifyNpvcExpandInvocations) {
            verify(mNotificationPanelViewController).expand(eq(false));
        }
        mCentralSurfaces.mWakefulnessObserver.onFinishedWakingUp();
        verify(mDozeServiceHost).stopDozing();
    }
@@ -1044,6 +1061,9 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
    }

    @Test
    // When the scene framework is enabled, setting the "leave open" bit is handled in
    // SceneContainerStartable
    @DisableSceneContainer
    public void deviceStateChange_unfolded_shadeOpen_setsLeaveOpenOnKeyguardHide() {
        setFoldedStates(FOLD_STATE_FOLDED.getIdentifier());
        setGoToSleepStates(FOLD_STATE_FOLDED.getIdentifier());
@@ -1081,6 +1101,9 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
    }

    @Test
    // When the scene framework is enabled, closing QS based on screen power happens in
    // SceneContainerStartable
    @DisableSceneContainer
    public void deviceStateChange_unfolded_shadeExpanding_onKeyguard_closesQS() {
        setFoldedStates(FOLD_STATE_FOLDED.getIdentifier());
        setGoToSleepStates(FOLD_STATE_FOLDED.getIdentifier());
@@ -1094,6 +1117,9 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
    }

    @Test
    // When the scene framework is enabled, closing QS based on screen power happens in
    // SceneContainerStartable
    @DisableSceneContainer
    public void deviceStateChange_unfolded_shadeExpanded_onKeyguard_closesQS() {
        setFoldedStates(FOLD_STATE_FOLDED.getIdentifier());
        setGoToSleepStates(FOLD_STATE_FOLDED.getIdentifier());