From 196784ac1da21eac2c6801484a68fb6b1718765e Mon Sep 17 00:00:00 2001 From: "Philip P. Moltmann" Date: Wed, 30 Aug 2017 07:52:37 -0700 Subject: Reset update spec after canceled layout When we cancel a layout there are two cases. Either we already scheduled the next layout. In this case operate as before as the update-spec was updated to the new update. In there is no new layout we have to reset the update spec as the last command was canceled and the state of the remotePrintDocument has become invalid. The resetted update spec forces a new update the next time update() is called. Fixes: 64911776 Test: cts-tradefed run cts-dev -m Print Added two new tests reproducing the scenarios mentioned in the bug. Change-Id: Icad8da5fd985aed1cc201076ee7262f6d6541380 --- .../src/com/android/printspooler/model/RemotePrintDocument.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'packages/PrintSpooler/src') diff --git a/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java b/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java index f11a9cde9520..b6a003de0eb9 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java +++ b/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java @@ -136,7 +136,12 @@ public final class RemotePrintDocument { mState = STATE_CANCELED; notifyUpdateCanceled(); } - runPendingCommand(); + if (mNextCommand != null) { + runPendingCommand(); + } else { + // The update was not performed, hence the spec is stale + mUpdateSpec.reset(); + } } } }; -- cgit v1.2.3-59-g8ed1b