summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/java/android/print/PrintJobInfo.java7
-rw-r--r--core/java/android/print/PrintManager.java23
2 files changed, 22 insertions, 8 deletions
diff --git a/core/java/android/print/PrintJobInfo.java b/core/java/android/print/PrintJobInfo.java
index e571986..9f935c8 100644
--- a/core/java/android/print/PrintJobInfo.java
+++ b/core/java/android/print/PrintJobInfo.java
@@ -131,7 +131,7 @@ public final class PrintJobInfo implements Parcelable {
/** The name of the printer - internally used */
private String mPrinterName;
- /** The status of the print job. */
+ /** The state of the print job. */
private int mState;
/** The id of the app that created the job. */
@@ -555,7 +555,7 @@ public final class PrintJobInfo implements Parcelable {
builder.append("PrintJobInfo{");
builder.append("label: ").append(mLabel);
builder.append(", id: ").append(mId);
- builder.append(", status: ").append(stateToString(mState));
+ builder.append(", state: ").append(stateToString(mState));
builder.append(", printer: " + mPrinterId);
builder.append(", tag: ").append(mTag);
builder.append(", creationTime: " + mCreationTime);
@@ -583,6 +583,9 @@ public final class PrintJobInfo implements Parcelable {
case STATE_STARTED: {
return "STATE_STARTED";
}
+ case STATE_BLOCKED: {
+ return "STATE_BLOCKED";
+ }
case STATE_FAILED: {
return "STATE_FAILED";
}
diff --git a/core/java/android/print/PrintManager.java b/core/java/android/print/PrintManager.java
index 1233da2..dbd8278 100644
--- a/core/java/android/print/PrintManager.java
+++ b/core/java/android/print/PrintManager.java
@@ -146,11 +146,14 @@ public final class PrintManager {
switch (message.what) {
case MSG_NOTIFY_PRINT_JOB_STATE_CHANGED: {
SomeArgs args = (SomeArgs) message.obj;
- PrintJobStateChangeListener listener =
- (PrintJobStateChangeListener) args.arg1;
- PrintJobId printJobId = (PrintJobId) args.arg2;
+ PrintJobStateChangeListenerWrapper wrapper =
+ (PrintJobStateChangeListenerWrapper) args.arg1;
+ PrintJobStateChangeListener listener = wrapper.getListener();
+ if (listener != null) {
+ PrintJobId printJobId = (PrintJobId) args.arg2;
+ listener.onPrintJobStateChanged(printJobId);
+ }
args.recycle();
- listener.onPrintJobStateChanged(printJobId);
} break;
}
}
@@ -217,6 +220,7 @@ public final class PrintManager {
if (mPrintJobStateChangeListeners.isEmpty()) {
mPrintJobStateChangeListeners = null;
}
+ wrappedListener.destroy();
try {
mService.removePrintJobStateChangeListener(wrappedListener, mUserId);
} catch (RemoteException re) {
@@ -769,12 +773,19 @@ public final class PrintManager {
PrintJobStateChangeListener listener = mWeakListener.get();
if (handler != null && listener != null) {
SomeArgs args = SomeArgs.obtain();
- args.arg1 = listener;
+ args.arg1 = this;
args.arg2 = printJobId;
handler.obtainMessage(MSG_NOTIFY_PRINT_JOB_STATE_CHANGED,
args).sendToTarget();
}
}
- }
+ public void destroy() {
+ mWeakListener.clear();
+ }
+
+ public PrintJobStateChangeListener getListener() {
+ return mWeakListener.get();
+ }
+ }
}