Print spooler crash on back before first layout is complete.

If the user presses back before the remote print document
update has completed we get a crash. The reason is that
after the update completion we were trying to finish the
activity if we are in a cancelled state but this is not
needed as we aready handled the back key so we will finish.
Handling finish twice was creating the problem as classes
with lifecycles are not designed to be used after being
finished. In particular, we were calling doFinish() twice.

bug:17630561

Change-Id: If418f237a2def7c8e4a072ac8826283f4dd7fc85
This commit is contained in:
Svetoslav
2014-09-23 15:27:35 -07:00
parent def101127a
commit 254361f136
2 changed files with 1 additions and 5 deletions

View File

@ -125,7 +125,7 @@ public final class PageContentRepository {
if (mLastRenderSpec == null) {
mScheduledPreloadFirstShownPage = firstShownPage;
mScheduledPreloadLastShownPage = lastShownPage;
} else {
} else if (mState == STATE_OPENED) {
mRenderer.startPreload(firstShownPage, lastShownPage, mLastRenderSpec);
}
}

View File

@ -471,10 +471,6 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
requestCreatePdfFileOrFinish();
} break;
case STATE_PRINT_CANCELED: {
doFinish();
} break;
default: {
updatePrintPreviewController(document.changed);