From 254361f136aa9461e16f11f0170fde05e83a1b92 Mon Sep 17 00:00:00 2001 From: Svetoslav Date: Tue, 23 Sep 2014 15:27:35 -0700 Subject: 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 --- .../src/com/android/printspooler/model/PageContentRepository.java | 2 +- .../PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java b/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java index f779f87..eb2c920 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java +++ b/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java @@ -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); } } diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java index 56497d7..6de19c9 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java +++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java @@ -471,10 +471,6 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat requestCreatePdfFileOrFinish(); } break; - case STATE_PRINT_CANCELED: { - doFinish(); - } break; - default: { updatePrintPreviewController(document.changed); -- cgit v1.1