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
This commit is contained in:
Philip P. Moltmann
2016-03-21 12:48:58 -07:00
parent 8c536f91f1
commit b170c08387

View File

@@ -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);