summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSvetoslav <svetoslavganov@google.com>2014-09-23 15:27:35 -0700
committerSvetoslav <svetoslavganov@google.com>2014-09-23 15:54:24 -0700
commit254361f136aa9461e16f11f0170fde05e83a1b92 (patch)
tree6197941267560f60d1b3c1fc17bb010a680f264c
parentdef101127a3ad0a65eb1c3ef53e9f41c4d6be5d2 (diff)
downloadframeworks_base-254361f136aa9461e16f11f0170fde05e83a1b92.zip
frameworks_base-254361f136aa9461e16f11f0170fde05e83a1b92.tar.gz
frameworks_base-254361f136aa9461e16f11f0170fde05e83a1b92.tar.bz2
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
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java2
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java4
2 files changed, 1 insertions, 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);