Wait on the lock if the queue is paused instead of
just spin-looping.
Test: Close app, make sure screenshot gets persisted.
Bug:
36631902
Change-Id: Id7940468391d6cdfc74bb9341c1639f72d469387
SystemClock.sleep(DELAY_MS);
}
synchronized (mLock) {
- if (!mWriteQueue.isEmpty()) {
+ final boolean writeQueueEmpty = mWriteQueue.isEmpty();
+ if (!writeQueueEmpty && !mPaused) {
continue;
}
try {
- mQueueIdling = true;
+ mQueueIdling = writeQueueEmpty;
mLock.wait();
mQueueIdling = false;
} catch (InterruptedException e) {