History log of /frameworks/base/packages/PrintSpooler/src/com/android/printspooler/ui/PrinterRegistry.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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/PrinterRegistry.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/PrinterRegistry.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/PrinterRegistry.java
139ba7fb0ed976bdbc7c283e3f7fe9980eed22a6 12-Sep-2014 Svetoslav <svetoslavganov@google.com> Fix a crash in print preview on multiple rotations.

bug:16966145

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

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