summaryrefslogtreecommitdiffstats
path: root/packages/PrintSpooler
diff options
context:
space:
mode:
authorSvetoslav <svetoslavganov@google.com>2013-10-11 13:56:08 -0700
committerSvetoslav <svetoslavganov@google.com>2013-10-11 14:02:49 -0700
commit02dded1a63bb5ae2968fb9df0c29bad115416a28 (patch)
tree347f56b788627b6eea0e03be76d8ff6786ad84c7 /packages/PrintSpooler
parent54adee86af495311fc9ef62d65e035605043413f (diff)
downloadframeworks_base-02dded1a63bb5ae2968fb9df0c29bad115416a28.zip
frameworks_base-02dded1a63bb5ae2968fb9df0c29bad115416a28.tar.gz
frameworks_base-02dded1a63bb5ae2968fb9df0c29bad115416a28.tar.bz2
Adding timeout if the current printer or its capabilities disappear.
If the current printer becomes unavailable or its capabilities go away we are scheduling a timeout to declare the printer as unavailable. bug:10983508 Change-Id: Iab85cfd35fc0cecc3dd4abac6232347f9da18fb0
Diffstat (limited to 'packages/PrintSpooler')
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
index a8c4f07..3ee1a64 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
@@ -1247,6 +1247,21 @@ public class PrintJobConfigActivity extends Activity {
return;
}
+ // If the current printer became unavailable or its
+ // capabilities go away, we update the UI and add a
+ // timeout to declare the printer as unavailable.
+ if ((mCurrentPrinter.getStatus() != PrinterInfo.STATUS_UNAVAILABLE
+ && printer.getStatus() == PrinterInfo.STATUS_UNAVAILABLE)
+ || (mCurrentPrinter.getCapabilities() != null
+ && printer.getCapabilities() == null)) {
+ if (!mCapabilitiesTimeout.isPosted()) {
+ mCapabilitiesTimeout.post();
+ mCurrentPrinter.copyFrom(printer);
+ updateUi();
+ return;
+ }
+ }
+
// We just refreshed the current printer.
if (printer.getCapabilities() != null
&& mCapabilitiesTimeout.isPosted()) {