History log of /frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
d0e44c5ee32976b24b9b1377d9ece94a59db7df5 25-Mar-2017 Philip P. Moltmann <moltmann@google.com> Do not allow printing until preview is updated

Otherwise we might end up in the situation where we print something that
was not previewed.
This is of course bad for the user as he prints something he has not seen.
It is also bad for the print spooler as in the case the layout did not
describe the amount of pages, we do not know the number of pages available
until the update is complete.

We now allow changing of printer at any time unless printing is in final
stage. If we don't allow this the changing of printer would be blocked
until the intial document was written which might take some time.

Fixes: 36599750
Test: cts-tradefed run cts-dev -m Print
Change-Id: I93e910c02f2a770008b845028f0adf17b3d410e2
(cherry picked from commit 378cddbc41dae55e9a11faaa251b80fb90878b34)
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
f7a5b4fb30792789d9e436bb5107f1a6d743d49c 16-Mar-2017 Philip P. Moltmann <moltmann@google.com> Handle corrupted files when cutting out pages

Before the print spooler crashes, now we crash the printing app.

Bonus: Renamed and documented fields as I could never remeber what they
mean.

Test: Added new (disabled) test to CTS print tests that emulated the
scenario
Bug: 35350768
Change-Id: I41c094960d96f46d274e9f87381bcda5274d5612
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
954533b311f41b61a3333b2968a1a8eea6859c17 14-Jul-2016 Dan Sandler <dsandler@android.com> WIP debugging. am: f3a1f2c7b0
am: 42ec9b86b1

Change-Id: I2a9d3b382de2563f5538be8ecc33b9aad0e6380a
fde8ecc2eaa014b29dfb44be9a0ba1f033f96141 14-Jul-2016 Philip P. Moltmann <moltmann@google.com> Always trigger a write if no pages are written

If a previous write was canceled we can end up in the situation where
the layout reports "not changes since layout" but no pages have been
written.

In this case we have to trigger a write even if the layout reports that
nothing changed.

Fixes: 24110832
Change-Id: I4b3f69581e63f4084cd3712861288ded7d9c9249
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
e335db03e592b4210613a125009918faeec2e974 24-Jun-2016 Philip P. Moltmann <moltmann@google.com> Treat unexpected cancels as failures.

Change-Id: Ie29f164056cb3a8b8f1e7f465a3d2c4f338fb60f
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
7134fcc07ca71cdb9eeccfc7d1846e4408849aec 29-Mar-2016 Philip P. Moltmann <moltmann@google.com> RemotePrintDocument might get destroyed in constructor

... if it cannot connect to remote PrintDocumentAdapter. Then the state
will be set to destroyed and the print activity will be aborted via the
onDied callback.

Bug: 27899066
Change-Id: Ieb287b92ac21fc71a56b491a1035feaff6cd2837
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
27db6611a76a11a5d271dd824167fa1d4b23f944 07-Mar-2016 Philip P. Moltmann <moltmann@google.com> Treat all remotedocumentadapter-command results as cancel in the case we
are canceling the command.

Before it could happen that we have a pending cancel on a layout command
but the layout command finishes normally. This enqueued a new write
command before the PrintActivity is notified. This in turn prevented the
printactivity from finishing as the write command was still pending.

Bug: 27642724
Change-Id: I3c532d53b0c66c40d2e48ab8b4419251ff473a79
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
645a3e1ca6ce26da52fa158ca159a31bd38de77d 25-Feb-2016 Philip P. Moltmann <moltmann@google.com> Force cancel pending RemotePrintDocument commands when the PrintActivity exits

Otherwise the print-client app can prevent the print activity from exiting as
we wait for the command to finish. As this is a violation of the
remote-print-document contract we deal with this similar to a command failure.
As the PrintActivity is exiting we don't further send any commands to the
print-client.

Bug: 27207751
Change-Id: Ieacb16786112f217ca5b8031bfb597598e28dc3d
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
cc3fa0d295ea39e412e4a7e0dd4c916b5123bca5 03-Feb-2016 Philip P. Moltmann <moltmann@google.com> Clarify synchronization between PrintActivity and RemotePrintDocument

The general theme of these changes is to always delay any action until
the printDocument finishes a command. This is done:
- Before callinng for into a different activity to select a name for the
PDF
- Before finishing

The second theme is to fix the canceling behavior of
RemotePrintDocument.AsyncCommand.

There are four bugs fixed in this review:

(1)
When the RemotePrintDocument.AsyncCommand is canceled it goes into the
"canceling" state. When it is canceled again it should stay in this
state. Before it went to "canceled" but the command was still running.
(see AsyncCommand#cancel()).

(2)
When finishing the PrintActivity in PrintActivity.doFinish() we cancel
the RemotePrintDocument. If there is a command still in progress (i.e.
isUpdating()) and it finished as canceled we used to call doFinish()
again and then try to double-clean up which lead to exceptions.

The new behavior is that is the PrintActivity is calling doFinish()
while a command is still in progress (i.e. isUpdating()) we delay the
cleanup until the command finishes. The command might finish as
canceled, completed or failed. Hence we have to call doFinish() in the
callbacks for all three cases.

(3)
When canceling there might have still been a nextCommand ready, hence
canceling does not stop execution of the RemotePrintDocument which could
lead to running commands while finshing.

(4)
When getting the location to store the PDF at a command might still be
in progress. This lead to half executed commands and caused issues once
we try to continue after the select-location-activity returns

Bug: 24713704
Bug: 24973884
Change-Id: Ied90fe8dc9bd6ea7f8b3e4ce4f922e477015568d
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
f6114c4f1ea92e740191b173515e1fdbc7450583 08-Jan-2016 Philip P. Moltmann <moltmann@google.com> In rare cases the printing client app might have been dieded before remotePrintDocument.start(). In this case the print spooler should not crash.

Change-Id: Ica1b46fadf6bccbd28e8f9c928f5d504cccff792
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
c43639c3067dda5df189fb3cbf14f256c17e677d 18-Dec-2015 Philip P. Moltmann <moltmann@google.com> Clean up print subsystem

- Stop using deprecated APIs
- Fix all public and some internal javadoc
- Add @Decorations to public APIs
- Some minor cleanup, e.g. don't use variables with overlapping names in same scope
- remove unnecessary properties from manifest (they are set by the build
system)

Change-Id: I0ce8849a516414763fe9de76c3a18ce17d896816
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
fce84f035c35606c5707e735f503f7bdcfd5b2a1 01-Nov-2014 Svet Ganov <svetoslavganov@google.com> Crash apps that print malformed or password protected PDFs.

If apps are writing malformed content (typically not a PDF file) or if the
PDF content they provide to the print system is password protected, are now
crashed as both of these are app bugs.

bug:17636435

Change-Id: Ifce6a3199e587448dd38f6a84290a965c24b698b
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
4237c92d850b7fb0fa0be15df94e4d1689e353fc 24-Oct-2014 Svet Ganov <svetoslavganov@google.com> Crash in print spooler if printing app killed from recents.

If the printing app with the print UI on top is killed from recents we get
a crash because: 1) the remote print document was not transitioned to a
failed state if the printing app dies (this is an unrecoverable failure);
2) the print preview controller was destroyed asyncronosly during which it
also asynchronously disconnects from the rendering service which however
happens after the system has already cleaned up all connections of the print
UI activity as it is being destoryed.

bug:18109386

Change-Id: If6200b14a8aa90622228bbb659e9c4962226f561
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
05ff998fd86eff15e91694bc205ea0af0de83284 13-Sep-2014 Svet Ganov <svetoslavganov@google.com> Fix a crash in print spooler.

A recent bug fix exposed another one where we were not updating
the internal state of the remote print document after it finishes
updating. This resulted in a crash on every print.

bug:16966145

Change-Id: I398ff7976533241e3d4cb6cd27f69cdc25e67be9
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
2fb64a5cb160a2615f07ed669aa5738dbb74ad6c 12-Sep-2014 Svetoslav <svetoslavganov@google.com> Fix crash in spooler if printing app dies.

bug:16966145

Change-Id: I092c489a7f1b4000a96d3f12f2996ccabf734b9a
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
e17123dd6d3666c88b47172b8efc995523b47346 11-Sep-2014 Svetoslav <svetoslavganov@google.com> Fix back button behavior and clean up in print preview activity.

The print preview UI owns and drives the lifecycle of several objects.
These objects were torn down too late resulting in an attempt to use
the activity as a context when it was no longer valid and service unbind
resulting in causing a crash.

Fixed a bug where if the back button is pressed mutiple times when
the print UI is being initialized a crash occurs.

bug:17454041

Change-Id: Ic1455b467586f0ad65f907e2160ec5cfb2d17d05
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
6552bf3da60159607d9266eb295ee3c448f6c3de 04-Sep-2014 Svetoslav <svetoslavganov@google.com> Print spooler UI polish and bug fixes.

1. Added an empty state for pages that are being rendered.

2. Fixed a NPA on a binder thread when destoroying the
remote print adapter.

3. Fixed a rare crash when the print activity gets an
activity class callback while initializing.

4. Changed the preview pages on phone in land to four.

5. Fixed a flicker from a list of pages to an empty state
and then back to the list of pages.

bug:15704969
bug:16966145

Change-Id: I0eea2f30a102d8fefcbf90187fa6d8612fb19434

Conflicts:
packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
6f249835a4ff9e7e7e3ca0190b7ecf72e689656d 03-Sep-2014 Svetoslav <svetoslavganov@google.com> Fix some print UI issues.

1. Fixed a crash when orientation changes and the content
is scrolled due to wrong size bitmap being requested.

2. Closed a file dscriptior that was being left open.

3. Clearing the bitmap before passing it to the renderer to
ensure it is white for pixels not touched when rendering.

4. Removed debug logs.

5. Switched to the correct layout manager for RecyclerView.

bug:16966145

Change-Id: I8ab9d22635c93cac5ff85c6f4b5d82e58cd8df5c
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
9c9888b8c59e35717ecfc32e9b96fb8702ceb480 27-Aug-2014 Svetoslav <svetoslavganov@google.com> Fix a crash in PrintSpooler.

If the user cancels printing we cancel the current
pring operation in the RemotePrintDocument which is
a state machine enforcing valid state transitions.
A valid transition was not allowed: finishing after
canceled.

bug:17182301

Change-Id: Iccf3a78d7dc736a64bf5c44941a8f8064dcd0ec3
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
525a66b2bb5abf844aff2109bdc9ed819566bece 15-Jun-2014 Svet Ganov <svetoslavganov@google.com> Adding print preview.

This change adds the pring preview part of the new print UX. The
UI has two parts, the top section is the print options and the
bottom section print preview with a list of pages. The user can
interact only with one of them. When print options are expanded
they cover the preview content and a scrim is laid out on top of
the preview. Tapping the scrim collapses the print options. When
the user types in page ranges and closes the options to look at
the preview, the latter is updated to show only these pages. In
the list of pages the user can further prune pages by deselecting
them.

Change-Id: I0b23d2c598afe2a34400ccfa43e4e935af83c72f
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java
a798c0a984f29f7180883a61839f68d2cbf0c6ce 15-May-2014 Svetoslav <svetoslavganov@google.com> Refactor printing

Change-Id: I19850154ef2798afff511e4490a268ce38e8cbae
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/RemotePrintDocument.java