Merge "Workaround for AIOOB exception in ProximityInfo"

main
Ken Wakasa 2013-08-29 08:11:20 +00:00 committed by Android (Google) Code Review
commit 2cbc7c682d
1 changed files with 3 additions and 1 deletions

View File

@ -342,7 +342,9 @@ y |---+---+---+---+-v-+-|-+---+---+---+---+---| | thresholdBase and get
for (int centerY = yStart; centerY <= yEnd; centerY += mCellHeight) {
int index = baseIndexOfCurrentRow;
for (int centerX = xStart; centerX <= xEnd; centerX += mCellWidth) {
if (key.squaredDistanceToEdge(centerX, centerY) < thresholdSquared) {
// TODO: Remove "index < neighborCountPerCell.length" below.
if (index < neighborCountPerCell.length
&& key.squaredDistanceToEdge(centerX, centerY) < thresholdSquared) {
neighborsFlatBuffer[index * keyCount + neighborCountPerCell[index]] = key;
++neighborCountPerCell[index];
}