diff options
author | Svetoslav <svetoslavganov@google.com> | 2014-01-07 02:03:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-01-07 02:03:01 +0000 |
commit | a7aa078fb2321233b16970c8bb014902318541d7 (patch) | |
tree | 878d2b11cda532a34c9e8b51d281f0dbc12c7df4 /packages | |
parent | e79c9561bf7a5987e5f5094727b530e54d14688c (diff) | |
parent | b0d97b87ba5f23ee867f381a4e5916ebb2e5f762 (diff) | |
download | frameworks_base-a7aa078fb2321233b16970c8bb014902318541d7.zip frameworks_base-a7aa078fb2321233b16970c8bb014902318541d7.tar.gz frameworks_base-a7aa078fb2321233b16970c8bb014902318541d7.tar.bz2 |
Merge "PrintSpooler crash if printer is reported to have only one color mode."
Diffstat (limited to 'packages')
-rw-r--r-- | packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java index e560d6e..e3d8d05 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java +++ b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java @@ -2206,12 +2206,16 @@ 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); - someAttributeSelectionChanged = true; + 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); |