From b99876416cb8e85c748914b7eb4096f7dc80ed2c Mon Sep 17 00:00:00 2001 From: "Philip P. Moltmann" Date: Wed, 20 Apr 2016 13:21:34 -0700 Subject: [PATCH] Print API for N: Fix docs and change interfaces as requested. Fixes: 28291443 Change-Id: I1a1585796032351a739d54171bd67ccc76f0f08a --- api/current.txt | 2 +- api/system-current.txt | 2 +- api/test-current.txt | 2 +- .../printservice/CustomPrinterIconCallback.java | 2 +- core/java/android/printservice/PrintJob.java | 9 +++------ .../printservice/PrinterDiscoverySession.java | 12 ++++++------ 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/api/current.txt b/api/current.txt index a04ecfb26d13c..65b30107e29c8 100644 --- a/api/current.txt +++ b/api/current.txt @@ -30331,7 +30331,7 @@ package android.print.pdf { package android.printservice { - public class CustomPrinterIconCallback { + public final class CustomPrinterIconCallback { method public boolean onCustomPrinterIconLoaded(android.graphics.drawable.Icon); } diff --git a/api/system-current.txt b/api/system-current.txt index dd2f18b0b9f66..c1657fa13a9b4 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -32830,7 +32830,7 @@ package android.print.pdf { package android.printservice { - public class CustomPrinterIconCallback { + public final class CustomPrinterIconCallback { method public boolean onCustomPrinterIconLoaded(android.graphics.drawable.Icon); } diff --git a/api/test-current.txt b/api/test-current.txt index d056f7d57fce1..dcf6899877637 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -30403,7 +30403,7 @@ package android.print.pdf { package android.printservice { - public class CustomPrinterIconCallback { + public final class CustomPrinterIconCallback { method public boolean onCustomPrinterIconLoaded(android.graphics.drawable.Icon); } diff --git a/core/java/android/printservice/CustomPrinterIconCallback.java b/core/java/android/printservice/CustomPrinterIconCallback.java index 6b9d0d81dc558..a1fbdab8a3d49 100644 --- a/core/java/android/printservice/CustomPrinterIconCallback.java +++ b/core/java/android/printservice/CustomPrinterIconCallback.java @@ -27,7 +27,7 @@ import android.util.Log; /** * Callback for {@link PrinterDiscoverySession#onRequestCustomPrinterIcon}. */ -public class CustomPrinterIconCallback { +public final class CustomPrinterIconCallback { /** The printer the call back is for */ private final @NonNull PrinterId mPrinterId; private final @NonNull IPrintServiceClient mObserver; diff --git a/core/java/android/printservice/PrintJob.java b/core/java/android/printservice/PrintJob.java index 7a7ca2353b1d8..3226f343ce66b 100644 --- a/core/java/android/printservice/PrintJob.java +++ b/core/java/android/printservice/PrintJob.java @@ -347,18 +347,15 @@ public final class PrintJob { *

* This overrides any previously set status set via {@link #setStatus(CharSequence)}, * {@link #setStatus(int)}, {@link #block(String)}, or {@link #fail(String)}, - *

- * To clear the status use {@link #setStatus(CharSequence) setStatus(null)} * - * @param status The new status as a String resource. + * @param statusResId The new status as a String resource. If 0 the status will be empty. */ @MainThread - public void setStatus(@StringRes int status) { + public void setStatus(@StringRes int statusResId) { PrintService.throwIfNotCalledOnMainThread(); - Preconditions.checkArgument(status != 0, "status has to be != 0"); try { - mPrintServiceClient.setStatusRes(mCachedInfo.getId(), status, + mPrintServiceClient.setStatusRes(mCachedInfo.getId(), statusResId, mContext.getPackageName()); } catch (RemoteException re) { Log.e(LOG_TAG, "Error setting status for job: " + mCachedInfo.getId(), re); diff --git a/core/java/android/printservice/PrinterDiscoverySession.java b/core/java/android/printservice/PrinterDiscoverySession.java index 7b9533d732161..4987e8bd7ccbe 100644 --- a/core/java/android/printservice/PrinterDiscoverySession.java +++ b/core/java/android/printservice/PrinterDiscoverySession.java @@ -408,15 +408,15 @@ public abstract class PrinterDiscoverySession { public abstract void onStartPrinterStateTracking(@NonNull PrinterId printerId); /** - * Request the custom icon for a printer. Once the icon is available use - * {@link CustomPrinterIconCallback#onCustomPrinterIconLoaded} to send the data to the print - * service. + * Called by the system to request the custom icon for a printer. Once the icon is available the + * print services uses {@link CustomPrinterIconCallback#onCustomPrinterIconLoaded} to send the + * icon to the system. * * @param printerId The printer to icon belongs to. - * @param cancellationSignal Signal used to cancel the request - * @param callback Callback for returning the icon to the print spooler. + * @param cancellationSignal Signal used to cancel the request. + * @param callback Callback for returning the icon to the system. * - * @see android.print.PrinterInfo.Builder#setHasCustomPrinterIcon() + * @see android.print.PrinterInfo.Builder#setHasCustomPrinterIcon(boolean) */ public void onRequestCustomPrinterIcon(@NonNull PrinterId printerId, @NonNull CancellationSignal cancellationSignal,