diff --git a/sensors/2.0/multihal/HalProxy.cpp b/sensors/2.0/multihal/HalProxy.cpp index 03ff6051a8..fd76bda726 100644 --- a/sensors/2.0/multihal/HalProxy.cpp +++ b/sensors/2.0/multihal/HalProxy.cpp @@ -486,15 +486,14 @@ void HalProxy::handlePendingWrites() { } } lock.lock(); + mSizePendingWriteEventsQueue -= numToWrite; if (pendingWriteEvents.size() > eventQueueSize) { // TODO(b/143302327): Check if this erase operation is too inefficient. It will copy // all the events ahead of it down to fill gap off array at front after the erase. pendingWriteEvents.erase(pendingWriteEvents.begin(), pendingWriteEvents.begin() + eventQueueSize); - mSizePendingWriteEventsQueue -= eventQueueSize; } else { mPendingWriteEventsQueue.pop(); - mSizePendingWriteEventsQueue -= pendingWriteEvents.size(); } } }