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

Commit 57be7e1b authored by Joanne Chung's avatar Joanne Chung
Browse files

Fix the state cannot transition to DOZE while room is dark.

When AOD is on and the device goes from SCREEN_ON to SCREEN_OFF
in a dark room, the doze state is DOZE_AOD. Due to DozeDockHandler
receives STATE_DOCKED_HIDE but the state is not PLUSING, the screen
does not hide.

Bug: 127737347
Test: atest SystemUITests:DozeDockHandlerTest
Test: Manual
Change-Id: Icaebbdf843de61ef0026e8d3d5dca47bfc2f89eb
parent 28541ec7
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -121,11 +121,17 @@ public class DozeDockHandler implements DozeMachine.Part {
                    if (dozeState == State.DOZE
                            && mConfig.alwaysOnEnabled(UserHandle.USER_CURRENT)) {
                        mMachine.requestState(State.DOZE_AOD);
                        break;
                    }
                    // continue below
                    else {
                        requestPulseOutNow(dozeState);
                    }
                    break;
                case DockManager.STATE_DOCKED_HIDE:
                    if (dozeState == State.DOZE_AOD) {
                        mMachine.requestState(State.DOZE);
                    } else {
                        requestPulseOutNow(dozeState);
                    }
                    break;
                default:
                    // no-op
+12 −0
Original line number Diff line number Diff line
@@ -202,4 +202,16 @@ public class DozeDockHandlerTest extends SysuiTestCase {

        verify(mMachine).requestState(eq(State.DOZE));
    }

    @Test
    public void testTransitionToPulsing_whenDockedHide_requestPulseOut() {
        mDockHandler.transitionTo(DozeMachine.State.UNINITIALIZED, DozeMachine.State.INITIALIZED);
        when(mMachine.getState()).thenReturn(DozeMachine.State.DOZE_PULSING);
        when(mMachine.getPulseReason()).thenReturn(DozeLog.PULSE_REASON_DOCKING);
        mDockManagerFake.setDockEvent(DockManager.STATE_DOCKED_HIDE);

        mDockHandler.transitionTo(DozeMachine.State.INITIALIZED, State.DOZE_PULSING);

        verify(mHost).stopPulsing();
    }
}