diff options
author | Philip P. Moltmann <moltmann@google.com> | 2018-10-02 12:34:40 -0700 |
---|---|---|
committer | Philip P. Moltmann <moltmann@google.com> | 2018-10-02 15:45:22 -0700 |
commit | caf6a2eb0cba4c7754aeaf74f5be11a93072dafc (patch) | |
tree | a9fc8f5c0276a9960b8c83e11e268e8f00b74b89 /packages/PrintSpooler/src | |
parent | d72ccfff3d3a6498a447b515cc7d2a2e47228311 (diff) |
Print document generation: Schedule new layout if current command is canceling
In this case the mUpdateSpec will be marked as stale once the command
is done, hence we have to start from scratch.
Fixes: 117124112
Test: - Reproduced scenario in bug
- atest CtsPrintTestCases
Change-Id: I98e11d28147bae638d68b2124507d04f825a392f
Diffstat (limited to 'packages/PrintSpooler/src')
-rw-r--r-- | packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java b/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java index 164454690d46..42c1997b41a3 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java +++ b/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java @@ -218,8 +218,14 @@ public final class RemotePrintDocument { throw new IllegalStateException("Cannot update in state:" + stateToString(mState)); } - // We schedule a layout if the constraints changed. - if (!mUpdateSpec.hasSameConstraints(attributes, preview)) { + /* + * We schedule a layout in two cases: + * - if the current command is canceling. In this case the mUpdateSpec will be marked as + * stale once the command is done, hence we have to start from scratch + * - if the constraints changed we have a different document, hence start a new layout + */ + if (mCurrentCommand != null && mCurrentCommand.isCanceling() + || !mUpdateSpec.hasSameConstraints(attributes, preview)) { willUpdate = true; // If there is a current command that is running we ask for a |