Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02dded1a authored by Svetoslav's avatar Svetoslav
Browse files

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
parent 54adee86
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -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()) {