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
1. Refreshed the print UI based on UX redlines.
2. Implemented tap outside cancel for the print job config activity
which is full-screen but pretends to be a dialog.
Change-Id: I5afc7cd40c696109d70af31536898cfcad91b2ab
1. Update the transition between the print job edit dialog and the
generating print job dialog. Now the former shrinks into the
latter.
2. Added most of the notification assets.
Change-Id: I84f35df5cb4f71b86a103c16ab87fd4d108b055b
1. Added a dialog to show a spinner while the app is writing the
printed content.
2. Fixed print job config acitivity leaking.
3. Updated the notifications a bit.
Change-Id: I8314390135a49605ee11ab4ed14b210a29566745
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
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
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
1. API changes: Moved copies API from PrintAttributes to PrintJobInfo;
Changed the PageRange list to an array in PrintDocumentAdapter#onWrite;
Added onCancelled method to the layout and write callbacks.
2. Refactored the serialization of remote layout and write commands. Now
the commands are serialized by the code in the client instead in the spooler.
The benefit is simple code since the client has to do a serialization to delegate
to the main thread anyway. The increased IPC found is fine since these calls
are quite unfrequent.
3. Removed an unused file: IPrintSpoolerObserver.aidl
4. Added equals and hasCode implementation to PageRange, PrintAttributes,
MediaSize, Resolution, Margins, Tray, PrintDocumentInfo.
5. Added shortcut path for query APIs on PrintJob that return cached values
if the print job is in a uncuttable state, i.e. completed or cancelled. Failed
print jobs can be restarted.
6. PrintJobInfo was not properly serialized.
7. Updated the look of the print dialog to be stable if there is and there isn't
currently selected printer.
8. PrintJobCOnfigActivity now calls onLayout on every print attributes change
but requests a write only on print preview or print button press. Also if the
layout did not change the content and it is already written no subsequent
call is made. Also if the selected pages change and we already have them
no subsequent call to write is made. Also the app is called with print preview
attribute set when performing layout and with it cleared after the print button
is pressed. A lot of changes making sure that only valid actions are enabled
in the activity (looks like a dialog) at a given time frame. The print job config
activity is also hidden after we got all the data, i.e. layout and write are done.
9. The callback from the print spooler to the system are scheduled via messages
to avoid lock being held during the call. It was hard to guarantee that since a
method holding a lock may be calling one that would like to release the lock
at some point to make the callbacks.
10. Print spooler state is persisted only if something changes in a completed
print job, i.e. not one that is being constructed due the print job config dialog.
11. Fixed a potential race in the RemotePrintSpooler where it was possible that
a client that got a handle to the remote spooler calls into an unbound spooler.
E.g: the client gets the remote interface with a lock held, now the client releases
the lock to avoid IPC with a lock, during the IPC scheduling the spooler has
notified the system that it is done and the system unbinds from it, now the
client's IPC is made to a spooler that is disconnected.
Change-Id: Ie9c42255940a27ecaed21a4d326a663a4788ac9d
1. Added support for reporting the old print attributes during layout.
Now we keep track of the old print attributes, so the app can
compute the delta and decide whether re-layout work is needed.
2. Fixed PrintDocumentAdapter callback interleavings. Layout callbacks
were intermixing with write ones - a mess. Now we make an attempt
to cancel layout and write if they respond to cancellation, otherwise
we wait but do not interleave them.
3. Refactored the PrintJobConfigActivity for easier maintenance and
to have a single update UI method that does the minimal amount
of work.
Change-Id: I31ada1a0550882e6185018e6f17f923aed165d15
1. Implemented the persistence and restoring of the print spooler state.
The print spooler state is saved as an XML on every print job change
and is restored when we bind to the spooler. The system does not
unbind from the spooler until the state persistence completes. We
are now storing the entire state, i.e. all print jobs, when a single
one changes. This is not optimal but we are not expecting to have
many such at the same time, so for now we err for simplicity of
implementation.
2. Enforcing a non-empty print job name.
3. Hidden the STATE_CREATED print job state which should never be visible to a
client since this is the state of a print job during construction, i.e. the
print dialog is up and we are doing back and forth with the app.
4. Fixed some PrintAttributes APIs that were incorrectly taking in a PackageManager
instance.
5. Updated the PrintSpooler build file due to splitting the framework into multiple
jars.
Change-Id: I52c88eaa1ec9c64920359cc143c79832a4c3d25b
1. Adding bundle with metadata to PrintDocumentAdapter#onLayout
with one key for now to specify whether this is for a preview.
2. Cleaned up docs.
Change-Id: I89380781bf3ae41aa89f8a0347d74516a210394c
1. Fixed a case in which the onPrintCompleted callback may not be invoked.
2. Added string resulrces for the different error messages for failed
printing in OnPrintCompletedCallback
3. Fixed the string comments for the MediaSize constants.
4. Added APIs to create certain print attributes by passing in a
string label instead of resource and package name since in some cases
a print service may be getting already internationalized lables
or it may not know all possible values.
5. Fixed a crash in PrintJobConfigActivity if there is no input or
output tray.
Change-Id: Ie877b7dc669051606394aa290e6d2b979a42db4c
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