From 05e041b013d8750a66787f5f7eb77c7ec95a670f Mon Sep 17 00:00:00 2001 From: Svetoslav Date: Tue, 14 Oct 2014 14:14:49 -0700 Subject: [PATCH] Handle if the printing app is killed while saving to PDF. When saving to PDF we bring up the file picker UI which covers the print UI. In this case the printing app may get killed as it is not in the forground (the system is bound to the print spooler so it cannot get killed). If that happens we are ending up with an empty file. However, if the file chooser UI is up we already have everything from the app we need and it dying does not matter. This change takes care if ignoring printing app death while saving to PDF. bug:17922948 Change-Id: I10d808e3c3e93e850dbc2a948f2482381a887928 --- .../src/com/android/printspooler/ui/PrintActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java index 84ada6f45d883..20254f0b21a83 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java +++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java @@ -286,7 +286,9 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat mFileProvider, new RemotePrintDocument.RemoteAdapterDeathObserver() { @Override public void onDied() { - if (isFinishing()) { + // If we are finishing or we are in a state that we do not need any + // data from the printing app, then no need to finish. + if (isFinishing() || (isFinalState(mState) && !mPrintedDocument.isUpdating())) { return; } setState(STATE_PRINT_CANCELED);