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

Commit b0d97b87 authored by Svetoslav's avatar Svetoslav
Browse files

PrintSpooler crash if printer is reported to have only one color mode.

bug:11993304

Change-Id: I4932cf1b5b9b89f0cbf97011782ede037e7d814c
parent 23ab74de
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -2206,14 +2206,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