Skip to content

Commit 52a6237

Browse files
committed
Virtual nodes are always important for accessibility.
1. Virtual nodes should be made important since the implementer of the tree represented by the nodes decides which node to report. In the case with native widgets we decide in the framework but in the case of the node provider, the implementer of the latter makes the call. Hence, if a node in not important the provider should not report it in the first place. The issue this patch solves is to allow events from virtual nodes to be propagated to the accessibility services. bug:6432588 Change-Id: Ie01f84e9e0ef2280da934b98283962a5db38abc2
1 parent 19eaf0a commit 52a6237

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/java/android/view/accessibility/AccessibilityRecord.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,12 @@ public void setSource(View source) {
135135
*/
136136
public void setSource(View root, int virtualDescendantId) {
137137
enforceNotSealed();
138-
final boolean important = (root != null) ? root.isImportantForAccessibility() : true;
138+
final boolean important;
139+
if (virtualDescendantId == UNDEFINED) {
140+
important = (root != null) ? root.isImportantForAccessibility() : true;
141+
} else {
142+
important = true;
143+
}
139144
setBooleanProperty(PROPERTY_IMPORTANT_FOR_ACCESSIBILITY, important);
140145
mSourceWindowId = (root != null) ? root.getAccessibilityWindowId() : UNDEFINED;
141146
final int rootViewId = (root != null) ? root.getAccessibilityViewId() : UNDEFINED;

0 commit comments

Comments
 (0)