Fix IndexOutOfBoundsException when calling dispatchProvideStructure()
dispatchProvideStructure() will get preorderedList by buildOrderedChildList(). buildOrderedChildList() returns mPreSortedChildren directly. During the traversal, the mPreSortedChildren is changed by the View#populateAccessibilityNodeInfoDrawingOrderInParent(). When one of child traversal is done, the preorderedList is already changed, the IndexOutOfBoundsException will occurr when trying to travese the next child. To fix it, try to make a copy not directly refer to mPreSortedChildren. Bug: 185971133 Test: manual. App doesn't crash Test: atest CtsAutoFillServiceTestCases Change-Id: Ie077948dd45426c1204d153ca0a921c7c67351d8
This commit is contained in:
@@ -3581,7 +3581,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
||||
}
|
||||
|
||||
structure.setChildCount(childrenCount);
|
||||
ArrayList<View> preorderedList = buildOrderedChildList();
|
||||
ArrayList<View> tempPreorderedList = buildOrderedChildList();
|
||||
ArrayList<View> preorderedList =
|
||||
tempPreorderedList != null ? new ArrayList<>(tempPreorderedList) : null;
|
||||
boolean customOrder = preorderedList == null
|
||||
&& isChildrenDrawingOrderEnabled();
|
||||
for (int i = 0; i < childrenCount; i++) {
|
||||
|
||||
Reference in New Issue
Block a user