Fixed a bug in DisplayUtils in which the length of entries will be added twice, causing IndexOutOfBound exception at runtime when using custom DPI

am: ab15e923a5

* commit 'ab15e923a599ff2a0d3712c5029eba5c4b4b75b5':
  Fixed a bug in DisplayUtils in which the length of entries will be added twice, causing IndexOutOfBound exception at runtime when using custom DPI
This commit is contained in:
Muyuan Li
2016-02-25 18:13:33 +00:00
committed by android-build-merger

View File

@@ -154,10 +154,11 @@ class DisplayDensityUtils {
} else { } else {
// We don't understand the current density. Must have been set by // We don't understand the current density. Must have been set by
// someone else. Make room for another entry... // someone else. Make room for another entry...
values = Arrays.copyOf(values, values.length + 1); int newLength = values.length + 1;
values = Arrays.copyOf(values, newLength);
values[curIndex] = currentDensity; values[curIndex] = currentDensity;
entries = Arrays.copyOf(entries, values.length + 1); entries = Arrays.copyOf(entries, newLength);
entries[curIndex] = res.getString(SUMMARY_CUSTOM, currentDensity); entries[curIndex] = res.getString(SUMMARY_CUSTOM, currentDensity);
displayIndex = curIndex; displayIndex = curIndex;