Merge "Prevents posting multiple pulse requests at the same time" into qt-r1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7e5e70df58
@@ -43,6 +43,7 @@ public class DozeDockHandler implements DozeMachine.Part {
|
|||||||
private final DockManager mDockManager;
|
private final DockManager mDockManager;
|
||||||
|
|
||||||
private int mDockState = DockManager.STATE_NONE;
|
private int mDockState = DockManager.STATE_NONE;
|
||||||
|
private boolean mPulsePending;
|
||||||
|
|
||||||
public DozeDockHandler(Context context, DozeMachine machine, DozeHost dozeHost,
|
public DozeDockHandler(Context context, DozeMachine machine, DozeHost dozeHost,
|
||||||
AmbientDisplayConfiguration config, Handler handler, DockManager dockManager) {
|
AmbientDisplayConfiguration config, Handler handler, DockManager dockManager) {
|
||||||
@@ -66,7 +67,8 @@ public class DozeDockHandler implements DozeMachine.Part {
|
|||||||
}
|
}
|
||||||
// continue below
|
// continue below
|
||||||
case DOZE:
|
case DOZE:
|
||||||
if (mDockState == DockManager.STATE_DOCKED) {
|
if (mDockState == DockManager.STATE_DOCKED && !mPulsePending) {
|
||||||
|
mPulsePending = true;
|
||||||
mHandler.post(() -> requestPulse(newState));
|
mHandler.post(() -> requestPulse(newState));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -79,12 +81,11 @@ public class DozeDockHandler implements DozeMachine.Part {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void requestPulse(State dozeState) {
|
private void requestPulse(State dozeState) {
|
||||||
if (mDozeHost.isPulsingBlocked() || !dozeState.canPulse()) {
|
if (!mDozeHost.isPulsingBlocked() && dozeState.canPulse()) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mMachine.requestPulse(DozeLog.PULSE_REASON_DOCKING);
|
mMachine.requestPulse(DozeLog.PULSE_REASON_DOCKING);
|
||||||
}
|
}
|
||||||
|
mPulsePending = false;
|
||||||
|
}
|
||||||
|
|
||||||
private void requestPulseOutNow(State dozeState) {
|
private void requestPulseOutNow(State dozeState) {
|
||||||
if (dozeState == State.DOZE_REQUEST_PULSE || dozeState == State.DOZE_PULSING
|
if (dozeState == State.DOZE_REQUEST_PULSE || dozeState == State.DOZE_PULSING
|
||||||
|
|||||||
Reference in New Issue
Block a user