History log of /frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ada5a047baefa5f4a857ac67aabe7c3a870dc3c7 08-Mar-2016 Philip P. Moltmann <moltmann@google.com> Update printers even if there are no printers found.

It can happen that before we stopped we reported a set of printers. Then
while the loader is stopped, we lost all printers. Then on re-start we
need to tell the clients that there are no printers anymore.

There is one issue: The fused-printers-provider might be started
before the printer registry is fully created. In this case we get a callback
and get all king of NPEs. Hence enqueue the first load behind the
current thread. This makes sure that the current operation - creation of
the printer registry - is finished.

Bug: 27643300
Change-Id: Ife6993d57457f23a0a4a54a11869c742c05da850
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.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/FusedPrintersProvider.java
76d7e3ee70c4299b22b1a03505d2b4f108716c75 15-Jan-2016 Philip P. Moltmann <moltmann@google.com> Check parameters for callers of IPrintManager

- Propagate nullness and non-null-ness up and down from the interfaces.
- Add non-CTS print tests for IPrintManager binder.

Change-Id: I0c310d9cea8aefba5ce386931521ffaf19712bbb
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.java
9b99d76a7141f782f12cc3e78aa45e2cd4a4a097 09-Jan-2016 Philip P. Moltmann <moltmann@google.com> Do not add far favorite printers more than once.

The favorite printer list contains a printer multiple times as it might
have been used at different locations. Hence it can be that a printer is
in the favorite printer list multipe times but never considered close.

Hence we go into the second loop and add it multiple times as we never
add it to alreadyAddedPrinter.

Change-Id: I4ca8a6a5a05f43645a0b2c891a55df2ccce05ad4
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.java
98963260dc30f1dc3e89dbd0efdfcdc6398d753c 17-Dec-2015 Philip P. Moltmann <moltmann@google.com> Prefer printers that have been used physically close to the current
location of the user.

Commonly the users prints on a printer that this near the user current
location. Hence if possible we want to show the user printers that he
used before and that are close to him.

Hence store the location of the previous uses of a printer and prefer
printer that are close to the user.

Unfortunately getLastLocation might not report a usable location and it
will take at least 5 seconds until the first usable location arrives. At
this time the user might have already opened the destionation spinner.
It would be unexpected for the printers to suddenly change under the
users finger. Hence it might be that we did first show the printer
without any location information and then once the location is known we
cannot update thedestination spinner anymore.

The select printer activity does not have this issue, hence in the worst
case the user has to enter this activity to select a printer and by then
the location is usually determined.

This is not ideal but better than before.

Bug: 24133609
Change-Id: Ie7d20cf3d9dd163e57903f8f6ecc0b3fd4f4374e
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.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/FusedPrintersProvider.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/FusedPrintersProvider.java
9e9e2e73c6ec7bece20268196dc89ad0c8bafad4 08-May-2015 Wojciech Staszkiewicz <staszkiewicz@google.com> Pass charset to XmlPullParser.setInput instead of null

Passing null to XmlPullParser.setInput forces it to do additional
work, which can be easily avoided if we know the charset beforehand.

bug: b/20849543

Change-Id: Iaff97be9df2d0f99d7af8f19f65934439c9658e2
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.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/FusedPrintersProvider.java
2916f658c9a55aa5b08a3bbe3056dbfd78e0e1b0 24-Oct-2014 Svet Ganov <svetoslavganov@google.com> Sometimes historical printers not properly ordered.

We order printers based on past usage. In some cases the ordering
does not work. The reason for that was an incorrect assumption that
the entries in an ArrayMap are ordered in the order they are added.

bug:18109283

Change-Id: Ie367e4ca5e6bd79f335a060074c9211054e3a931
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.java
25885ecbe4306165872c1b24628e9646778a0535 14-Jul-2014 Svet Ganov <svetoslavganov@google.com> Rename historical records if printer name changed.

We keep track of previously used printers. It is possible that the name
of a previously used printer changed. In this case we want to change
this printer's name in the historical records to be able to show the
correct name in the UI when loading the history.

bug:13524346

Change-Id: I0a37bd52a564df5a84c816abfcf03db83de93b97
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.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/FusedPrintersProvider.java
a798c0a984f29f7180883a61839f68d2cbf0c6ce 15-May-2014 Svetoslav <svetoslavganov@google.com> Refactor printing

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