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

Commit 114d05e0 authored by Beverly's avatar Beverly Committed by Automerger Merge Worker
Browse files

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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16904594

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


import androidx.test.filters.SmallTest;
import androidx.test.filters.SmallTest;


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


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


        assertTrue(mServiceFake.requestedWakeup);
        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));
    }
}
}