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
This commit is contained in:
Philip P. Moltmann
2016-03-07 11:36:06 -08:00
parent 02a465ace7
commit 0ad7fc5250

View File

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