summaryrefslogtreecommitdiffstats
path: root/packages/PrintSpooler
diff options
context:
space:
mode:
authorSvetoslav <svetoslavganov@google.com>2013-07-17 14:52:35 -0700
committerSvetoslav <svetoslavganov@google.com>2013-07-17 14:55:15 -0700
commit6283608e0bd40548742839f5a8b02f7e5c9c5c7c (patch)
tree77dac4aaf04f2b2727289d2ee4bfefe06322e32e /packages/PrintSpooler
parent17b7f6e6d4ec9f5e9597bfd283f1c017b6c66275 (diff)
downloadframeworks_base-6283608e0bd40548742839f5a8b02f7e5c9c5c7c.zip
frameworks_base-6283608e0bd40548742839f5a8b02f7e5c9c5c7c.tar.gz
frameworks_base-6283608e0bd40548742839f5a8b02f7e5c9c5c7c.tar.bz2
Tweak the print APIs.
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
Diffstat (limited to 'packages/PrintSpooler')
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java3
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/RemotePrintDocumentAdapter.java19
2 files changed, 14 insertions, 8 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
index 659102c..c0faed8 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
@@ -536,6 +536,7 @@ public class PrintJobConfigActivity extends Activity {
// TODO: Implement old attributes tracking
mPrintSpooler.setPrintJobAttributes(mPrintJobId, mPrintAttributes);
+ // TODO: Implement setting the print preview attribute
mRemotePrintAdapter.layout(new PrintAttributes.Builder().create(),
mPrintAttributes, new LayoutResultCallback() {
@Override
@@ -566,7 +567,7 @@ public class PrintJobConfigActivity extends Activity {
Log.e(LOG_TAG, "Error during layout: " + error);
finishActivity(Activity.RESULT_CANCELED);
}
- });
+ }, new Bundle());
}
private void notifyPrintableFinishIfNeeded() {
diff --git a/packages/PrintSpooler/src/com/android/printspooler/RemotePrintDocumentAdapter.java b/packages/PrintSpooler/src/com/android/printspooler/RemotePrintDocumentAdapter.java
index 912dd95..7186932 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/RemotePrintDocumentAdapter.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/RemotePrintDocumentAdapter.java
@@ -17,6 +17,7 @@
package com.android.printspooler;
import android.os.AsyncTask;
+import android.os.Bundle;
import android.os.ICancellationSignal;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
@@ -31,8 +32,6 @@ import android.print.PrintDocumentInfo;
import android.util.Log;
import android.util.Slog;
-import libcore.io.IoUtils;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -42,6 +41,8 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
+import libcore.io.IoUtils;
+
/**
* This class represents a remote print document adapter instance.
*/
@@ -122,8 +123,9 @@ final class RemotePrintDocumentAdapter {
}
public void layout(PrintAttributes oldAttributes, PrintAttributes newAttributes,
- LayoutResultCallback callback) {
- LayoutAsyncTask task = new LayoutAsyncTask(oldAttributes, newAttributes, callback);
+ LayoutResultCallback callback, Bundle metadata) {
+ LayoutAsyncTask task = new LayoutAsyncTask(oldAttributes, newAttributes, callback,
+ metadata);
synchronized (mLock) {
mTaskQueue.add(task);
task.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, (Void[]) null);
@@ -181,6 +183,8 @@ final class RemotePrintDocumentAdapter {
private final LayoutResultCallback mCallback;
+ private final Bundle mMetadata;
+
private final ILayoutResultCallback mILayoutResultCallback =
new ILayoutResultCallback.Stub() {
@Override
@@ -219,11 +223,12 @@ final class RemotePrintDocumentAdapter {
private boolean mCompleted;
- public LayoutAsyncTask(PrintAttributes oldAttributes,
- PrintAttributes newAttributes, LayoutResultCallback callback) {
+ public LayoutAsyncTask(PrintAttributes oldAttributes, PrintAttributes newAttributes,
+ LayoutResultCallback callback, Bundle metadata) {
mOldAttributes = oldAttributes;
mNewAttributes = newAttributes;
mCallback = callback;
+ mMetadata = metadata;
}
@Override
@@ -246,7 +251,7 @@ final class RemotePrintDocumentAdapter {
}
try {
mRemoteInterface.layout(mOldAttributes, mNewAttributes,
- mILayoutResultCallback);
+ mILayoutResultCallback, mMetadata);
synchronized (mLock) {
while (true) {
if (isCancelled()) {