diff options
author | Svetoslav Ganov <svetoslavganov@google.com> | 2013-10-13 19:10:12 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-10-13 19:10:12 +0000 |
commit | 65d7b8d0dbf9f1263c5ab0b2ded984b3b1bbde01 (patch) | |
tree | e6c055eda014da390f3e90f455363c1eff98b89c /core/java/android | |
parent | 18e121479050a123a98270191f11d780973ad6c5 (diff) | |
parent | d91cb3ea61ea5096637c5d2b5e3e6147d0d2cce3 (diff) | |
download | frameworks_base-65d7b8d0dbf9f1263c5ab0b2ded984b3b1bbde01.zip frameworks_base-65d7b8d0dbf9f1263c5ab0b2ded984b3b1bbde01.tar.gz frameworks_base-65d7b8d0dbf9f1263c5ab0b2ded984b3b1bbde01.tar.bz2 |
Merge "The list of active print jobs in print service retunring wrong result." into klp-dev
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/print/PrintJobInfo.java | 7 | ||||
-rw-r--r-- | core/java/android/print/PrintManager.java | 23 |
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(); + } + } } |