History log of /frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
15d68aea5a45bf5d46420a76fb57cec317d8f613 21-Apr-2017 Philip P. Moltmann <moltmann@google.com> Show new colored icon for PDF printer

The color matches the color of the printers reported by the Default
Print Service.

Change-Id: I12c19ab498fc5df3af88932eaeb6b3f7015e71d9
Fixes: 35766257
Test: Looked at Print UI
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
51efddbd3bb304de2dd47fa8cd1114ac555958bb 05-Apr-2017 Alan Viverette <alanv@google.com> Remove unnecessary casts on calls to findViewById

Just frameworks/ this time. More paths to come.

Bug: 24137209
Test: make -j32
Change-Id: Iff27abd26fa43296ac2fff8f534fc6742d2ae80c
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
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/ui/PrintActivity.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/ui/PrintActivity.java
383db5ebcc3a4a615faf249bf4f126f42e80b82e 22-Jun-2016 Tamas Berghammer <tberghammer@google.com> Update package names to work with the proto3 compiler

Bug: b/28974522
Change-Id: I5f3adf4946ee4ba1e09e4f40afe83c151405972a
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
86090a11b57a495d0be0fbe9de23681e9e4e9107 29-Sep-2016 Philip P. Moltmann <moltmann@google.com> When selected printer can't print show error

Test: - New tests is submited in this CL
- print coretests
- print cts tests

Change-Id: I5be71d542106637a22b492be6f71afa68720127e
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
59b0fbd1048521fed9180d592b689c4aa3d81a97 29-Sep-2016 Philip P. Moltmann <moltmann@google.com> Update print attributes when printer gets selected

Test: Add new non-CTS print workflow tests. These tests will cover
general printing workflows such as the situation fixed in this
change.
Change-Id: I33b6842bba164c45a6afbc09f2e0c9b0a523ef30
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
19d6d8c116ee3a01c2ac0aaa038e37604f282ba4 31-Aug-2016 Philip P. Moltmann <moltmann@google.com> Remove page ranges input field when not needed

Before it was just hidden which left an empty space. As the print
options frame is already pretty high, we want to minimize the space when
possible.

Bug: 30977905
Change-Id: If48dc852b083f014194f3f8896ec021eb0f19c0c
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
087c7395edc0edc847c0e7fa049f2d0e59de1062 26-Jul-2016 Philip P. Moltmann <moltmann@google.com> Set title in onCreate. am: fef31ad5ae
am: 28c09c612f

Change-Id: I317a2ea5525518a77d286c4f472de41b2ce43bba
fef31ad5ae90c476ff6af39c03ae5f485c42d522 25-Jul-2016 Philip P. Moltmann <moltmann@google.com> Set title in onCreate.

This makes sure the accessibility service recognizes the correcy title.

Fixes: 30220082
Change-Id: Ieaa37818a55c7b2e543bbe8bd8836996ef0529d2
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
5ab1051d8e4815f493748f28ea60ac6d68e91f04 12-Jul-2016 Philip P. Moltmann <moltmann@google.com> Merge \"Merge \\"Set PrintDocumentInfo#mDataSize\\" into nyc-mr1-dev am: ba229ce88a\" into nyc-mr1-dev-plus-aosp
am: 7e19c2d0c6

Change-Id: Ib97c4ac9ad688c24b25b8ad6a894a917e0900c86
76801da1f6e182000c8aa4e9e3aa7f502f3ea0a6 07-Jul-2016 Philip P. Moltmann <moltmann@google.com> Set PrintDocumentInfo#mDataSize

... while configuring and when the final PrintDocumentInfo is set.

Fixes: 30001353
Change-Id: I744929422525508185f5748aca1b018e46d7666f
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
6f6f85764d1ce256ff419fea62a3569f6dc686b9 01-Jul-2016 Philip P. Moltmann <moltmann@google.com> Merge \\"Prevent PrintRegistry callbacks when finishing\\" into nyc-mr1-dev am: 4b24c48e23
am: 4c1327dfaf

Change-Id: I16823d0088ff725428c3b7fb71c453a3da309e8f
2eae8eb7e23d454a323bbbe9c77a9704488b1d6a 29-Jun-2016 Philip P. Moltmann <moltmann@google.com> Prevent PrintRegistry callbacks when finishing

Previously these callbacks could happen while we clean up the print
preview controller. Then these callbacks called in destroyed and cleaned
up modules.

Fixes: 29874802
Change-Id: I5d8497e3364b97a33a837f8e3e825e5d254592f9
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
6d3ec95a6f0d58f3e7700662ba437c2832f515ff 21-Jun-2016 Philip P. Moltmann <moltmann@google.com> Make print via cloud confirm diag fragment public

Fixes: 29516187
Change-Id: I91266704de130b761c0c3f5d53c465c1c21dfe5a
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
2e3012624b703a653fed44d4dc1b8904406c0d99 16-Jun-2016 Philip P. Moltmann <moltmann@google.com> Add event tracking to print UI.

Bug: 29391676
Change-Id: Iec09ac7296e50329e87268bcb70f5e60d566961c
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
0532d9835e14df910c086f7d431a7fa2d2e67120 09-Jun-2016 Philip P. Moltmann <moltmann@google.com> Merge \\\"Cache resources needed to sort media sizes.\\\" into nyc-dev am: 142fc425c4 am: 5fe5dcdfd6
am: bf49a7de0d

Change-Id: I7e3e2909dbd5f42b2d6b23ecc019e697665d3dc5
0c470821d35d1aa13f051c883d9ab7ed292f81df 03-Jun-2016 Philip P. Moltmann <moltmann@google.com> Cache resources needed to sort media sizes.

- Cache media_standard_iso
- Cache labels between configuration changes (localization might
change labels)
- Use ints instead of String's for standards
- Use HashMap instead of Array map as the lookup is faster for
larger arrays

Fixes: 29068056
Change-Id: I027c80fac4d7e8ea6c2cac0f1a2d52b54807f5be
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
9ae33a0a81fe8a931690cd470a6b85286dbf12ce 27-May-2016 Philip P. Moltmann <moltmann@google.com> Allow to select range unless we are finishing

Fixes: 29004971
Change-Id: I6b76a1f315cce64deab9b1561e5e784aac8ef1b1
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
f1413249db087509070a7a4ad67db781ef4845cf 17-May-2016 Philip P. Moltmann <moltmann@google.com> Handle printers selected by SelectPrinter activity

- Declare a printers availability when changing the removed state.
- Set printJob.printerId to current printer when returning from
SelectPrinter

Change-Id: Ie4680be04fa614a4088f2f32a527e80928c957cc
Fixes: 27643305
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
9a40a32ae96b791712d997d1a6147e3565ea5eef 12-May-2016 Philip P. Moltmann <moltmann@google.com> Clear state when ProgressMessageCtrl. is canceled

Otherwise the following can happen:
- The progressController is _not_ running and we are running through
an update.
- Then onUpdateCompleted is called which cancels the not running
progressController. This then reset whatever state was previously
stored as mPreviousState leaving the PrintActivity in a weird state.

Fixes: 27945565
Change-Id: Id46b8853ba634634198a74921c8a1790c435678c
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
e05a7b71c61a7dd4b7f6f55e23a33807d19b1d98 12-May-2016 Philip P. Moltmann <moltmann@google.com> Handle failure to create file.

This should never happen unless you disable the DocumentsUI app. Hence
handle it by a simple toast.

Bug: 28709934
Change-Id: Iac4aff32617120c442e0f994a2a8c0ce3cca380d
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
383189f494aba302555113ba6873a151bcb4a414 02-May-2016 Philip P. Moltmann <moltmann@google.com> Merge "Handle more config changes and handle onDestroy" into nyc-dev
8582909caefe952d02889e239642af945f64c03d 02-May-2016 Philip P. Moltmann <moltmann@google.com> Merge "Visibility of pageRangeTitle =!= pageRangeText" into nyc-dev
f24285d7b323ff7dd5b3f2f4d9910db2c9a6495d 30-Apr-2016 Philip P. Moltmann <moltmann@google.com> Visibility of pageRangeTitle =!= pageRangeText

Before if we had only a single page we showed the title, but not the
text

Change-Id: Ie2c178eaf19885e0b1dcc803b9da23ed687764a7
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
172d840cd133969a5d6c9e9657927ffdbcd44093 30-Apr-2016 Philip P. Moltmann <moltmann@google.com> Handle more config changes and handle onDestroy

- The PrintActivity has to handle all config changes to not loose track
close the connection to the printing app
- In the case where onDestroy is called we need to make sure to
- not do any more UI operation
- on async calls after destroy is already called, handle failure to
unbind services.

Change-Id: If21335543fbfa16ecfe77d1965b2e8a13dfa14b8
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
3c757036a3c0425ccabadb92e6e609bb2ea0a777 29-Apr-2016 Philip P. Moltmann <moltmann@google.com> Delay callback from printerRegistry after Constr.

If the leader inside of the printer registry can immediately initalize
the callback is called in the same thread as the contructor is
executing. Hence in this case the mPrinterRegistry field is used before
written.

Change-Id: I45239d2792f6c31ec215ddb01131038882ff0136
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
d0e1239e81f1ee5c1d1d52bd2c2296b71d1a9e96 13-Apr-2016 Philip P. Moltmann <moltmann@google.com> Add a log if the printing activity died unexpectly.

Bug: 27861927
Change-Id: I431ba996e113043c224039a62a76ae23e9c7494a
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
c6c319e9889874a1babafa4301dabe193737ebd9 01-Apr-2016 Philip P. Moltmann <moltmann@google.com> Print Activity: Use a single (re-implemented) parsing logig for page ranges.

- Support unbounded ranges, e.g. 4- == 4-pageCount and -2 == 1-2
- Do not allow reverse ranges, i.e. 7-3 is not allowed anymore
- restrict characters that can be typed into field
- force numeric keyboard

- Fix bug that we update the selected pages even if the page ranges are
invalid

Fixes: 13126748
Change-Id: I515d9346ceb152a41b7260792c5dd9bd91b27cab
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
a97415b0b768194e3153f18a60b9cf9b0d8f8e33 01-Apr-2016 Philip P. Moltmann <moltmann@google.com> Merge "Make sure to update the selected pages when needed in the right order." into nyc-dev
9e4bbc60a9e95f624e577997259fbd6500dac15d 01-Apr-2016 Philip P. Moltmann <moltmann@google.com> Do not rely on documentInfo.pageCount when selecting which pages to
scrap

documentInfo.PageCount might be set to "unknown" == -1. Hence we don't
know where the last page to scrap ends. Hence defer this decision all
way until PdfManipulationService.removePages as then we know the actual
pages of the document.

Change-Id: I063c3cd084d65a3ac5c60c3d85cec3a346be2680
Fixed: 27948632
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
7b92d3c04d1d256b4fc1f7a131c3cc4373c55128 31-Mar-2016 Philip P. Moltmann <moltmann@google.com> When we update slow we override the current state. Make sure to reset the state the operation finishes.

Bug: 27945565
Change-Id: If3dc3ad54bbf9bedae0e82aeef7b295ae16e1bf0
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
c309d7155a436df2bf6042e7564363c10204d00b 31-Mar-2016 Philip P. Moltmann <moltmann@google.com> Make sure to update the selected pages when needed in the right order.

Fixes: 27945066
Change-Id: I9c83a5283d6bf093a35ad835532d3c8690b4b989
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
02add6aa91a5468458d6aa47b05701579c6da7d8 31-Mar-2016 Philip P. Moltmann <moltmann@google.com> Merge "Rewrite workflow on how the destination printer is selected." into nyc-dev
456f1e33b808052377a79b91d34091a356652f2c 30-Mar-2016 Philip P. Moltmann <moltmann@google.com> Merge "Update print preview when option is changed and clear ranges when they layout changes" into nyc-dev
4ef83c4647471aa5aefce463ed8abfe37da7fd00 24-Mar-2016 Philip P. Moltmann <moltmann@google.com> Update print preview when option is changed and clear ranges when they
layout changes

Before we updated the print preview when the paper size changed but not
when the page ranges changed. This is not consistent. We always change.

Also if there is a change to the options that changes the layout (i.e.
papersize, orientation, minMargins) then clear the selected ranges as
this does not make sense anymore.

This also fixes a bug that when having pages selected while we reduce
the number of pages in the preview we got a NPE.

Bonus: do not constantly re-update the options UI when range or copies
text is updated.

Bug: 27830850, 27741420
Change-Id: I7abe4a74b44ac5c5ee54d12cc0c1ca1540793f0e
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
940fa80cd1c81926215a0175f16eb2fc9d5f097d 24-Mar-2016 Philip P. Moltmann <moltmann@google.com> Handle all configuration changes in PrintActivity as it cannot be
destroyed synchronously.

Also: Always destroy print spooler provider when it was initialized to
avoid service leakage if print activity was finished after
onCreate but before onPrinterRegistryReady.

Bug: 27814338
Change-Id: I8401dc6e447cbd726b1a8f7c361b4ddf42e7e11d
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
b170c08387169ea65da445b579de2a5655ec8454 21-Mar-2016 Philip P. Moltmann <moltmann@google.com> Don't mix UI and print job state

In PrintActivity.OnPause we set the print job state based on the
PrintActivity state. The issue was that FINISHED was interpreted as
"cancel print job". Actually with FINISHED does not tell what state the
job should be in.

The only purpose of the finished state was to guard against
double-invocation of doFinish().

Hence remove this recently introduced state and use a simple boolean to
guard against doule invocation of doFinish().

Bug: 27760331
Change-Id: I0767c2b0b9c28e8904647cc832c236f67f92bcfe
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
74f9a2fc2e87b63ad7e367dff455f934c8a9d396 18-Mar-2016 Philip P. Moltmann <moltmann@google.com> Merge "Do not finish multiple times." into nyc-dev
5849f20124181f35063902829fdfc4c926b4424f 18-Mar-2016 Philip P. Moltmann <moltmann@google.com> Merge "If we finish before the the remotePrintedDocument is initialized" into nyc-dev
63ce0b737c022281ce4c36e1d90ed9b0270512f0 08-Mar-2016 Philip P. Moltmann <moltmann@google.com> Rewrite workflow on how the destination printer is selected.

This fixes two bugs
(1)
1. Printer was unknown when "all printer" activity was opened
2. Printer gets selected in "all printers" activity
3. Printer is unknown at the time the activity returns and thereby does
not get selected

(2)
If a print service gets disabled _all_ printers of the print service
will be marked as "removed" but do not removed from the adapter. This
is superflous as none of them can be selected anymore. The only thing
we want to make sure of is that the currently selected printer does
not get removed.

The workflow is now always:
- set mCurrentPrinter if needed
- Adjust mPrinterHolders
- adapter.notifyDataSetChanged()
-> PrintersObserver.onChanged()
-> onItemSelected

Bug: 27643305
Change-Id: I35ea7078367ad5a918c6362c04a26c4326e6c3f4
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
ba245f98d64ac2178205193dbc9c111b6080947e 07-Mar-2016 Philip P. Moltmann <moltmann@google.com> Update 'more options' button when changing the printer.

Change-Id: I1bf71629027c18e297426e26db2923c447e47734
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
0ad7fc5250334879fb96cdb6c4443c83f8094631 07-Mar-2016 Philip P. Moltmann <moltmann@google.com> Do not finish multiple times.

It can happen that multiple async calls fail and we end up calling
doFinish from all of them. We should just ignore the later ones.

Bug: 27198033
Change-Id: Ica596b966f96e9ade6409cc45c50fd62c4018b1e
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
32e0755afc236b13d2c3e41797acad56df7f8f74 07-Mar-2016 Philip P. Moltmann <moltmann@google.com> If we finish before the the remotePrintedDocument is initialized

... we should not check if it is updating. As it is not initailized,
we do not have to check either, hence we can just ignore this.

Bug: 27516795
Change-Id: If618f2a10563e83074e38f0b37342a648d54202a
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
66c96591e2ddb464c67e60dbf4193ef4ec8a620b 24-Feb-2016 Philip P. Moltmann <moltmann@google.com> Add "app printer activity" and always keep the print service state
updated. Also fiddle with the UI to use more standard values.

To be sure the print service state alwasy updated I changed
PrintManager.getPrintServices to return a loader which just wraps a
registerListener/getList/removeListener combo.

I also added a new function to enabled/disable a print service to be
keep all updating logic inside the PrintManagerService->UserState.

Then I changed all code to use this new interface.

Detailed comments:

PrintServiceInfo:
- I had to add the enabled state to the PrintServiceInfo as some users
of PrintManager.getPrintServices want all services but then display
different data depending on the enabled state. Of course I could have
created two PrintManager.getPrintServices-loaders to load the two
separate list of services. I think it is much easier to add this
property though. It is updated every time new data is returned to the
PrintManager.getPrintServices-loader.

AddPrinterActivity:
- This is shown as a dialog-style overlay to indicate that the user will
return to the select-printers activity. It contains of three list that
are updated via separate loaders.
- The recommended services will be added later to keep this path set
small.

PrintActivity:
- There are two small places where we have to update the data when we
get a new list of print services.
- In very, very rare conditions it can happen that the print service
of the current printer gains or looses the "advancedOptions"
activity
- If we have no enabled print services we want to show "Add printer"
instead of "All printers...".
- Also the print registry is not the only loader anymore, hence we have
to assign loader ids to it to not conflict with the other loaders in
this activity.
- Small bug in onPrintersChanged: If a printer is selected and the print
service of this printer gets disabled the holder goes into "removed"
state which disables the printer. When the print service is then
enabled again, we forgot to re-enable the holder.

PrinterRegistry:
- The registry assumed that the FusedPrinterProvider was the only loader
in the activity. This is not true anymore, hence it has to assign the
appropriate loader ids.
- The FusedPrinterProvider has an internal loader, hence we have to
forward a loader Id into it.
- The PrintRegistry is only called backed for a single loader, hence no
need to check the loader-id.

SelectPrinterActivity:
- The AddPrinterDialog was removed as we now have the
AddPrinterActivity.
- Added a loader for the enabled services to update the empty state.
- Added dedicated loader Id for the PrinterRegistry again.
- If we have no enabled services, the SelectPrinterActivity chainloads
the AddPrinterActivity as this is the only thing the user can do
anyway. "Save a click". This should only happen when the activity is
create the first time.
- Moved the "add printer" from the menu item to the list of printers as
suggested by UX and Zach.

PrintManagerService, UserState and IPrintManagerParamtersTest:
- As the only place where the print service state is updated is now the
userstate, we have no more sychronization problems. Whohoo.
- The users can now register for changes to the print services similar
as they can register for changes to the print jobs.
- UserState.getPrintServices is the only function can exposes any
knowledge of the print services to the outside world.

Change-Id: I9be2c7300431e06aaff9bdf7eb36120d869b56ac
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
1bb7f3638a67d4c391cf56753156fed1da5c1bfa 26-Feb-2016 Philip P. Moltmann <moltmann@google.com> Update print document view if printer capabilities changed

Bonus: Remove Printer-onChange listener before other state gets cleaned
up. Otherwise onChange callbacks at the wrong time cause into
destroyed data.

Bug: 27219320
Change-Id: I8335b9d8dd71112b76aa684f00524d4d8aad3f94
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
d365f695d2941c4fc7e550d4498006a5012a32f5 29-Feb-2016 Philip P. Moltmann <moltmann@google.com> Fix three bugs in the handling of the advanced options activity

- The selected pages is not stored in the print job. But this is used to
communicate with the advanced options activity. Hence patch it up
before sending it out.
- If no media size is set in the returned attributes, do not try to get
the portait size of this null-media size
- The copies can be 0 if the PrintJobInfo was created via
PrintJobInfo.Builder()

Change-Id: Ic75c1db0cd5ffad663d87913dfe23e3f5a729bbf
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.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/ui/PrintActivity.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/ui/PrintActivity.java
cf5b777c13673cd54a0e9bb37f762aea301ebc07 02-Feb-2016 Philip P. Moltmann <moltmann@google.com> Cancel print job if PrintActivity was finished before spooler could be
connected.

This can happen if finish() was called immediately after onResume() and
before PrintSpoolerProvider.onServiceConnected.

There is actually a small issue left. If the connection to the spooler
gets destroyed before it was ever connected the print job does not get
canceled. In this case it will stay "created" until the next reboot and
then it will not get recreated.

Bug: 26428518
Change-Id: I1b8696f326b842160e4db77b985577a1c8978def
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
e93cf151fbb0ed1e42d14b767f5f8798ab6876e7 02-Feb-2016 Philip P. Moltmann <moltmann@google.com> Merge "Allow the PDF Printer to "print" non-locale-default paper sizes."
18fc58f13dc01cac43ea313800cfee14c6aa0cfa 02-Feb-2016 Philip P. Moltmann <moltmann@google.com> Merge "UI improvements for the print spooler"
2fbd43ea27a35afc90d194755bc4269d1daca1d8 02-Feb-2016 Philip P. Moltmann <moltmann@google.com> Merge "Update summary when printer changes"
76855d322b18f47962727588550e5aec3850c5e8 01-Feb-2016 Philip P. Moltmann <moltmann@google.com> Merge "Init and clean up printer registry independat of state."
51dbc8ec6aa619fadb8e9f9bb9bf5bf3b971aa5d 01-Feb-2016 Philip P. Moltmann <moltmann@google.com> Init and clean up printer registry independat of state.

The printer registry is created not in sync with the states or the
activity life-cycle. It might not be initialized when stop is called as
we might have a very quick

create -> start -> stop -> finish

without time for the print subsystem to initialize.

Bug: 21749058
Change-Id: I991029a7fd0ad162c1144ff03438707f16bf0b02
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
c2f913d09be9b7db40f8135b61d3372dbcb30808 01-Feb-2016 Philip P. Moltmann <moltmann@google.com> Only update UI when bound

If the PrintActivity gets destroyed (e.g. due to low memory) it gets
re-created when the PrintToPDF activity returns in onActivityResult. In
this case onActivityResult is called right after onCreate and before the
UI is bound. This resulted in a NullPointerException when accessing the
unbound UI elements.

Bug: 21749058
Change-Id: I44e625e8c4f10432591d0afcf7825d7e0dbee6f5
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
17332cb2a7e7a24f97090b489c3bd6c67f8a3906 30-Jan-2016 Philip P. Moltmann <moltmann@google.com> Update summary when printer changes

The new printer might not support the currently selected paper size
hence the printer update changes the paper size.

Change-Id: Ie3864d87df425383b4c37f325c8fbea12f6f6051
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
443075ab9784f168fc7a73bb09dabf8bf7ab308e 26-Jan-2016 Philip P. Moltmann <moltmann@google.com> UI improvements for the print spooler

- gray out printer icons of unavailable printers
- Increase touch target of more into button
- Use same info icon as in the Settings
- Align text correctly in destination drop down
- In general use same layout as generic list-item (as much as possible)
- remove unnecesary color file

Change-Id: I8b0339df0cb6a5130b5530f21c4ef86cb75a683b
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
dc5765eb0c2e9da0d5aa70627f18cf2253f71f53 22-Jan-2016 Philip P. Moltmann <moltmann@google.com> Carry over orientation when updating the printAttributes with the capabilities of the printer.

Bug: 19194758
Change-Id: Iaa9897bc730d8cefa63bed8a5ad02e0a5dc89c71
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
4959caf149c49f0a58c6a89ec01b909baf3fa579 21-Jan-2016 Philip P. Moltmann <moltmann@google.com> Allow the PDF Printer to "print" non-locale-default paper sizes.

The MediaSizeComparator already sorts the media sizes correctly.

Bug: 12675943
Change-Id: I6fa4b1a8885a60704bc175ec849ea483ffb4bcd8
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
c2ad22663ba8cbd0ceb35e760c5f3c4084fb5033 13-Jan-2016 Philip P. Moltmann <moltmann@google.com> Clean up API for PrinterInfo.

- Make immutable
- Check parameters
- Check state while unparcelling

Change-Id: I13959845ca508936331488506380e894f49abf25
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.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/ui/PrintActivity.java
bb9f686b40743df2642b7d3b7778dbf7284ae665 01-Dec-2015 Philip P. Moltmann <moltmann@google.com> Allow a print service to specify per printer icons, description and
info-activities

The icon is loaded from the discovery session only when it is displayed
to avoid having to store too many icons in memory.

Also the icons are not maintained in the historical printers. Only if
the printers are available nice icons are shown. A historical printer is
updated with the appropriate properties (including icon) once it becomes
available.

Bug: 24135005
Change-Id: Iec389bab514b024634be8fb5fc8928371cba8740
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
777ef95ebf18c61ff09e7567a06058d351c530ca 26-Nov-2015 Yohei Yukawa <yukawa@google.com> Use Context.getSystemService(Class<T>) for InputMethodManager.

This is a mechanical replacement of Context.getSystemService(String)
with Context.getSystemService(Class<T>) when retrieving
InputMethodManager. Note those are bundled code. Hence we don't need
to make sure Build.VERSION.SDK_INT >= 23.

Change-Id: Icc64942ad8f11e44bf84f8d4fe476b2fdd1257f3
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
c9137615e437b2bfa2ce47db0ec338df0030fe3f 24-Nov-2015 Philip P. Moltmann <moltmann@google.com> Merge changes from topic 'AddPrinters'

* changes:
Create PrintDiscoverySession for future print services
Update printer availability when printSpooler is paused. This makes the window update syncronously when in multi-window mode.
d25ddc3d0ee9d24f0e4c2e7c92defce4c3228f11 24-Nov-2015 Svetoslav <svetoslavganov@google.com> Allow fragment state loss on fragment transaction

We are not saving the state of this fragment on onSaveState,
so its Okay to loose state while confirming the transaction.

bug:25847358

Change-Id: I2f6587d528b2d8b8f24a83954cc896a6ff514996
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
e2b95e4c5689d55e078076d4cc030c1609429bfb 20-Nov-2015 Philip P. Moltmann <moltmann@google.com> Update printer availability when printSpooler is paused. This makes the window update syncronously when in multi-window mode.

Change-Id: If802f32a011b24ec8cca9292eb12bbb399548a40
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
5e54896d0b0748d46bfcecef92148ad365119696 14-Nov-2015 Philip P. Moltmann <moltmann@google.com> Show "select a printer" as "destination" the first the the user prints

The Spinner does not support a prompt, hence temporarily hijack the
first element and install an alternate view. Once the Spinner is touched
revert to the old behavior.

If we showed a prompt the views in the spinner cannot be recycled.

Bug: 24132864
Change-Id: Iaf97878f85388a8c6351e716117b16f34919ad84
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
6dc9114ef8a214d11d8df7babf1959d0193e95bc 12-Nov-2015 Philip P. Moltmann <moltmann@google.com> Merge "Deal correctly with suggested print attributes"
b4efdb4726a442eef38bb6417d5acb8eb68b912d 10-Nov-2015 Philip P. Moltmann <moltmann@google.com> Deal correctly with suggested print attributes

An app might suggest certain attribute for an print job. This patch
fixes

- PrintActivity should not silently overwrite the attributes with
the default values
- Handle duplex mode in PrintAttributes similar to the other attributes.
I.e. have an "unset" value (0). This is an API change. But the only
use case for PrintAttributes was to pass them to print() and thereby
the PrintActivity. This was broken (see above), hence we are changing
and API that could have never been used.

Bug: 23629618
Change-Id: I43c25704497c799352fb806126dc93f6db4879f5
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
59cf3086a9db64244743c2ef4a91102acf89d955 10-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Avoid NPE in printspooler when changing language" am: 8d8515e708 am: 5522efb130
am: 16009a6dea

* commit '16009a6deaff272c94046facbeb567bafdaacc69':
Avoid NPE in printspooler when changing language
853a6f564abaf8acbd88c6704008c5d150d00471 03-Nov-2015 Philip P. Moltmann <moltmann@google.com> Add a alert that allows the user to approve a print service when
we print using it the first time.

This warning used to be shown when the print settings app was used
to enable a service.

If two warning as shown for the same print service we automcatially
dismiss all dialogs once one dialog is confirmed. Please note that
we are not confirming the printjob as it is unexpeced to have a
single click to confirm multiple print jobs.

Change-Id: I8bb0a49bac2063c1c55e2f24bd34df2c44e2df89
Bug: 24135353
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
86d13f3daf6f5562bd83d086008d287c58d841c3 03-Apr-2015 Masaaki Iwaguchi <masaaki.x.iwaguchi@sonymobile.com> Avoid NPE in printspooler when changing language

PrintActivity is recreated when the language setting is changed.
As a result of the recreation mCurrentPrinter is null, which causes
a NullPointerException when onActivityResult() is called.

The issue is solved with a simple null check.

Change-Id: Ic58f0ca01577d2ec02d494739f3bc2f06240dd44
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
dcc34fd8a3f718e5e5cfaccb87eeffd64ac80f63 30-Jul-2015 Chris Wren <cwren@android.com> Instrument printing service for metrics collection.

Bug: 22837316
Change-Id: I8bf62940f5eb495d8d7a10df958d9bc8ad76662a
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
f12b393ff406a3bb8967b69a9be2dd27b0725b33 25-Jul-2015 Svet Ganov <svetoslavganov@google.com> Pass correct extras to the custom print options activity

bug:22734138

Change-Id: Iea1bc32c3e863072b2021b823bef2cefa54fa540
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
5772b5c671a13d9c4bbc1e3803667166f811cb33 11-Jun-2015 Svet Ganov <svetoslavganov@google.com> Propagete document meta-data to custom print UI.

Change-Id: I3f122224e1b311a222969253ae0336177989a414
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
948c9a6393e0995a4d988d5d164998aa0e12b25d 03-Feb-2015 Svetoslav <svetoslavganov@google.com> Add duplex mode support.

This change adds support for duplex printing. The print UI now has a duplex
option which allows the user to choose one of the supported duplex options
by the currently selected printer. The chosen duplex mode is propaged to the
print service that manages this printer.

Change-Id: I807ba9da2723531535c0e1e33f2f4e1b503a54b0
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
eaaf0512fcbf03b926cdbbbb7f54df474ecf861a 26-Nov-2014 Svet Ganov <svetoslavganov@google.com> Crash in print spooler when back pressed before content update complted.

We are updating the printed content asynchronously. If the user cancels
printing before the first update is complete the spooler components are
in a destroyed state but we attempt to handle the completed update resulting
in a crash. Now if printing is cancelled we ignore the update result.

bug:18525491

Change-Id: I1ef47a17de19896cba2c7a1dd2bfc205065e0a5a
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
c80814e70aea8940d0d43cd7170baae8c0c4e8e3 24-Nov-2014 Svet Ganov <svetoslavganov@google.com> Lockup in the print spooler.

A recent change modified the way we destroy the remote renderer from
asynchronous to synchronous. This caused problems since it was possible
that the remote rendering service is unbound while we are reading the
contents of a rendered page. As a result the reader was blocking on I/O
and the print spooler was getting into a locked state that required a
restart of its process. Now the remote renderer is destroyed
asynchronously.

bug:18498626

Change-Id: I1312bf808f30430728b4038dd4be43c55d2be825
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
f6cd14dbc99b38af7afe1e5f72347395603d7de2 20-Nov-2014 Svet Ganov <svetoslavganov@google.com> Print spooler crash when printing after a rotation.

1. Available printers are provided by a loader driven by the activity
lifecycle. After a rotation of an app that does not handle rotation
the print activity is destroyed in a delayed fashion. When another
print task is started the loader of the destroed activity gets two
cancellations, one when the activity is stopped and one when it is
destroyed but when the second cancellation happens the loader has a
bad state that it is loading while it is not and a NPE occurs.

2. If a rotation happens early before the print activity is fully initialized
(there are asyncrconous operations that take place) we get a NPE as
the print preview controller is not created yet.

3. A lockup of the print preview process occurs if the print print
activity is destroyed after we initiated binding to the rendering
service but before we receive the remote interface. In this case no
remote service is received as exepcted since we already unbound from
it resulting in a missed signal.

bug:18238590

Change-Id: I81817d81702f649ded97dfbab7d7bba28f22fa91
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.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/ui/PrintActivity.java
93134ce87e7b33e599c9ef9ed8b19ec2556ca8f1 31-Oct-2014 Svetoslav <svetoslavganov@google.com> Merge "Save to a PDF file should look like print preview." into lmp-mr1-dev
bec22beb99b279d381f720d761ca75fe3e7414dc 25-Sep-2014 Svetoslav <svetoslavganov@google.com> Save to a PDF file should look like print preview.

When rendering a PDF file for print preview we take into account
the selected print options such as paper size, orientation, etc
without modifying the document. To print we send the doc in its
original form and the print options so the print service can apply
the necessary transforms in addition to the optional custom options
it supports. When saving to PDF we have to actually change the
document as we act as a print service.

bug:13545980

Change-Id: Icdcecf962bec6ff742cc6015df5af9d9086ce760
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.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/ui/PrintActivity.java
9920a0dcf15ba2036cdcc5d6548efa6b4a8bc944 24-Oct-2014 Svet Ganov <svetoslavganov@google.com> Merge "Set copies to one when saving to PDF." into lmp-mr1-dev
45e50e99cdb10b43b062612c2e87e75841f2c424 23-Oct-2014 Svet Ganov <svetoslavganov@google.com> Set copies to one when saving to PDF.

One can save only one copy to PDF. Showing more that one copy when saving
to PDF enven in a disabled input box is confusing to the user. We now set
the copies to one when the PDF printer is selected.

bug:17631303

Change-Id: Ia04d144efc899e7f3836c19349d9c87f3ae8f0f0
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
0c8e15c016efa64cc8db6a1f1fbcade34543cf3f 15-Oct-2014 Svetoslav <svetoslavganov@google.com> am 60cdb909: am 0a1ffdb3: Merge "Handle if the printing app is killed while saving to PDF." into lmp-dev

* commit '60cdb909304f0d4b93a1a17228bdcc888f16cf41':
Handle if the printing app is killed while saving to PDF.
05e041b013d8750a66787f5f7eb77c7ec95a670f 14-Oct-2014 Svetoslav <svetoslavganov@google.com> Handle if the printing app is killed while saving to PDF.

When saving to PDF we bring up the file picker UI which covers
the print UI. In this case the printing app may get killed as
it is not in the forground (the system is bound to the print
spooler so it cannot get killed). If that happens we are ending
up with an empty file. However, if the file chooser UI is up
we already have everything from the app we need and it dying
does not matter. This change takes care if ignoring printing
app death while saving to PDF.

bug:17922948

Change-Id: I10d808e3c3e93e850dbc2a948f2482381a887928
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
2eb7fadcd64120f0e94ebb0f91188900e916c559 02-Oct-2014 Svet Ganov <svetoslavganov@google.com> Custom print settings cannot change resolution.

bug:17677133

Change-Id: Ib8a24101f12d431fe221c1e91711d93a6a517273
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
922fcc2f9e2370b34672af0e91e5754c6f8d6da7 28-Sep-2014 Svetoslav <svetoslavganov@google.com> Merge "Crash in print spooler if save to PDF selected early." into lmp-dev
e1dcb397d595c110faadaae6bab861bae97717b8 27-Sep-2014 Svetoslav <svetoslavganov@google.com> Crash in print spooler if save to PDF selected early.

The first issue is that the save to pdf button is enabled
before the first layout completed and at this point we do
not know anything about the document. The second is that
if a layout is in progress and we select save to pdf we
end up starting the documents UI twice and finishing the
second instance carshes the spooler.

bug:17676878

Change-Id: Id0b1f06e4d377347286c2dde09669d431441234b
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
528424c26cb118a68f77cef94992a0282cfdc12c 27-Sep-2014 Svetoslav <svetoslavganov@google.com> Fix carsh in print spooler if custom print setings return bad pages.

The custom settings activity of a print serivce can change the selected
pages and the spooler was not checking whether the returned pages were
valid leading to a crash.

bug:17678553

Change-Id: Id8ea3d482d2909b97a06752d61b416dfe5948483
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
09eb0b203329b1d846de227a8b03774c903b86f0 24-Sep-2014 Svetoslav <svetoslavganov@google.com> Merge "Fix ANR in print spooler." into lmp-dev
56683481381003325481143af15d519c1bf0148f 24-Sep-2014 Svetoslav <svetoslavganov@google.com> Fix ANR in print spooler.

Saving to PDF a subset of the pages requires trimming the
undesired pages and when this is done writing the ready doc
to a URI. To write the file to URI we have to obtain it but
it is aquired by the shredding task and never released. Now
we are releasing the document immediately after trimming it.

bug:17631301

Change-Id: I4db7966c65c75f0f14c3cb52fd83b4d8fd5a4687
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
254361f136aa9461e16f11f0170fde05e83a1b92 24-Sep-2014 Svetoslav <svetoslavganov@google.com> Print spooler crash on back before first layout is complete.

If the user presses back before the remote print document
update has completed we get a crash. The reason is that
after the update completion we were trying to finish the
activity if we are in a cancelled state but this is not
needed as we aready handled the back key so we will finish.
Handling finish twice was creating the problem as classes
with lifecycles are not designed to be used after being
finished. In particular, we were calling doFinish() twice.

bug:17630561

Change-Id: If418f237a2def7c8e4a072ac8826283f4dd7fc85
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
9424b733c7f777fc806a751a7f00d234c11c0e7c 19-Sep-2014 Svetoslav <svetoslavganov@google.com> Fix a print spooler crash when printing.

The spooler communicates with he remote PDF renderer asynchronously.
When print is confirmed we close the renderer, destroy it, and unbind
from its service. If we unbind from the service after the print activiy
is finished we get a crash. The bug was that we did not wait until we
disconnect from the remote renderer before finishing the print activity.

bug:17583115

Change-Id: I55b0135f9c5658b3a4fda2901b8b3bdef044e211
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
b75632c7366d3c848a5d31782d9942dd2818adcb 18-Sep-2014 Svetoslav <svetoslavganov@google.com> Print UI stuck when backing out of documents UI.

When user chooses to save to PDF we open the document chooser UI.
Now if the user now backs to the print UI without choosing a file,
the print UI has all options disabled and the back button does
not work - the user is stuck. This is because we were not
transitioning the print UI in the correct state.

bug:17557454

Change-Id: I385129e106ed41564b89137ca54d409127ba8ff0
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
7fd5ada98aa9e035682531d9fe25633fdd24a058 16-Sep-2014 Svetoslav <svetoslavganov@google.com> Page content sometimes disappears when scrolling a long doc in print preview.

The operations of the remote renderer have to be performed in order, open,
render some pages, close. One of the tasks was executed on the wrong executor
resuling in a race and an occassional bad state.

Also fixed a NPE if the preview list is flinged and then the user presses
back.

bug:17537922

Change-Id: I5048078ba2b875a2a8335f3a4324afaa34d014a2
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
e9f275d309bfe314921dba51dd7c90686f2748bf 16-Sep-2014 Svetoslav <svetoslavganov@google.com> Merge "Print preview disappearing on screen off/on." into lmp-dev
d724a40136f168251f6f62e5a51ad73bf8fe5d1e 16-Sep-2014 Svetoslav <svetoslavganov@google.com> Print preview disappearing on screen off/on.

We were not clearing the tracked printer when the print activity is
paused and then not setting the tracked printer when the activity
is resumed.

bug:17525271

Change-Id: Ib0fb29006bfcf5ad03dce24b3407cd96dc421442
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
23d3361e1747ee286157f9c61c3d02e6e20cac58 16-Sep-2014 Svetoslav <svetoslavganov@google.com> Do not change fragments if print activity finishing.

It is possible that we try to switch framents after the print
activity finish method is called. In this state the activity
is going away and trying to perform a fragment operation throws.
Now if we are finishing no fragment opration is performed.

bug:17520007

Change-Id: I0dd935d3cdaeddca31fccf49bd5de97e878abb9d
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
56bdeeeb80d31d2c299a7e55b233658b5bc6fe01 16-Sep-2014 Svetoslav <svetoslavganov@google.com> Merge "Page shredder callback invoked on the wrong thread." into lmp-dev
fb3532eea391574cda69cae274915e9e1a7b6cf2 16-Sep-2014 Svetoslav <svetoslavganov@google.com> Page shredder callback invoked on the wrong thread.

The code executed in the shredder completion callback must
be called on the main thread but instead it was called on
another one. This led to a crash.

bug:17514533

Change-Id: Id9e86d38a90fedadc60f967b193470fd83eb3362
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
e0fa06c088ea95a01c0219e9711c3bcc93ad2685 16-Sep-2014 Svetoslav <svetoslavganov@google.com> Update print preview when a printer becomes available

We laizily request printer capabilities and when they are reported
we were not updating the preview and as a result the content was not
rendered, hence pages showing an empty state.

bug:17514117

Change-Id: Icfee7eaa1ab63f5e4d7655d4057ef2110c27cd43
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.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/ui/PrintActivity.java
e03ddd0bcc683b31f155bfd96f543c38539abf44 11-Sep-2014 Svetoslav <svetoslavganov@google.com> Merge "Fix a crash in print spooler." into lmp-dev
3ef8e203c887a0cf6c121fdbb428e2fcef21758a 10-Sep-2014 Svetoslav <svetoslavganov@google.com> Fix a crash in print spooler.

1. Leftover code was setting the state to configuring
before initialization is complete.

2. We were not cancelling the print job if cancelled
when initializing.

3. The remote print document was cancelled even if
doing nothing.

bug:17451600

Change-Id: I79a80b723af8537da260012470748b4e8831fd9e
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
e652b02d45bbda11c9cb8f663fa7f25903b90225 10-Sep-2014 Svetoslav <svetoslavganov@google.com> Accessibilty support for the print UI.

bug:15816751

Change-Id: I5dcdbdd0357843b870ddd47d7c41cfba114d194c
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
62ce332c141cf7bc7200c4c87d63e395874fc3ec 05-Sep-2014 Svetoslav <svetoslavganov@google.com> Trim unnecessary pages when printing.

A user may request a subset of the document's pages to be printed.
In this case the expectation is that the resulting document does
not include not selected pages. While print serivices can do the
trimming themselves or the printer may do so, moving, potantually
many, redundant pages is inefficient. The real problem is when
saving to a PDF file where the saved file must not have the pages
the user did not select. This change adds shredding of undesired
pages from the PDF before saving it or passing it to a print service.
:
bug:17285994

Change-Id: I7deba535af99457bea3c118202314f0f3812e809
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.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/ui/PrintActivity.java
561b8931742503d58ae842edea790e86f359870f 02-Sep-2014 Svet Ganov <svetoslavganov@google.com> Merge "Move print rendering in an isolated process." into lmp-dev
13f542cabd635c55ade5442764cc4a3d2f7880ea 30-Aug-2014 Svet Ganov <svetoslavganov@google.com> Move print rendering in an isolated process.

Security review of the PDF rendering code revealed that it is
not sercure. Therefore, this code must be run in a sandbox.
This change moves the rendering code in an isolated process.

bug:16897933

Change-Id: I711ce42a56892db1837950137bfaa79e1d61a7c4
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
c404cacd3a480776dd625fb300810ffccc5f51b0 28-Aug-2014 Svetoslav <svetoslavganov@google.com> Print UI polish.

1. Fixed an issue where input focus is given to the copies
edit text every other time we expand the options UI. We
want focus there only if the user touches the control.

bug:16966145

2. Fixed the all printers list view to have item dividers
reaching the left and right ends of the list view.

bug:17288761

3. Fixed an issue where the user can deselect all pages
which is not only an invalid state but also causes a crash.

bug:17286198

4. Tweaked the minimal size of the preview in landscape on
phone to better accomodate the page.

bug:17288904

5. Fixed a regression introduced by a change from the UI folks.

Change-Id: Ida7dad7eea413295a840028060810b2619c616e8
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
3c238245eb3c0a7371fb25b6e96be0a0056a638d 19-Aug-2014 Svetoslav <svetoslavganov@google.com> Update the "More options" button in printing.

The "More options" button needed changes to match the
new UX spec. Also fixed some identation issues as well
as a missing marging in the erorr UI.

bug:16301066

Change-Id: I29f0d41915d1816d754f2c6288a7387aafeba2c2
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
38781bd2c2c61385651314098b4a615cb8e8efa1 12-Aug-2014 Svet Ganov <svetoslavganov@google.com> Fix some minor print UX bugs.

1. The last row of print options was not visible on a phone.

2. The preview page size on a phone in landscape unusably small.

3. Updated the Save to PDF icon.

bug:16966145

Change-Id: I25ce1572758c62f34344683af2452fb045bb857e
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
b59555ca743118c45103c0c11aedeefb8893f0f0 24-Jul-2014 Svetoslav <svetoslavganov@google.com> Print to PDF putting a pring job in a wrong state.

When printing to a PDF file we get a Uri from the storage APIs
and write the content. Once the file is written to storage the
print job is completed and there is print service involved. Th
spooler was wrongly putting the job in a failed state instead
of a complete state.

bug:16522267

Change-Id: I4741c9b9eb763e118e7dfb2c7c502bd7fc13f7a1
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
5ef522bc19cc9fc1af48cccd2865744228c5ec02 24-Jul-2014 Svetoslav <svetoslavganov@google.com> Handle wrong file format when printing.

PDF is the only format suppored for printing but a buggy app
can write content in another format which was crashing the
print spooler. Now we are generating an error instead of
crashing.

bug:16487161

Change-Id: Ic59d2ac6d57213f4e8f364659d8dc7df2140e61d
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
f8ffa567b5ac418b72268ae01fe8401b801268c7 24-Jul-2014 Svetoslav <svetoslavganov@google.com> Updating the save to PDF button icon.

Change-Id: Ie62a22d6e16d15426f10afa0512b0083c52ff507
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
73764e347d387657b3e2f8027d135de612cf454f 16-Jul-2014 Svetoslav <svetoslavganov@google.com> Update the page count in the print UI to meet new UX.

bug:15912257

Change-Id: I1aa3eb4f7e28d3d9c955f60a570c2f8800fdb88d
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
48fec5c9a3e4d78bc4cd175fae05be153ac587af 14-Jul-2014 Svet Ganov <svetoslavganov@google.com> Top printer not properly selected.

We keep track of historically used printers and when the print dialog
is opened we load them. We were selecting the first printer before the
historical ones are loaded which led to a case where the PDF printer
is selected and then a better printer appears but we have the PDF one
selected.

Also we were asking the printer spinner for the current printer but
if the data set of the adapter changes and we ask the spinner for the
selection we get a wrong answer because the adapter and the view are
off sync since the view is updated on the next message.

Change-Id: I0c12d2d3b19227a8f6af6e421b92013ec06cc021
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
15cbc8a03250eafdf947cd8ad4e77f34444d5ba4 11-Jul-2014 Svetoslav <svetoslavganov@google.com> Addressing comments for the print preview feature.

Change-Id: Ib72140a912e22f859258d970e0d1c4ef06e807d5
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.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/ui/PrintActivity.java
e3bbb3d6c09a29cddeb544308e5b3210908fa256 12-Jun-2014 Svetoslav <svetoslavganov@google.com> Fix NPE in PrintActivity.

It is possible that the orientation is chosen before the media size.
The code handling orientation change was wrognly expecting to have
a selected media size all the time resulting in a NPE.

bug:15512333

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

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