History log of /frameworks/base/core/java/android/print/PrintDocumentInfo.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c49bf6a63b52ca74a6b3b517e209808037eb04df 07-Jul-2016 Philip P. Moltmann <moltmann@google.com> Fix doc for default print document content type

Since Kitkat the default was always 0 == document.

Change-Id: I9c6236073898f5e62ec80f95a21fd394802fe1dd
/frameworks/base/core/java/android/print/PrintDocumentInfo.java
4723f36d3e93ce4585233de31c72143a46b657f7 30-Mar-2016 Philip P. Moltmann <moltmann@google.com> Make sure PrintDocumentInfo is always sane.

Change-Id: I73cf554d42dc33b7a1f6577088ec53b447f14c8c
/frameworks/base/core/java/android/print/PrintDocumentInfo.java
c43639c3067dda5df189fb3cbf14f256c17e677d 18-Dec-2015 Philip P. Moltmann <moltmann@google.com> Clean up print subsystem

- Stop using deprecated APIs
- Fix all public and some internal javadoc
- Add @Decorations to public APIs
- Some minor cleanup, e.g. don't use variables with overlapping names in same scope
- remove unnecessary properties from manifest (they are set by the build
system)

Change-Id: I0ce8849a516414763fe9de76c3a18ce17d896816
/frameworks/base/core/java/android/print/PrintDocumentInfo.java
869d26fda0d612c15eac64f7d7bc6d7a28073498 15-Mar-2015 Andreas Gampe <agampe@google.com> Frameworks/base: Fix precedence bug

Explicit cast has higher precedence than shift.

Bug: 19797138
Change-Id: Ifcf569bf774fbf65ee50c078f736ad167bcc6b8c
/frameworks/base/core/java/android/print/PrintDocumentInfo.java
0c126a478b4b1891b275fe424c9f7e37adcdb758 11-Jul-2014 Svetoslav <svetoslavganov@google.com> Fix print document with zero pages backwards compatibility.

Historically, we were allowing an app that prints to specify that
the printed document has zero pages. While this does not make any
sense we should keep the behavior as people may have apps that do
that. This change fixes this issue and now we treat zero the same
way as undefined page count and ask the app to write all pages to
check the written PDF for the page count.

bug:16199127

Change-Id: I4e7de66b669e9f783db0252244a6c1e5b24ffe28
/frameworks/base/core/java/android/print/PrintDocumentInfo.java
4d4c66dd38e940082e385b49a33f4022ab04c738 25-Oct-2013 Svetoslav Ganov <svetoslavganov@google.com> Update the documentaton of the android.print package.

bug:10551786
bug:10551697
bug:10705082
bug:10741641
bug:11318976
bug:10550979
bug:10551761

Change-Id: I46ceb66a69b6d32d6b417356178f67f2e25e891a
/frameworks/base/core/java/android/print/PrintDocumentInfo.java
7d7888d1c7daa78ee0ad24a24c8dd54b01749259 12-Oct-2013 Svetoslav Ganov <svetoslavganov@google.com> Printed document size not persisted.

We persist ongoing print jobs so they can be restarted if the device
dies. The data size of the printed document was not persisted to disc.

bug:11199352

Change-Id: I53ef1ee285aa4808917dd6a5c7335226aba1ef0a
/frameworks/base/core/java/android/print/PrintDocumentInfo.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/core/java/android/print/PrintDocumentInfo.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/core/java/android/print/PrintDocumentInfo.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/core/java/android/print/PrintDocumentInfo.java
aec1417ca9eb63209668ac17da90cf8a07c6076c 27-Aug-2013 Svetoslav Ganov <svetoslavganov@google.com> Print APIs update.

1. Added scale to fit and scale to fill fitting modes.

2. Added APIs for a print app to specify which constraints imposed
by the print attributes were satsified during a layout so they
are not handled by the printer again, e.g. if the content is to
be in landscape the the app generated such content the printer
should rotate the content again.

3. Added some printer statuses.

4. Added a helper class that generates PDF documents with correct
size based on the passed in print attributes.

5. Exposed a ctor for PageRange which was hidden by mistake and apps
could not create page ranges. Added API for changing the printer
status.

Change-Id: If1334a61d2d931027b98075f653018d456b1b768
/frameworks/base/core/java/android/print/PrintDocumentInfo.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/core/java/android/print/PrintDocumentInfo.java
85b1f883056a1d74473fd9ce774948878f389ab6 25-Jul-2013 Svetoslav Ganov <svetoslavganov@google.com> Iteration on the print sub-system.

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
/frameworks/base/core/java/android/print/PrintDocumentInfo.java
88d199130d44c6bacb383a7757e782cf97483c68 22-Jul-2013 Svetoslav Ganov <svetoslavganov@google.com> Implement persistence/restoring of print spooler state.

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
/frameworks/base/core/java/android/print/PrintDocumentInfo.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/core/java/android/print/PrintDocumentInfo.java