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
24 files changed