summaryrefslogtreecommitdiffstats
path: root/services/java/com
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2013-10-01 00:27:21 -0700
committerSvetoslav Ganov <svetoslavganov@google.com>2013-10-01 07:49:06 -0700
commitdb85ad56adb74f0310b604228dac8bbc03ac2769 (patch)
tree7820607fb2cfcd7d4c6dde54b1f547581f1ead5c /services/java/com
parentc6568719671206e726f260fad390680f7fb0ee9e (diff)
downloadframeworks_base-db85ad56adb74f0310b604228dac8bbc03ac2769.zip
frameworks_base-db85ad56adb74f0310b604228dac8bbc03ac2769.tar.gz
frameworks_base-db85ad56adb74f0310b604228dac8bbc03ac2769.tar.bz2
Fail print jobs targeted to unavailable services.
It is possible that a print job is scheduled for handling, i.e. it is queued, after the target print service is uninstalled or disabled. In case like this we fail the print job with an appropriate error message. Now the user can cancel the job when he/she sees the notification or the status in the print settings. Trying to restart such a job will end up failing it again with the same error message. So the user will just have to canel the print job. This apporach quarantees that the user is informed for the failure and also is much simpler than trying to update the UI when print job's target serivce is uninstalled. For example, the settings UI has to be updated as well as the notifications. Also due to the async nature of the system this we cannot completely avoid having a restart option for a print job whose target service is gone. This scenario is very unlikely but still we have to handle it. bug:11012251 Change-Id: Id8c8c3cff75e0b6325552676b130ff1406edc069
Diffstat (limited to 'services/java/com')
-rw-r--r--services/java/com/android/server/print/UserState.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/services/java/com/android/server/print/UserState.java b/services/java/com/android/server/print/UserState.java
index bc70fe3..3b0ee24 100644
--- a/services/java/com/android/server/print/UserState.java
+++ b/services/java/com/android/server/print/UserState.java
@@ -134,6 +134,11 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks {
}
if (service != null) {
service.onPrintJobQueued(printJob);
+ } else {
+ // The service for the job is no longer enabled, so just
+ // fail the job with the appropriate message.
+ mSpooler.setPrintJobState(printJob.getId(), PrintJobInfo.STATE_FAILED,
+ mContext.getString(R.string.reason_service_unavailable));
}
}
@@ -779,7 +784,7 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks {
for (int i = 0; i < printJobCount; i++) {
PrintJobInfo printJob = printJobs.get(i);
mSpooler.setPrintJobState(printJob.getId(), PrintJobInfo.STATE_FAILED,
- mContext.getString(R.string.reason_unknown));
+ mContext.getString(R.string.reason_service_unavailable));
}
} finally {
Binder.restoreCallingIdentity(identity);