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

Commit 2eb7fadc authored by Svet Ganov's avatar Svet Ganov Committed by Svetoslav
Browse files

Custom print settings cannot change resolution.

bug:17677133

Change-Id: Ib8a24101f12d431fe221c1e91711d93a6a517273
parent 18ab83e5
Loading
Loading
Loading
Loading
+51 −31
Original line number Diff line number Diff line
@@ -686,6 +686,7 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
        PrintAttributes currAttributes = mPrintJob.getAttributes();
        PrintAttributes newAttributes = printJobInfo.getAttributes();

        if (newAttributes != null) {
            // Take the media size only if the current printer supports is.
            MediaSize oldMediaSize = currAttributes.getMediaSize();
            MediaSize newMediaSize = newAttributes.getMediaSize();
@@ -712,6 +713,24 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
                }
            }

            // Take the resolution only if the current printer supports is.
            Resolution oldResolution = currAttributes.getResolution();
            Resolution newResolution = newAttributes.getResolution();
            if (!oldResolution.equals(newResolution)) {
                PrinterCapabilitiesInfo capabilities = mCurrentPrinter.getCapabilities();
                if (capabilities != null) {
                    List<Resolution> resolutions = capabilities.getResolutions();
                    final int resolutionCount = resolutions.size();
                    for (int i = 0; i < resolutionCount; i++) {
                        Resolution resolution = resolutions.get(i);
                        if (resolution.equals(newResolution)) {
                            currAttributes.setResolution(resolution);
                            break;
                        }
                    }
                }
            }

            // Take the color mode only if the current printer supports it.
            final int currColorMode = currAttributes.getColorMode();
            final int newColorMode = newAttributes.getColorMode();
@@ -726,6 +745,7 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
                    }
                }
            }
        }

        // Handle selected page changes making sure they are in the doc.
        PrintDocumentInfo info = mPrintedDocument.getDocumentInfo().info;