History log of /frameworks/base/services/java/com/android/server/print/UserState.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
b4fda134761c9521a7e127db3806a07a18763b77 26-Oct-2013 Svetoslav <svetoslavganov@google.com> Complete implementation of the advanced print options.

1. Implemented the advanced printer options integration. Now a print service
may declare an advanced print options activity which may be launched by
the user if the current printer supports advanced print options. These options
are visible only to the print service that added them and it is the only party
that will interpret the options.

2. Fixed a couple of bugs in the saved print jobs parsing. One was that if there
are more than one page range, a half of the print job properties was not
properly parsed. The other was that the media size constructor was using
incorrect argument order, thus creating a media size with wring width.

3. Fixed and edge case where old print jobs and their docs can get stuck in
the spooler. If the app did not write the requested pages we were not showing
an error message, rather just finish the activity without canceling the print
job and this print job is stuck in the spooler. Now we show an error message
and the user may retry, cancel. If the user cancels the print job is also
cancelled, thus no leftover in the spooler.

4. Fixed the background color of the print dialog to meet UX spec.

bug:11241800

Change-Id: I352440bc86aec824a805883fc9579d96a06d11e6
/frameworks/base/services/java/com/android/server/print/UserState.java
4a82b455f9832430207e3ecfddfad4b67b071407 13-Oct-2013 Svetoslav Ganov <svetoslavganov@google.com> Printing from secondary user not working.

The last refactoring of how the print dialog activity is started moved
the code that creates the pending intent from the spooler which is a
per user app to the system process but failed to create the intent
for the right user. Also the code in the print manager service that
puts a notification for a newly isntalled print service was not taking
into account the current user.

bug:11199393

Change-Id: I64ecf9dc1457ec4d58cc1a62e53735bb0793a003
/frameworks/base/services/java/com/android/server/print/UserState.java
9b6d3a153f44010a75907c6a9742c89a57d4e5ee 12-Oct-2013 Svetoslav Ganov <svetoslavganov@google.com> Fail only scheduled print jobs, i.e. handed to a service, if the service is disabled.

When a print service is disabled we assume all print jobs for it failed as we have
no way to know what happens to them. However we are also failing created print jobs,
i.e. ones not given to the service. Such jobs are in process of construction and
the print dialog is up. We should not fail such jobs as the dialog can still modify
their state and potentially select a print from a different service. Therefore, we
leave them alone and they will be failed if when constructed are passed to a
disabled/uninstalled service.

bug:11197432

Change-Id: Ie4fe54327e3e25776b1dd572be2dfafdd700c2e5
/frameworks/base/services/java/com/android/server/print/UserState.java
7bfbbcb04bf4ba8f3069b2df136f708c9849bacf 10-Oct-2013 Svetoslav <svetoslavganov@google.com> Refactor how the print dialog activity is started.

1. Before the print job activity was started asyncronously with
respect to the print call on to the print manager. This was
creating a situation where the starting activity may finish
before the print dialog appears which may lead to an orphaned
print document adapter with no data to print (as the UI is
is gone), or strange behaviors where the print dialog starts
on as a separate task.

To address this the pending intent for starting the print
dialog is not started by the print spooler since we cannot
call into it synchronously as we have to start its process
and bind to the spooler service which leads to jankyness in
the client app. Now the pending intent is created by the
print manager service in the synchronous print call so
from an app's perspective calling print starts the activity.

The side effect of this design is that the print dialog
activity may start before the system is bound to the spooler
service. In such a case the print activity cannot start
poking the print spooler state as the system registers
callback to observe the spooler state. To address this
the print spooler activity disables the UI and also binds
to the spooler service which happenes immediately after it
is started. As soon as the print dialog binds to the
service it starts the UI.

2. Fixed an bug in the printer adapter of the print dialog that
was leading to a crash if the only item in the adater is the
all pritners option and it is selected.

3. Piping the package name that started the printing so we can
pass it to the storage UI as a hint to open the last location
the app used.

bug:11127269

Change-Id: Ia93820bdae0b0e7600a0930b1f10d9708bd86b68
/frameworks/base/services/java/com/android/server/print/UserState.java
a18661d5922e5ae24ccce8e815aeba437a2fba82 10-Oct-2013 Svetoslav Ganov <svetoslavganov@google.com> Coalescing multiple print job notifications.

1. We used to show a single notificaiton for every print job but
this is against th UX guidelines. Since we have to lead by
example, this change adds coalescing of multiple notifications.

bug:11155212

2. Print job state callback in the PrintManager now correctly
invoked on the main thread.

bug:10983508

Change-Id: I906e9e62198fa37cb4d2f71fce07ed475d61e1bd
/frameworks/base/services/java/com/android/server/print/UserState.java
b450d0d4d7fca16674fea02f15e21dc737352c40 05-Oct-2013 Svetoslav <svetoslavganov@google.com> Small print API tweaks

1. Removed an unused public constant

2. Hide PrintFileDocumentAdapter which makes doing the wring
thing easy.

3. We allow a print service to set a tag of a print job which is
an arbitrary string it only knows how to interpret. Typically,
this is the id of a remote print job. This tag was visible to
applications which is wrong - this is data that should be
private to the print service. Now the print service is the
only one to see that.

bug:11084635

Change-Id: I763ea9ff0fdf647805bc36e1737d72263090714d
/frameworks/base/services/java/com/android/server/print/UserState.java
db85ad56adb74f0310b604228dac8bbc03ac2769 01-Oct-2013 Svetoslav Ganov <svetoslavganov@google.com> Fail print jobs targeted to unavailable services.

It is possible that a print job is scheduled for handling, i.e. it is
queued, after the target print service is uninstalled or disabled.
In case like this we fail the print job with an appropriate error
message. Now the user can cancel the job when he/she sees the notification
or the status in the print settings. Trying to restart such a job will
end up failing it again with the same error message. So the user will
just have to canel the print job.

This apporach quarantees that the user is informed for the failure and
also is much simpler than trying to update the UI when print job's
target serivce is uninstalled. For example, the settings UI has to
be updated as well as the notifications. Also due to the async nature
of the system this we cannot completely avoid having a restart option
for a print job whose target service is gone. This scenario is very
unlikely but still we have to handle it.

bug:11012251

Change-Id: Id8c8c3cff75e0b6325552676b130ff1406edc069
/frameworks/base/services/java/com/android/server/print/UserState.java
d8dbc13b47bec3248a86a505a30af9d0474240dc 28-Sep-2013 Svetoslav <svetoslavganov@google.com> Ignore historical printer records for installed services

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
/frameworks/base/services/java/com/android/server/print/UserState.java
dd68da2741fa63070d5ad206020dcccb9f429a5a 27-Sep-2013 Svetoslav Ganov <svetoslavganov@google.com> Print job files and print job records not always cleaned up.

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
/frameworks/base/services/java/com/android/server/print/UserState.java
704697b6197262678e930daa831a1916ddee4dcf 22-Sep-2013 Svetoslav Ganov <svetoslavganov@google.com> Adding hidden APIs for observing the print jobs state.

This is needed for implementing the print job settigns UI.

bug:10935736

Change-Id: I63b42cbf4ce6a259fa1af47fa368b148ca5621c1
/frameworks/base/services/java/com/android/server/print/UserState.java
b5f180608db6de123b54ae94de569ff1ebca705c 24-Sep-2013 Svetoslav <svetoslavganov@google.com> Multiple printer discovery session instances and other bugs.

1. The fused printers provider was dropping on the floor received printers
if it was not active. It is in fact a loaded and if not active it should compute
the printers and not deliver them until activated. This fixes an issue where
opening the print dialog, then enabling a print service results in the printers
reported by the service not showing up in the print dialog.

2. Printer discovery session was created twice which leads to incorrect behavior
as the pint system is designed around the contract that there is a single
printer discovery session per service at a time. This was possible due to an
incorrect initialization of a member variable resulting in double session creation
when the print service is connected.

3. When a print service is enabled during discovery we did not use the correct
condition to start printer discovery resulting in starting it all the time even if
not needed. Also if some of the printers that had to be tracked are reported
by the service just enabled (typically historical printers) we did not ask the
service to start tracking them.

4. Removed some logging.

bug:10903343

Change-Id: I46c049471a4b099fc668df3aee2aaedc8d7786ac
/frameworks/base/services/java/com/android/server/print/UserState.java
2fbd2a7f070f246ddafd9de94efa9a98861e9136 17-Sep-2013 Svetoslav <svetoslavganov@google.com> App UI freezes when printing. API clean up.

1. The UI of a printing app was freezing a little when calling the print
method since the print manager service was waiting for it to bind to the
print spooler which generated the print job id (and the initial print
job info really). Now the print manager service is responsible for job
id generation and does not not wait for the print spooler to spin. Hence,
the app UI is not blocked at all. Note that the print manager initiates
the binding to the spooler and as soon as it completes the spooler shows
the print UI which is hosted in its process. It is not possible to show
the print UI before the system is bound to the spooler since during this
binding the system passes a callback to the spooler so the latter can
talk to the system.

2. Changed the print job id to be an opaque class allowing us to vary the
way we generate print job ids in the future.

3. The queued print job state was hidden but the print job returned by the
print method of the print manager is in that state. Now now hidden.

4. We were incorrecly removing print job infos if they are completed or
cancelled. Doing that is problematic since the print job returned by
the print method allows the app to query for the job info after the
job has been say completed. Hence, an app can initiate printing and
get a print job whose state is "created" and hold onto it until after
the job is completed, now if the app asks for the print job info it
will get an info in "created" state even though the job is "completed"
since the spooler was not retaining the completed jobs. Now the spooler
removes the PDF files for the completed and cancelled print jobs but
keeps around the infos (also persisting them to disc) so it can answer
questions about them. On first boot or switch to a user we purge the
persisted print jobs in completed/cancelled state since they
are obsolete - no app can have a handle to them.

5. Removed the print method that takes a file since we have a public
PrintDocumentAdapter implementation for printing files. Once can
instantiate a PrintFileDocumentAdapter and pass it to the print
method. This class also allows overriding of the finish method to
know when the data is spooled and deleted the file if desired, etc.

6. Replaced the wrong code to slice a large list of parcelables to
use ParceledListSlice class.

bug:10748093

Change-Id: I1ebeeb47576e88fce550851cdd3e401fcede6e2b
/frameworks/base/services/java/com/android/server/print/UserState.java
de4fa2dfe2e681c79e27d84604b9c48c68184aef 14-Sep-2013 Svetoslav Ganov <svetoslavganov@google.com> Print system may get stuck bound to a print service

1. If a print service dies, is restarted and at the time of the
restart the service has neither print jobs nor a discovery
serssion it gets stuck into a bound state. Now it unbinds if
after binding and ensuring it is in the lifecycle state right
before the death there are no active print jobs and no discovery
session.

Also when a print service dies we fail all of its print jobs
but did not update the service that all of its print jobs are
handled, i.e. it has no active print jobs.

2. Fixed a null pointer exception in UserState

bug:10696723

Change-Id: Id0a67846093fca5d4c1e10843eaf6aa90169d942
/frameworks/base/services/java/com/android/server/print/UserState.java
860f8a6b663ca96d30d17da09eca8caf065aae62 14-Sep-2013 Svetoslav Ganov <svetoslavganov@google.com> Spooler should not crash if print service config activities are not exported.

1. If a print service does not export its activities for settings and
adding printers the print spooler ignores them instead of crashing.
Also if the service is not enabled its activities are now ignored.

2. Added a dedicated permission for a print service to optionally
protect its settings and add printer activities such that only the
system can bind to them.

3. Fixed a crash in the print dialog if its content is detached
from the window and animators are running.

bug:10680224

Change-Id: I20b57d6622a15f9b2352ba78d04c44e67b316a15
/frameworks/base/services/java/com/android/server/print/UserState.java
651dd4e6ee6510caf9f15c51094a11121af17ec2 12-Sep-2013 Svetoslav <svetoslavganov@google.com> Remove unneeded print APIs and update the min margins APIs.

1. Removed unneeded code in Resolution that was storing its
label as resource and package name. We do not have predefined
resolutions, therefore we always persist the label.

2. Renamed the print attribute margins to minMargins to reflect
that these are the minimal margins the printer support. Updated
the docs as well.

3. Renamed the create method of all builder to build.

bug:10727487

Change-Id: Ie72ab8aaa5215b8bd2853885011b3b4efa4deb2e
/frameworks/base/services/java/com/android/server/print/UserState.java
c6066799ad130140159230d14451b429eb828755 11-Sep-2013 Svetoslav <svetoslavganov@google.com> Handle print serivce crashes.

1. Now after a print service crashes we are bringing it to the same
state of its lifecycle. For example, if a service does a discovery
and crashes we recreate the discovery session call the start
discovery method and so on.

2. Turned off debugging logs since we have fully fledged state dump.

bug:10697779

Change-Id: Id790537461428e96b197eef12258996bda2bd1ce
/frameworks/base/services/java/com/android/server/print/UserState.java
b669917825a49421ee79be4819ead765f5de8aae 08-Sep-2013 Svetoslav Ganov <svetoslavganov@google.com> Add dumping the state of the print sub-system.

Being able to dump the state of the print sub-system especially when
taking a bugreport is very useful for bug fixing and observing whether
the print system operates properly.

bug:10659019

Change-Id: Id098b788f474ab17766966a4563ffdfc0171c76b
/frameworks/base/services/java/com/android/server/print/UserState.java
4e4518383f9212618cafa6c9ce2120becc6f6204 06-Sep-2013 Svetoslav Ganov <svetoslavganov@google.com> Printers for a disappearing print serivce incorrectly removed.

The code that removes printers for a disappearing print serivice was
using printer infos instead printer ids and also wrong map methods.

bug:10651739

Change-Id: Idb9ccdaad9a59b3b6d16b079b33afad56bc45255
/frameworks/base/services/java/com/android/server/print/UserState.java
773f54de3de9bce7b6f915aa47ed686b161d77aa 03-Sep-2013 Svetoslav <svetoslavganov@google.com> Print API updated.

1. Removed the updatePrinters API on PrinterDiscoverySession.
Now re-adding a printer updates it.

2. Added getTrackedPrinters() API to allow a print service to
figure out which printers' state should be tracked by the
service.

3. Removed the APIs on PrintDocumentInfo that describe the
layout of the content as they are not needed. For example,
if the print attributes passed in layout require landscape
mode, the the app should just create a PDF page with the
wider side up and draw its content in portrait. The printer
will then rotate the page.

Change-Id: Idd72c6e9c129e8b17eef1236573a99773f8ff0a2
/frameworks/base/services/java/com/android/server/print/UserState.java
9186d0cb2bd325d9b52da15dbd513937c1e42caa 03-Sep-2013 Svetoslav Ganov <svetoslavganov@google.com> Bug fixes in the printer dialog activity and fused printer loader.

1. Fused printers loader was not using the discovered printers to update the
historical ones. Now if a historical printer is discovered we update its state
with the discovered, i.e. most recent, information.

2. Fixed a bug in the destination adapter of the print job config dialog that
was leading to a crash if all printers item is selected when there are no
discovered printers.

3. Updated the add printers asset in the all printers screen.

4. Historical printers were not persisted by the print dialog activity.

5. Reduced the number of printers we send per transation to avoid the binder
transaction size limit. Added sending of printers in chunks in a place
this was missing.

Change-Id: I88b54888360bc0e53b06bd260c2b832d0d6454b6
/frameworks/base/services/java/com/android/server/print/UserState.java
6bd20bc46c762860cac852888df5adf718f2be24 03-Sep-2013 Svetoslav Ganov <svetoslavganov@google.com> System print service enabled after every system reboot

The system was overriding the user on every boot by turing of all system
print services, i.e. service that are on the system image. Now the system
print service are enabled by default only once per user, the user can later
disable them and the system does not override that. We now have a system
setting with the services we enabled once by default so we never do
default enabling again (unless device is wiped).

bug:10594775

Change-Id: Id3129ccfba95bf57375ea9fec0b5ca0e51bda199
/frameworks/base/services/java/com/android/server/print/UserState.java
d26d4898fcc9b78f4b66118895c375384098205e 28-Aug-2013 Svetoslav Ganov <svetoslavganov@google.com> Print spooler security and some new print service facing APIs.

1. Updated the security mode of the print spooler. Now the spooler
is not signed with the system key, it is not a privileged app so if
it gets compromised (PDF rendering is a potential attack vector)
it cannot access dangerous permissions. Also only the system
can bind to the spooler.

2. Added APIs for asking a print service to start and stop tracking
a given printer. This is need for the case when the user selects
the printer and the print service should do a best effort to keep
the system updated for the current state of the printer.

3. Added APIs for putting a print job in a blocked state. A print
service would report the print job as blocked if for some reason
the printer cannot proceed, e.g. 99 pages are printed but there
is no paper for the last one. The user has to add more paper
and the print service can resume the job.

4. Changed the read/write APIs to use ParcelFileDescriptor instead
of FileDescriptor since the latter does not have a clean API for
detaching the wrapped Linux file descriptor when one wants to
push it to native.

5. Added API for getting the size of the printed document so the
print service can avoid handling big filed over cellular network
or ask the user if needed.

6. Now the print services that are preinstalled on the system image
are automatically enabled.

Change-Id: Ia06c311d3d21cabb9e1368f13928e11cd0030918
/frameworks/base/services/java/com/android/server/print/UserState.java
44720af55a8fdf991929983dad5d53c02851dd1e 21-Aug-2013 Svetoslav Ganov <svetoslavganov@google.com> Print UI bug fixing and printer discovery refactoring.

1. Added support for selecting a printer from the all printers activity
that is not in the initial printer selection drop down. The user
initially sees a sub set of the printers in the drop down and the
last option is to see all printers in a separate activity. Some
of the printers in the all printers activity are not shown in the
initial drop down.

2. Refactored printer discovery by adding (private for now) printer
discovery app facing APIs. These APIs are needed to support multiple
printer selection activities (print dialog and all printers activities)
and also the settings for showing all printers for a service.

Now multiple apps can request observing for printers and there is
a centralized mediator that ensures the same printer discovery
session is used. The mediator dispatches printer discovery specific
requests to print services. It also aggregates discovered printers
and delivers them to the interested apps. The mediator minimizes
printer discovery session creation and starting and stopping discovery
by sharing the same discovery session and discovery window with
multiple apps. Lastly, the mediator takes care of print services
enabled during discovery by bringing them up to the current
discovery state (create discovery session and start discovery if
needed). The mediator also reports disappearing of the printers
of a service removed during discovery and notifies a newly
registered observers for the currnet printers if the observers are
added during an active printer discovery session.

3. Fixed bugs in the print UI and implemented some UX tweaks.

Change-Id: I4d0b0c5a6c6f1809b2ba5dbc8e9d63ab3d48f1ef
/frameworks/base/services/java/com/android/server/print/UserState.java
269403b032f965ff3847eb982c2f697229dc5a92 15-Aug-2013 Svetoslav <svetoslavganov@google.com> Implemented advanced printer selection and API refactoring.

1. Added past printer history tracking and merging favorite printers
with discovered printers.

2. Added save as PDF support.

3. Added all printers activity with search capability and optional
add printers chooser (if any print service provides add printers
activity)

4. Refactored the printer discovery session APIs. Now one session
can have multiple window discovery windows and the session stores
the printers found during past discovery periods.

5. Merged the print spooler and the print spooler service - much
simpler and easier to maintain.

Change-Id: I4830b0eb6367e1c748b768a5ea9ea11baf36cfad
/frameworks/base/services/java/com/android/server/print/UserState.java
798bed6cc7d273e72b0253288605db9cd2b57740 11-Aug-2013 Svetoslav Ganov <svetoslavganov@google.com> Refinement of the print service APIs.

1. Factored out the printer discovery APIs of a print service in a
dedicated session object that is created by the print service on
demand. This ensures that added/removed/updated printers from
one session do not interfere with another session.

2. Updated the app facing APIs to pass in a document info along
with a printed file. Also exposed the print file adapter so
apps that create a temporary file for printing can intercept
when it is read by the system so the file can be deleted.

3. Updated the print service documentation.

Change-Id: I3473d586c26d8bda1cf7e2bdacb441aa9df982ed
/frameworks/base/services/java/com/android/server/print/UserState.java
835835ee6f913408ac91678d6056896a2c5b25e3 05-Aug-2013 Svetoslav Ganov <svetoslavganov@google.com> Polish the print spooler loading of stored print jobs.

1. The singleton print spooler isntance is created when the print spooler
service gets a connection to the system and is destroyed when this
connection is removed. Note that if the spooler has work, then the
connection to the system will not be removed.

When the spooler is created, it reads the stored state and notifies the
system which in turn dispatches this to the print services.

When the system connects to the spooler and passes it a connection, we
schedule a delayed check whether there is work for the spooler. We do
not handle this immediately to avoid intermitted spinning on and off
of the spooler process if a client makes a sequence of queries while
the spooler has really no work.

2. Fixed a bug in the NotificationManagerService where adding a notification
and removing it immediately after that does not remove the notification.
The code that is adding a notification is run on a handler thread while
the code to remove it on the calling thread. This creates a race and
erroneous results. Now the removal is also scheduled on the handler.

3. Many small fixes here and there.

Change-Id: I6415c253139fa6616393fbe23c659d031a29e1f6
/frameworks/base/services/java/com/android/server/print/UserState.java
8c43376ea83a67414bd6823a472b76d41160239e 02-Aug-2013 Svetoslav Ganov <svetoslavganov@google.com> First cut of the print notifications.

1. Added notifications for a queued print job, for a started print job,
for ongoing canceling a print job, and for a failed print job. The
notifications for queued and started state have a cancel action. The
notification for failed print job has a cancel and a restart action.

2. Propagating failure message from the print service to the notifications.

3. PrintJobConfigActivity was not setting the initial value for the
print job copies and was not updating the UI immediately after creation.

4. Refactored PrintJobConfigActivity to avoid using the hack to avoid
reaction for item selection change in a spinner for an event that
happened before the callback was registered.

5. Removed the label attribute from PrinterInfo and now PrinterId is
composed of the printer name and the service component name. This
is nice since for restarting print jobs we do not need to store
information about the printer except the printer id which is
already part of the PrintJobInfo's data. Also the printer name
is not expected to change anyway.

6. Allowing cancellation of a queued print job. Also no print job is
cancelled without asking the managing print service to do that.
Before we were immediately canceling print jobs in queued state
but it was possible for a buggy print service to not set the
print job state to started before starting to do expensive work
that will not be canceled.

7. PrintServiceInfo was throwing an exception the the meta-data
XML for the print service was not well-formed which would crash
the system process. Now we just ignore not well-formed meta-data.

8. Removed unused permissions from the PrintSpooler's manifest.

Change-Id: Iba2dd14b487f56e137b90d1da17c3033422ab5e6
/frameworks/base/services/java/com/android/server/print/UserState.java
55b409a97cf6376399a0940313ea852368727d6f 01-Aug-2013 Svetoslav Ganov <svetoslavganov@google.com> Iteration of the print sub-system.

1. Added APIs for adding partially initialized PrintInfo objects
enabling light-weight lookps for print serivces that want to
populate the list of available printers without querying each
of them for its capabilities. This includes APIs for the system
to request from a print service to update certain printers.

2. Fixed a bug in PrinterId#equals().

3. Added equals and hasCode implementaion to PrinterInfo. Also
the defaul in PrinterInfo are now an array instead of a
SparseArray - cheaper.

4. Now PrintJobConfigActivity works with partially specified
printers. Specifically, if such a printer is selected the
activity is requesting from the print service to update
the printer. We are currently not handling the timeout case.
It also handles udpated pritners.

Change-Id: I5e83e924ef597c9e22cbd06a971d4f4d3bd3a9c1
/frameworks/base/services/java/com/android/server/print/UserState.java
a00271533f639c8ed36429c663889ac9f654bc72 25-Jun-2013 Svetoslav Ganov <svetoslavganov@google.com> Refactoring of the print sub-system and API clean up.

1. Now a user state has ins own spooler since the spooler app is
running per user. The user state registers an observer for the state
of the spooler to get information needed to orchestrate unbinding
from print serivces that have no work and eventually unbinding from
the spooler when all no service has any work.

2. Abstracted a remote print service from the perspective of the system
in a class that is transparently managing binding and unbinding to
the remote instance.

3. Abstracted the remote print spooler to transparently manage binding
and unbinding to the remote instance when there is work and when
there is no work, respectively.

4. Cleaned up the print document adapter (ex-PrintAdapter) APIs to
enable implementing the all callbacks on a thread of choice. If
the document is really small, using the main thread makes sense.

Now if an app that does not need the UI state to layout the printed
content, it can schedule all the work for allocating resources, laying
out, writing, and releasing resources on a dedicated thread.

5. Added info class for the printed document that is now propagated
the the print services. A print service gets an instance of a
new document class that encapsulates the document info and a method
to access the document's data.

6. Added APIs for describing the type of a document to the new document
info class. This allows a print service to do smarts based on the
doc type. For now we have only photo and document types.

7. Renamed the systemReady method for system services that implement
it with different semantics to systemRunning. Such methods assume
the the service can run third-party code which is not the same as
systemReady.

8. Cleaned up the print job configuration activity.

9. Sigh... code clean up here and there. Factoring out classes to
improve readability.

Change-Id: I637ba28412793166cbf519273fdf022241159a92
/frameworks/base/services/java/com/android/server/print/UserState.java