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

Commit 0ad7fc52 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Do not finish multiple times.

It can happen that multiple async calls fail and we end up calling
doFinish from all of them. We should just ignore the later ones.

Bug: 27198033
Change-Id: Ica596b966f96e9ade6409cc45c50fd62c4018b1e
parent 02a465ac
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -159,6 +159,7 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
    private static final int STATE_PRINTER_UNAVAILABLE = 6;
    private static final int STATE_UPDATE_SLOW = 7;
    private static final int STATE_PRINT_COMPLETED = 8;
    private static final int STATE_FINISHING = 9;

    private static final int UI_STATE_PREVIEW = 0;
    private static final int UI_STATE_ERROR = 1;
@@ -2034,6 +2035,12 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
            return;
        }

        if (mState == STATE_FINISHING) {
            return;
        }

        mState = STATE_FINISHING;

        if (mPrinterRegistry != null) {
            mPrinterRegistry.setTrackedPrinter(null);
        }