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

Commit 2c36227c authored by Beverly Tai's avatar Beverly Tai Committed by Automerger Merge Worker
Browse files

Merge "Don't crash on transition DOZE_SUSPEND_TRIGGERS => DOZE_PULSE_DONE"...

Merge "Don't crash on transition DOZE_SUSPEND_TRIGGERS => DOZE_PULSE_DONE" into tm-qpr-dev am: 620eb6ee

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



Change-Id: Ib428feb263f3654f19732db261ffdcec8390a66d
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents a2424bea 620eb6ee
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -398,7 +398,8 @@ public class DozeMachine {
        }
        }
        if ((mState == State.DOZE_AOD_PAUSED || mState == State.DOZE_AOD_PAUSING
        if ((mState == State.DOZE_AOD_PAUSED || mState == State.DOZE_AOD_PAUSING
                || mState == State.DOZE_AOD || mState == State.DOZE
                || mState == State.DOZE_AOD || mState == State.DOZE
                || mState == State.DOZE_AOD_DOCKED) && requestedState == State.DOZE_PULSE_DONE) {
                || mState == State.DOZE_AOD_DOCKED || mState == State.DOZE_SUSPEND_TRIGGERS)
                && requestedState == State.DOZE_PULSE_DONE) {
            Log.i(TAG, "Dropping pulse done because current state is already done: " + mState);
            Log.i(TAG, "Dropping pulse done because current state is already done: " + mState);
            return mState;
            return mState;
        }
        }
+11 −0
Original line number Original line Diff line number Diff line
@@ -407,6 +407,17 @@ public class DozeMachineTest extends SysuiTestCase {
        mMachine.requestState(DOZE_PULSE_DONE);
        mMachine.requestState(DOZE_PULSE_DONE);
    }
    }


    @Test
    public void testPulsing_dozeSuspendTriggers_pulseDone_doesntCrash() {
        mMachine.requestState(INITIALIZED);

        mMachine.requestState(DOZE);
        mMachine.requestPulse(DozeLog.PULSE_REASON_NOTIFICATION);
        mMachine.requestState(DOZE_PULSING);
        mMachine.requestState(DOZE_SUSPEND_TRIGGERS);
        mMachine.requestState(DOZE_PULSE_DONE);
    }

    @Test
    @Test
    public void testSuppressingPulse_doesntCrash() {
    public void testSuppressingPulse_doesntCrash() {
        mMachine.requestState(INITIALIZED);
        mMachine.requestState(INITIALIZED);