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

Commit a1d372c4 authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

DO NOT MERGE Doze-Pulsing should always go to display on

The only exception is if the device requires
a blank frame before turning the display back on.

Test: atest DozeMachineTest
Test: make a phone call, then enter AOD and attempt UDFPS to see HBM
Bug: 213875085

Change-Id: Ia3025c1b6e479180edf489dcb53dec8f81f7820f
parent b4ee475d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -118,9 +118,11 @@ public class DozeMachine {
            switch (this) {
                case UNINITIALIZED:
                case INITIALIZED:
                case DOZE_REQUEST_PULSE:
                    return parameters.shouldControlScreenOff() ? Display.STATE_ON
                            : Display.STATE_OFF;
                case DOZE_REQUEST_PULSE:
                    return parameters.getDisplayNeedsBlanking() ? Display.STATE_OFF
                            : Display.STATE_ON;
                case DOZE_AOD_PAUSED:
                case DOZE:
                    return Display.STATE_OFF;
+18 −0
Original line number Diff line number Diff line
@@ -42,12 +42,14 @@ import static org.mockito.Mockito.when;
import android.hardware.display.AmbientDisplayConfiguration;
import android.testing.AndroidTestingRunner;
import android.testing.UiThreadTest;
import android.view.Display;

import androidx.test.filters.SmallTest;

import com.android.systemui.SysuiTestCase;
import com.android.systemui.dock.DockManager;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.util.wakelock.WakeLockFake;

@@ -444,4 +446,20 @@ public class DozeMachineTest extends SysuiTestCase {

        assertTrue(mServiceFake.requestedWakeup);
    }

    @Test
    public void testDozePulsing_displayRequiresBlanking_screenState() {
        DozeParameters dozeParameters = mock(DozeParameters.class);
        when(dozeParameters.getDisplayNeedsBlanking()).thenReturn(true);

        assertEquals(Display.STATE_OFF, DOZE_REQUEST_PULSE.screenState(dozeParameters));
    }

    @Test
    public void testDozePulsing_displayDoesNotRequireBlanking_screenState() {
        DozeParameters dozeParameters = mock(DozeParameters.class);
        when(dozeParameters.getDisplayNeedsBlanking()).thenReturn(false);

        assertEquals(Display.STATE_ON, DOZE_REQUEST_PULSE.screenState(dozeParameters));
    }
}