Skip to content

Commit 067b091

Browse files
committed
Accessibility query APIs report invisible views.
1. The accessibility querying APIs failed to check whether all predecessors of a view are visible before reporting it. bug:6291855 Change-Id: I364a6f08e8d02c7105c00c9fdff0fec033829554
1 parent f21bea2 commit 067b091

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/java/android/view/ViewRootImpl.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5071,9 +5071,13 @@ public void findAccessibilityNodeInfosByText(long accessibilityNodeId, String te
50715071
* @return Whether the view is visible on the screen.
50725072
*/
50735073
private boolean isDisplayedOnScreen(View view) {
5074+
// The first two checks are made also made by isShown() which
5075+
// however traverses the tree up to the parent to catch that.
5076+
// Therefore, we do some fail fast check to minimize the up
5077+
// tree traversal.
50745078
return (view.mAttachInfo != null
50755079
&& view.mAttachInfo.mWindowVisibility == View.VISIBLE
5076-
&& view.getVisibility() == View.VISIBLE
5080+
&& view.isShown()
50775081
&& view.getGlobalVisibleRect(mTempRect));
50785082
}
50795083

0 commit comments

Comments
 (0)