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
This commit is contained in:
Beverly
2022-02-16 14:21:37 +00:00
committed by Beverly Tai
parent b4ee475d9b
commit a1d372c4ce
2 changed files with 21 additions and 1 deletions

View File

@@ -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;

View File

@@ -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));
}
}