am 19565ad1: Merge "Small print API tweaks" into klp-dev
* commit '19565ad1a19bf8e400d04a3a64cf6455ddca81ca': Small print API tweaks
This commit is contained in:
@@ -19368,12 +19368,6 @@ package android.print {
|
||||
method public android.print.PrintDocumentInfo.Builder setPageCount(int);
|
||||
}
|
||||
|
||||
public class PrintFileDocumentAdapter extends android.print.PrintDocumentAdapter {
|
||||
ctor public PrintFileDocumentAdapter(android.content.Context, java.io.File, android.print.PrintDocumentInfo);
|
||||
method public void onLayout(android.print.PrintAttributes, android.print.PrintAttributes, android.os.CancellationSignal, android.print.PrintDocumentAdapter.LayoutResultCallback, android.os.Bundle);
|
||||
method public void onWrite(android.print.PageRange[], android.os.ParcelFileDescriptor, android.os.CancellationSignal, android.print.PrintDocumentAdapter.WriteResultCallback);
|
||||
}
|
||||
|
||||
public final class PrintJob {
|
||||
method public void cancel();
|
||||
method public android.print.PrintJobId getId();
|
||||
@@ -19403,10 +19397,8 @@ package android.print {
|
||||
method public android.print.PageRange[] getPages();
|
||||
method public android.print.PrinterId getPrinterId();
|
||||
method public int getState();
|
||||
method public java.lang.String getTag();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator CREATOR;
|
||||
field public static final int PRINT_JOB_ID_UNDEFINED = -1; // 0xffffffff
|
||||
field public static final int STATE_BLOCKED = 4; // 0x4
|
||||
field public static final int STATE_CANCELED = 7; // 0x7
|
||||
field public static final int STATE_COMPLETED = 5; // 0x5
|
||||
@@ -19501,6 +19493,7 @@ package android.printservice {
|
||||
method public android.printservice.PrintDocument getDocument();
|
||||
method public android.print.PrintJobId getId();
|
||||
method public android.print.PrintJobInfo getInfo();
|
||||
method public java.lang.String getTag();
|
||||
method public boolean isBlocked();
|
||||
method public boolean isCancelled();
|
||||
method public boolean isCompleted();
|
||||
|
||||
@@ -41,6 +41,8 @@ import java.io.OutputStream;
|
||||
* spooling the data, so you can delete the file if it is a
|
||||
* temporary one. To achieve this one must override {@link #onFinish()}
|
||||
* and delete the file yourself.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public class PrintFileDocumentAdapter extends PrintDocumentAdapter {
|
||||
|
||||
|
||||
@@ -26,9 +26,6 @@ import java.util.Arrays;
|
||||
*/
|
||||
public final class PrintJobInfo implements Parcelable {
|
||||
|
||||
/** Undefined print job id. */
|
||||
public static final int PRINT_JOB_ID_UNDEFINED = -1;
|
||||
|
||||
/**
|
||||
* Constant for matching any print job state.
|
||||
*
|
||||
@@ -356,6 +353,8 @@ public final class PrintJobInfo implements Parcelable {
|
||||
* Gets the optional tag assigned by a print service.
|
||||
*
|
||||
* @return The tag.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public String getTag() {
|
||||
return mTag;
|
||||
|
||||
@@ -301,6 +301,18 @@ public final class PrintJob {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the print job tag.
|
||||
*
|
||||
* @return tag The tag or null.
|
||||
*
|
||||
* @see #setTag(String)
|
||||
*/
|
||||
public String getTag() {
|
||||
PrintService.throwIfNotCalledOnMainThread();
|
||||
return getInfo().getTag();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
|
||||
@@ -205,6 +205,10 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks {
|
||||
for (int i = 0; i < cachedPrintJobCount; i++) {
|
||||
PrintJobInfo cachedPrintJob = cachedPrintJobs.get(i);
|
||||
result.put(cachedPrintJob.getId(), cachedPrintJob);
|
||||
// Strip out the tag - it is visible only to print services.
|
||||
// Also the cached print jobs are delivered only to apps, so
|
||||
// stripping the tag of a cached print job is fine.
|
||||
cachedPrintJob.setTag(null);
|
||||
}
|
||||
|
||||
// Add everything else the spooler knows about.
|
||||
@@ -215,6 +219,8 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks {
|
||||
for (int i = 0; i < printJobCount; i++) {
|
||||
PrintJobInfo printJob = printJobs.get(i);
|
||||
result.put(printJob.getId(), printJob);
|
||||
// Strip out the tag - it is visible only to print services.
|
||||
printJob.setTag(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user