Skip to content

Commit 8a36e05

Browse files
author
Philip Milne
committed
Fix for layout parameter validation bug in GridLayout.
Bug 6404882. When a cell has an unspecified row and a column that is specified as greater than the specified number of columns, GridLayout fails to report or correct the error and loops indefinitely searching for a valid row to place the cell. There is a cyclic dependency between the validation of layout parameters (and allocation of undefined cell indexes) and the maximum column/row counts. A performance optimization in layout paramter allocation caused this dependency to be handled in correctly. The problem is fixed in this CL for this bug and the symmetric problem for rows. Change-Id: I0392343bc8a721a0ca7163f58f233ba8046c22e2
1 parent d72ad2a commit 8a36e05

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/java/android/widget/GridLayout.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ private static int clip(Interval minorRange, boolean minorWasDefined, int count)
658658
private void validateLayoutParams() {
659659
final boolean horizontal = (orientation == HORIZONTAL);
660660
final Axis axis = horizontal ? horizontalAxis : verticalAxis;
661-
final int count = (axis.definedCount != UNDEFINED) ? axis.definedCount : 0;
661+
final int count = max(0, axis.getCount()); // Handle negative values, including UNDEFINED
662662

663663
int major = 0;
664664
int minor = 0;

0 commit comments

Comments
 (0)