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

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

Don't mix UI and print job state

In PrintActivity.OnPause we set the print job state based on the
PrintActivity state. The issue was that FINISHED was interpreted as
"cancel print job". Actually with FINISHED does not tell what state the
job should be in.

The only purpose of the finished state was to guard against
double-invocation of doFinish().

Hence remove this recently introduced state and use a simple boolean to
guard against doule invocation of doFinish().

Bug: 27760331
Change-Id: I0767c2b0b9c28e8904647cc832c236f67f92bcfe
parent 8c536f91
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -159,7 +159,6 @@ 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;
@@ -255,6 +254,9 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
    /** Whether at least one print services is enabled or not */
    private boolean mArePrintServicesEnabled;

    /** Is doFinish() already in progress */
    private boolean mIsFinishing;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
@@ -2035,11 +2037,11 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
            return;
        }

        if (mState == STATE_FINISHING) {
        if (mIsFinishing) {
            return;
        }

        mState = STATE_FINISHING;
        mIsFinishing = true;

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