Skip to content

Commit e1dcb39

Browse files
committed
Crash in print spooler if save to PDF selected early.
The first issue is that the save to pdf button is enabled before the first layout completed and at this point we do not know anything about the document. The second is that if a layout is in progress and we select save to pdf we end up starting the documents UI twice and finishing the second instance carshes the spooler. bug:17676878 Change-Id: Id0b1f06e4d377347286c2dde09669d431441234b
1 parent 485f209 commit e1dcb39

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,9 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
566566
}
567567

568568
private void startCreateDocumentActivity() {
569+
if (!isResumed()) {
570+
return;
571+
}
569572
PrintDocumentInfo info = mPrintedDocument.getDocumentInfo().info;
570573
if (info == null) {
571574
return;
@@ -1347,7 +1350,8 @@ void updateOptionsUi() {
13471350
mPrintButton.setImageResource(R.drawable.ic_menu_savetopdf);
13481351
mPrintButton.setContentDescription(getString(R.string.savetopdf_button));
13491352
}
1350-
if ((mRangeOptionsSpinner.getSelectedItemPosition() == 1
1353+
if (!mPrintedDocument.getDocumentInfo().laidout
1354+
||(mRangeOptionsSpinner.getSelectedItemPosition() == 1
13511355
&& (TextUtils.isEmpty(mPageRangeEditText.getText()) || hasErrors()))
13521356
|| (mRangeOptionsSpinner.getSelectedItemPosition() == 0
13531357
&& (mPrintedDocument.getDocumentInfo() == null || hasErrors()))) {

0 commit comments

Comments
 (0)