Skip to content

Commit 30ac645

Browse files
committed
AccessibilityInteractionController crash with IndexOutOfBoundException.
1. The findAccessibilityNodeInfosByTextUiThread was reusing an ArrayList instance also used by the logic to initialize an AccessibilityNodeInfo. Hence, if the find method got some view and creates the infos for them the method creating the info was reusing the same array list and was nuking its contents. bug:6556585 Change-Id: I1d013bf7b1f715f8b4c4ba60c677233bec40647c
1 parent 5ab6e12 commit 30ac645

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/java/android/view/AccessibilityInteractionController.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ final class AccessibilityInteractionController {
6262

6363
private final int mMyProcessId;
6464

65+
private final ArrayList<View> mTempArrayList = new ArrayList<View>();
66+
6567
public AccessibilityInteractionController(ViewRootImpl viewRootImpl) {
6668
Looper looper = viewRootImpl.mHandler.getLooper();
6769
mMyLooperThreadId = looper.getThread().getId();
@@ -313,7 +315,7 @@ private void findAccessibilityNodeInfosByTextUiThread(Message message) {
313315
infos = provider.findAccessibilityNodeInfosByText(text,
314316
virtualDescendantId);
315317
} else if (virtualDescendantId == AccessibilityNodeInfo.UNDEFINED) {
316-
ArrayList<View> foundViews = mViewRootImpl.mAttachInfo.mTempArrayList;
318+
ArrayList<View> foundViews = mTempArrayList;
317319
foundViews.clear();
318320
root.findViewsWithText(foundViews, text, View.FIND_VIEWS_WITH_TEXT
319321
| View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION

0 commit comments

Comments
 (0)