summaryrefslogtreecommitdiffstats
path: root/packages/PrintSpooler
diff options
context:
space:
mode:
authorSvetoslav <svetoslavganov@google.com>2014-07-24 10:13:00 -0700
committerSvetoslav Ganov <svetoslavganov@google.com>2014-07-24 17:17:07 +0000
commitb59555ca743118c45103c0c11aedeefb8893f0f0 (patch)
tree11bcba1b6258f63efaf987165cca0bd237533b40 /packages/PrintSpooler
parente138eb58f3f8e145e2b5c128515dd6b8c816eadc (diff)
downloadframeworks_base-b59555ca743118c45103c0c11aedeefb8893f0f0.zip
frameworks_base-b59555ca743118c45103c0c11aedeefb8893f0f0.tar.gz
frameworks_base-b59555ca743118c45103c0c11aedeefb8893f0f0.tar.bz2
Print to PDF putting a pring job in a wrong state.
When printing to a PDF file we get a Uri from the storage APIs and write the content. Once the file is written to storage the print job is completed and there is print service involved. Th spooler was wrongly putting the job in a failed state instead of a complete state. bug:16522267 Change-Id: I4741c9b9eb763e118e7dfb2c7c502bd7fc13f7a1
Diffstat (limited to 'packages/PrintSpooler')
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
index 86c3a92..a1b1aec 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
@@ -121,6 +121,7 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
private static final int STATE_CREATE_FILE_FAILED = 4;
private static final int STATE_PRINTER_UNAVAILABLE = 5;
private static final int STATE_UPDATE_SLOW = 6;
+ private static final int STATE_PRINT_COMPLETED = 7;
private static final int UI_STATE_PREVIEW = 0;
private static final int UI_STATE_ERROR = 1;
@@ -304,6 +305,10 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
spooler.setPrintJobState(mPrintJob.getId(), PrintJobInfo.STATE_QUEUED, null);
} break;
+ case STATE_PRINT_COMPLETED: {
+ spooler.setPrintJobState(mPrintJob.getId(), PrintJobInfo.STATE_COMPLETED, null);
+ } break;
+
case STATE_CREATE_FILE_FAILED: {
spooler.setPrintJobState(mPrintJob.getId(), PrintJobInfo.STATE_FAILED,
getString(R.string.print_write_error_message));
@@ -539,6 +544,8 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
private void onStartCreateDocumentActivityResult(int resultCode, Intent data) {
if (resultCode == RESULT_OK && data != null) {
+ setState(STATE_PRINT_COMPLETED);
+ updateOptionsUi();
Uri uri = data.getData();
mPrintedDocument.writeContent(getContentResolver(), uri);
// Calling finish here does not invoke lifecycle callbacks but we
@@ -706,7 +713,8 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
private static boolean isFinalState(int state) {
return state == STATE_PRINT_CONFIRMED
- || state == STATE_PRINT_CANCELED;
+ || state == STATE_PRINT_CANCELED
+ || state == STATE_PRINT_COMPLETED;
}
private void updateSelectedPagesFromPreview() {
@@ -1060,6 +1068,7 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
}
if (mState == STATE_PRINT_CONFIRMED
+ || mState == STATE_PRINT_COMPLETED
|| mState == STATE_PRINT_CANCELED
|| mState == STATE_UPDATE_FAILED
|| mState == STATE_CREATE_FILE_FAILED