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

Commit 18e595fb authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

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

parents a029aa8e 57be7e1b
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();
    }
}