From 55bdb10c168615ee7721c657e0633b3aefbff777 Mon Sep 17 00:00:00 2001 From: Svet Ganov Date: Fri, 6 Feb 2015 12:41:17 -0800 Subject: Accessibility: ignore children of a view with node provider. A view that has an accessibility node provider should not have real children since the provider is responsible to generate the node infos for the subtree rooted at its hosting view. This is how the APIs are designed to work. However, it is a common mistake and if this occurs the accessibility services introspecting the screen get into an infinite loop. The framework now does not add the real children of a view with a node provider to the list of accessibility children. If the developer wants them exposed they have to do that via the provider APIs as per contract. bug:19297093 Change-Id: I1b01b1e4a85e1c397886fcd2506b434beb063687 --- core/java/android/view/ViewGroup.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/java/android/view/ViewGroup.java') diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index fd50c4d..1be2940b 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2681,6 +2681,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager @Override void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); + if (getAccessibilityNodeProvider() != null) { + return; + } if (mAttachInfo != null) { final ArrayList childrenForAccessibility = mAttachInfo.mTempArrayList; childrenForAccessibility.clear(); -- cgit v1.1