am c89e5a6a: Merge "Layout may be called with invalid print attributes." into klp-dev
* commit 'c89e5a6af1514320f90329dadebdfa26a3ae93d2':
Layout may be called with invalid print attributes.
diff --git a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
index 22a9950..3a23b3e 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
@@ -1248,13 +1248,20 @@
continue;
}
+ // If nothing changed - done.
+ if (mCurrentPrinter.equals(printer)) {
+ return;
+ }
+
// If the current printer became available and has no
// capabilities, we refresh it.
if (mCurrentPrinter.getStatus() == PrinterInfo.STATUS_UNAVAILABLE
&& printer.getStatus() != PrinterInfo.STATUS_UNAVAILABLE
- && printer.getCapabilities() == null
- && !mCapabilitiesTimeout.isPosted()) {
- mCapabilitiesTimeout.post();
+ && printer.getCapabilities() == null) {
+ if (!mCapabilitiesTimeout.isPosted()) {
+ mCapabilitiesTimeout.post();
+ }
+ mCurrentPrinter.copyFrom(printer);
refreshCurrentPrinter();
return;
}
@@ -1268,10 +1275,10 @@
&& printer.getCapabilities() == null)) {
if (!mCapabilitiesTimeout.isPosted()) {
mCapabilitiesTimeout.post();
- mCurrentPrinter.copyFrom(printer);
- updateUi();
- return;
}
+ mCurrentPrinter.copyFrom(printer);
+ updateUi();
+ return;
}
// We just refreshed the current printer.