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

Commit 3d9b8679 authored by Jerry Chang's avatar Jerry Chang Committed by android-build-merger
Browse files

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

am: f4171246

Change-Id: I775435f5544c4d22c5d27a184c7dceec8d68e109
parents f5ec7ece f4171246
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