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

Commit 78a06696 authored by Svetoslav's avatar Svetoslav Committed by Android Git Automerger
Browse files

am 90119082: am 358eaa78: am fc1d0471: am 11b7d9fa: Merge "PrintSpooler crash...

am 90119082: am 358eaa78: am fc1d0471: am 11b7d9fa: Merge "PrintSpooler crash if printer is reported to have only one color mode." into klp-dev

* commit '90119082':
  PrintSpooler crash if printer is reported to have only one color mode.
parents 1b2a09d4 90119082
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -475,6 +475,12 @@ public final class PrinterCapabilitiesInfo implements Parcelable {
         * @param colorModes The color mode bit mask.
         * @param defaultColorMode The default color mode.
         * @return This builder.
         * <p>
         * <strong>Note:</strong> On platform version 19 (Kitkat) specifying
         * only PrintAttributes#COLOR_MODE_MONOCHROME leads to a print spooler
         * crash. Hence, you should declare either both color modes or
         * PrintAttributes#COLOR_MODE_COLOR.
         * </p>
         *
         * @throws IllegalArgumentException If color modes contains an invalid
         *         mode bit or if the default color mode is invalid.
+10 −6
Original line number Diff line number Diff line
@@ -2190,14 +2190,18 @@ public class PrintJobConfigActivity extends Activity {
                        // Select the old color mode - nothing really changed.
                        setColorModeSpinnerSelectionNoCallback(oldColorModeNewIndex);
                    } else {
                        final int selectedColorModeIndex = Integer.numberOfTrailingZeros(
                                    (colorModes & defaultAttributes.getColorMode()));
                        setColorModeSpinnerSelectionNoCallback(selectedColorModeIndex);
                        mCurrPrintAttributes.setColorMode(mColorModeSpinnerAdapter
                                .getItem(selectedColorModeIndex).value);
                        final int selectedColorMode = colorModes & defaultAttributes.getColorMode();
                        final int itemCount = mColorModeSpinnerAdapter.getCount();
                        for (int i = 0; i < itemCount; i++) {
                            SpinnerItem<Integer> item = mColorModeSpinnerAdapter.getItem(i);
                            if (selectedColorMode == item.value) {
                                setColorModeSpinnerSelectionNoCallback(i);
                                mCurrPrintAttributes.setColorMode(selectedColorMode);
                                someAttributeSelectionChanged = true;
                            }
                        }
                    }
                }
                mColorModeSpinner.setEnabled(true);

                // Orientation