Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83fe4fad authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by android-build-merger
Browse files

Merge "Fix three bugs in the handling of the advanced options activity" into nyc-dev

am: 556b3226

* commit '556b3226':
  Fix three bugs in the handling of the advanced options activity
parents 5125656b 556b3226
Loading
Loading
Loading
Loading
+13 −6
Original line number Original line Diff line number Diff line
@@ -731,7 +731,10 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat


        // The activity is a component name, therefore it is one or none.
        // The activity is a component name, therefore it is one or none.
        if (resolvedActivities.get(0).activityInfo.exported) {
        if (resolvedActivities.get(0).activityInfo.exported) {
            intent.putExtra(PrintService.EXTRA_PRINT_JOB_INFO, mPrintJob);
            PrintJobInfo.Builder printJobBuilder = new PrintJobInfo.Builder(mPrintJob);
            printJobBuilder.setPages(mSelectedPages);

            intent.putExtra(PrintService.EXTRA_PRINT_JOB_INFO, printJobBuilder.build());
            intent.putExtra(PrintService.EXTRA_PRINTER_INFO, printer);
            intent.putExtra(PrintService.EXTRA_PRINTER_INFO, printer);
            intent.putExtra(PrintService.EXTRA_PRINT_DOCUMENT_INFO,
            intent.putExtra(PrintService.EXTRA_PRINT_DOCUMENT_INFO,
                    mPrintedDocument.getDocumentInfo().info);
                    mPrintedDocument.getDocumentInfo().info);
@@ -759,10 +762,14 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
        // Take the advanced options without interpretation.
        // Take the advanced options without interpretation.
        mPrintJob.setAdvancedOptions(printJobInfo.getAdvancedOptions());
        mPrintJob.setAdvancedOptions(printJobInfo.getAdvancedOptions());


        // Take copies without interpretation as the advanced print dialog
        if (printJobInfo.getCopies() < 1) {
        // cannot create a print job info with invalid copies.
            Log.w(LOG_TAG, "Cannot apply return value from advanced options activity. Copies " +
                    "must be 1 or more. Actual value is: " + printJobInfo.getCopies() + ". " +
                    "Ignoring.");
        } else {
            mCopiesEditText.setText(String.valueOf(printJobInfo.getCopies()));
            mCopiesEditText.setText(String.valueOf(printJobInfo.getCopies()));
            mPrintJob.setCopies(printJobInfo.getCopies());
            mPrintJob.setCopies(printJobInfo.getCopies());
        }


        PrintAttributes currAttributes = mPrintJob.getAttributes();
        PrintAttributes currAttributes = mPrintJob.getAttributes();
        PrintAttributes newAttributes = printJobInfo.getAttributes();
        PrintAttributes newAttributes = printJobInfo.getAttributes();
@@ -771,7 +778,7 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
            // Take the media size only if the current printer supports is.
            // Take the media size only if the current printer supports is.
            MediaSize oldMediaSize = currAttributes.getMediaSize();
            MediaSize oldMediaSize = currAttributes.getMediaSize();
            MediaSize newMediaSize = newAttributes.getMediaSize();
            MediaSize newMediaSize = newAttributes.getMediaSize();
            if (!oldMediaSize.equals(newMediaSize)) {
            if (newMediaSize != null && !oldMediaSize.equals(newMediaSize)) {
                final int mediaSizeCount = mMediaSizeSpinnerAdapter.getCount();
                final int mediaSizeCount = mMediaSizeSpinnerAdapter.getCount();
                MediaSize newMediaSizePortrait = newAttributes.getMediaSize().asPortrait();
                MediaSize newMediaSizePortrait = newAttributes.getMediaSize().asPortrait();
                for (int i = 0; i < mediaSizeCount; i++) {
                for (int i = 0; i < mediaSizeCount; i++) {