summaryrefslogtreecommitdiffstats
path: root/packages/PrintSpooler/src
diff options
context:
space:
mode:
authorSvetoslav <svetoslavganov@google.com>2014-01-02 11:23:44 -0800
committerSvetoslav <svetoslavganov@google.com>2014-01-06 18:00:54 -0800
commitb0d97b87ba5f23ee867f381a4e5916ebb2e5f762 (patch)
tree5abd60fd9a75911d889eefbc5bd2b4308e3b9a16 /packages/PrintSpooler/src
parent23ab74de5eda745e2ef88bd156cde83fbcd4b5da (diff)
downloadframeworks_base-b0d97b87ba5f23ee867f381a4e5916ebb2e5f762.zip
frameworks_base-b0d97b87ba5f23ee867f381a4e5916ebb2e5f762.tar.gz
frameworks_base-b0d97b87ba5f23ee867f381a4e5916ebb2e5f762.tar.bz2
PrintSpooler crash if printer is reported to have only one color mode.
bug:11993304 Change-Id: I4932cf1b5b9b89f0cbf97011782ede037e7d814c
Diffstat (limited to 'packages/PrintSpooler/src')
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java16
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);