summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSvetoslav <svetoslavganov@google.com>2013-10-04 17:37:21 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-10-04 17:37:21 -0700
commit6754f68f4967f318f252bc068db12781f5c8a26d (patch)
tree63385b6a518c66000452de99058344c8725750c9
parent7dc10595e57aa43b62dfc34700fe6cc4de97dc0e (diff)
parent133c1faf8c4450c5ad45dea13323d45dfb60817b (diff)
downloadframeworks_base-6754f68f4967f318f252bc068db12781f5c8a26d.zip
frameworks_base-6754f68f4967f318f252bc068db12781f5c8a26d.tar.gz
frameworks_base-6754f68f4967f318f252bc068db12781f5c8a26d.tar.bz2
am 133c1faf: am 67d7af51: am 19565ad1: Merge "Small print API tweaks" into klp-dev
* commit '133c1faf8c4450c5ad45dea13323d45dfb60817b': Small print API tweaks
-rw-r--r--api/current.txt9
-rw-r--r--core/java/android/print/PrintFileDocumentAdapter.java2
-rw-r--r--core/java/android/print/PrintJobInfo.java5
-rw-r--r--core/java/android/printservice/PrintJob.java12
-rw-r--r--services/java/com/android/server/print/UserState.java6
5 files changed, 23 insertions, 11 deletions
diff --git a/api/current.txt b/api/current.txt
index 8271df9..51662ed 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -19431,12 +19431,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();
@@ -19466,10 +19460,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
@@ -19564,6 +19556,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();
diff --git a/core/java/android/print/PrintFileDocumentAdapter.java b/core/java/android/print/PrintFileDocumentAdapter.java
index c3a23a5..5d655bf 100644
--- a/core/java/android/print/PrintFileDocumentAdapter.java
+++ b/core/java/android/print/PrintFileDocumentAdapter.java
@@ -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 {
diff --git a/core/java/android/print/PrintJobInfo.java b/core/java/android/print/PrintJobInfo.java
index e5d06a2..ccb4f44 100644
--- a/core/java/android/print/PrintJobInfo.java
+++ b/core/java/android/print/PrintJobInfo.java
@@ -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;
diff --git a/core/java/android/printservice/PrintJob.java b/core/java/android/printservice/PrintJob.java
index 721e31e..d1dbedf 100644
--- a/core/java/android/printservice/PrintJob.java
+++ b/core/java/android/printservice/PrintJob.java
@@ -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) {
diff --git a/services/java/com/android/server/print/UserState.java b/services/java/com/android/server/print/UserState.java
index 3b0ee24..b3f0036 100644
--- a/services/java/com/android/server/print/UserState.java
+++ b/services/java/com/android/server/print/UserState.java
@@ -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);
}
}