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

Commit 7e5e70df authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Prevents posting multiple pulse requests at the same time" into qt-r1-dev

parents 62a7af3f 9fa6d73e
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ public class DozeDockHandler implements DozeMachine.Part {
    private final DockManager mDockManager;

    private int mDockState = DockManager.STATE_NONE;
    private boolean mPulsePending;

    public DozeDockHandler(Context context, DozeMachine machine, DozeHost dozeHost,
            AmbientDisplayConfiguration config, Handler handler, DockManager dockManager) {
@@ -66,7 +67,8 @@ public class DozeDockHandler implements DozeMachine.Part {
                }
                // continue below
            case DOZE:
                if (mDockState == DockManager.STATE_DOCKED) {
                if (mDockState == DockManager.STATE_DOCKED && !mPulsePending) {
                    mPulsePending = true;
                    mHandler.post(() -> requestPulse(newState));
                }
                break;
@@ -79,12 +81,11 @@ public class DozeDockHandler implements DozeMachine.Part {
    }

    private void requestPulse(State dozeState) {
        if (mDozeHost.isPulsingBlocked() || !dozeState.canPulse()) {
            return;
        }

        if (!mDozeHost.isPulsingBlocked() && dozeState.canPulse()) {
            mMachine.requestPulse(DozeLog.PULSE_REASON_DOCKING);
        }
        mPulsePending = false;
    }

    private void requestPulseOutNow(State dozeState) {
        if (dozeState == State.DOZE_REQUEST_PULSE || dozeState == State.DOZE_PULSING