am 33021d95: Merge "Adding timeout if the current printer or its capabilities disappear." into klp-dev
* commit '33021d95a8f3ca127c1df6aeb54c3a9219f46093':
Adding timeout if the current printer or its capabilities disappear.
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 @@
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()) {