summaryrefslogtreecommitdiffstats
path: root/core/java/android/printservice/PrintService.java
Commit message (Collapse)AuthorAgeFilesLines
* Print spooler security and some new print service facing APIs.Svetoslav Ganov2013-08-291-8/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix buildSvetoslav Ganov2013-08-201-2/+2
| | | | Change-Id: Iff815dd264008c005995ab8a95b442dad7aca18e
* Implemented advanced printer selection and API refactoring.Svetoslav2013-08-191-35/+89
| | | | | | | | | | | | | | | | | | | | 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
* Refinement of the print service APIs.Svetoslav Ganov2013-08-111-304/+129
| | | | | | | | | | | | | | | | 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
* First cut of the print notifications.Svetoslav Ganov2013-08-021-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Iteration of the print sub-system.Svetoslav Ganov2013-07-311-27/+111
| | | | | | | | | | | | | | | | | | | | | | 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
* First pass of the print dialog UXSvetoslav2013-07-191-15/+0
| | | | Change-Id: I315a16d7f68c73ca180c76e722847b4b1bdea55b
* Refactoring of the print sub-system and API clean up.Svetoslav Ganov2013-07-161-82/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Print APIs documentation updateSvetoslav2013-06-241-5/+4
| | | | Change-Id: I0df438e45ef540cc42c9ee5baafc816ebafa1c7b
* Print - platform APIsSvetoslav Ganov2013-06-211-0/+462
Related changes: Skia (inlcude PDF APIs): https://googleplex-android-review.googlesource.com/#/c/305814/ Canvas to PDF: https://googleplex-android-review.googlesource.com/#/c/319367/ Settings (initial version): https://googleplex-android-review.googlesource.com/#/c/306077/ Build: https://googleplex-android-review.googlesource.com/#/c/292437/ Sample print services: https://googleplex-android-review.googlesource.com/#/c/281785/ Change-Id: I104d12efd12577f05c7b9b2a5e5e49125c0f09da