Merge "Fix the state cannot transition to DOZE while room is dark."
This commit is contained in:
@@ -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:
|
||||
requestPulseOutNow(dozeState);
|
||||
if (dozeState == State.DOZE_AOD) {
|
||||
mMachine.requestState(State.DOZE);
|
||||
} else {
|
||||
requestPulseOutNow(dozeState);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// no-op
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user