1. Sometimes selecting a printer from the full printer list does not
work if the selected printer was not in the initial drop down list
of the print dialog.
The reason was that there is a race. We use loaders in the print
dialog activity and the all printers one. When these loaders are
stopped we stop printer discovery since we do not want to keep this
potentially expensive process on going if the activity is paused
because say the user decide to press home and start playing his
favorite game while the printers dialog is up. As a result the
loader does not get printer updates until it is started.
The loader of the print dialog activity is stopped while the user is
selecting a printer from the all printers activity whose loader is
getting discovered recent printers. Now when the user selects a printer
the loader of the print dialog activity is started but may not get
the latest printers by the time onActivityResult is called with the
selected printer. Now we cache the selected printer id and if the
loader reports it we select that printer.
2. In the print dialog we show only a few of the discovered printers.
If the user selects a printer from the all printers activity that
is not in the initial list we shuffle the adapter data to make sure
the selected printer is in the shown subset. Now if the printers
change, i.e. the printers loader reports new result we were not
respecting the reshuffling made before so the short list of
printers changes yet again.
bug:11034216
Change-Id: I54fe3619e3328b65839d9f4b02309699eae7f8eb
The user can select all printers from the print dropdown to get to
a search for printers activity where one can filter out the list
of a available printers. We did not have an empty state UI for the
case when the query yields no printers.
bug:11009053
Change-Id: I6b45517b8a7b319992019a1bf65858319a19a0de
When loading historical records for previously used printers we
now ignore the ones whose target print service is not installed.
bug:10955652
Change-Id: Ib295e7d88ed3c308ef6d8a11bdc1792ebbb6d526
1. We want the files for a print job to be removed as early as possible
typically because the print job was cancelled, completed, the app
or the spooler crashed during print job construction. We were keeping
around in the spooler and hence to disc infos for jobs that are in
final state since the app that created them may hold a reference to
a local print job objec whose info it can access to get the latest
print job state potentially after the job reached final state. The
issue was that we were persisting to disc created print jobs which
were during construction which requires careful handling for the
various cases above. This is tricky and error prone.
We used to tell the spooler to forget the print jobs infos when the
app that created them died. The implementation to forget a print
job was not careful and was nuking currently running print jobs in
addition to the ones in a terminal state. Further, if the app dies
before a print job is completed we were left with a stale print
job in the spooler since we missed the signal to forget it (assuming
we forget only inactive jobs). These issues suggest that the approach
is problematic.
Now we have a cache of print job infos for the jobs an app created.
This cache is updated when the state of a print jobs changes using
the new print job state observation code. When the app dies we
remove the cached jobs for that app. Now if the app calls to get
the print jobs it gets the cached ones, i.e. the print jobs it
created during its lifetime, plus the print jobs that are still
active fetched from the spooler. Note that transient state cannot
be kept in the spooler since we unbind from it if there is no
work and it may get killed.
2. Improved the print sub-system logging code to show the cached
print job infos for apps and also dump the print job PDF file
names.
bug:10958357
Change-Id: I6f7c1968b6b7ba5be182a10df044ff7ea1fc3a61
A print service may choose to provide only the printer info and then when
it is requested to start tracking the state of the printer, the service
should provide the printer capabilities. If the capabilities are not
received within ten seconds we mark the printer as unavailable and stop
tracking it.
bug:10748639
Change-Id: I9171cb5dc116fd321c23a8e4ab55109448e2fc6a
1. The printers in the printers list of settings change position if
they are updated. The settings app is using hidden platform APIs
the this change fixes.
2. Enable ProGuard for the PrintSpooler.
3. Added icons on the list of printers so the user knows which
print service used the printer. Now the user can know when
he is using cloud print and maybe incurring data costs vs
local printer discovered by a vendor plug in.
bug:10955751
Change-Id: I292f48b424cb561218fdb424d0388f4d786d8339
1. In the FusedPrintersLoader we start observing the printers on
the device and if they change we send the result. If however,
the printers are already loaded in our session (because it
joined an ongoing printer discovery) and the pritners do not
change, the loader never sends its result. Now we are registring
the callback only after historical printers are loaded. We
also immediately check after starting discovery whether the
there are printers in the discovery session and if so deliver
them.
2. Improved logging in the FusedPrintersLoader.
bug:10940712
Change-Id: Ieb9b897d64780742125b29309462dea3eda170a6
1. If the printer is unavailable we should not allow the user
to select it. Rather, show it grayed out.
2. Some string changes requeted by translators.
bug:10917222
Change-Id: I370f05f9c8e70e3f077db7eb02cf48e19a59925d