@@ -4543,7 +4543,7 @@ public void findAccessibilityNodeInfoByAccessibilityIdUiThread(Message message)
45434543 predicate .init (accessibilityId );
45444544 View root = ViewRootImpl .this .mView ;
45454545 View target = root .findViewByPredicate (predicate );
4546- if (target != null && target .isShown () ) {
4546+ if (target != null && target .getVisibility () == View . VISIBLE ) {
45474547 info = target .createAccessibilityNodeInfo ();
45484548 }
45494549 } finally {
@@ -4586,7 +4586,7 @@ public void findAccessibilityNodeInfoByViewIdUiThread(Message message) {
45864586 try {
45874587 View root = ViewRootImpl .this .mView ;
45884588 View target = root .findViewById (viewId );
4589- if (target != null && target .isShown () ) {
4589+ if (target != null && target .getVisibility () == View . VISIBLE ) {
45904590 info = target .createAccessibilityNodeInfo ();
45914591 }
45924592 } finally {
@@ -4637,14 +4637,14 @@ public void findAccessibilityNodeInfosByViewTextUiThread(Message message) {
46374637 ArrayList <View > foundViews = mAttachInfo .mFocusablesTempList ;
46384638 foundViews .clear ();
46394639
4640- View root ;
4640+ View root = null ;
46414641 if (accessibilityViewId != View .NO_ID ) {
46424642 root = findViewByAccessibilityId (accessibilityViewId );
46434643 } else {
46444644 root = ViewRootImpl .this .mView ;
46454645 }
46464646
4647- if (root == null || ! root .isShown () ) {
4647+ if (root == null || root .getVisibility () != View . VISIBLE ) {
46484648 return ;
46494649 }
46504650
@@ -4659,7 +4659,7 @@ public void findAccessibilityNodeInfosByViewTextUiThread(Message message) {
46594659 final int viewCount = foundViews .size ();
46604660 for (int i = 0 ; i < viewCount ; i ++) {
46614661 View foundView = foundViews .get (i );
4662- if (foundView .isShown () ) {
4662+ if (foundView .getVisibility () == View . VISIBLE ) {
46634663 infos .add (foundView .createAccessibilityNodeInfo ());
46644664 }
46654665 }
@@ -4732,7 +4732,7 @@ public void perfromAccessibilityActionUiThread(Message message) {
47324732
47334733 private boolean performActionFocus (int accessibilityId ) {
47344734 View target = findViewByAccessibilityId (accessibilityId );
4735- if (target == null ) {
4735+ if (target == null || target . getVisibility () != View . VISIBLE ) {
47364736 return false ;
47374737 }
47384738 // Get out of touch mode since accessibility wants to move focus around.
@@ -4742,7 +4742,7 @@ private boolean performActionFocus(int accessibilityId) {
47424742
47434743 private boolean performActionClearFocus (int accessibilityId ) {
47444744 View target = findViewByAccessibilityId (accessibilityId );
4745- if (target == null ) {
4745+ if (target == null || target . getVisibility () != View . VISIBLE ) {
47464746 return false ;
47474747 }
47484748 if (!target .isFocused ()) {
@@ -4754,7 +4754,7 @@ private boolean performActionClearFocus(int accessibilityId) {
47544754
47554755 private boolean performActionSelect (int accessibilityId ) {
47564756 View target = findViewByAccessibilityId (accessibilityId );
4757- if (target == null ) {
4757+ if (target == null || target . getVisibility () != View . VISIBLE ) {
47584758 return false ;
47594759 }
47604760 if (target .isSelected ()) {
@@ -4766,7 +4766,7 @@ private boolean performActionSelect(int accessibilityId) {
47664766
47674767 private boolean performActionClearSelection (int accessibilityId ) {
47684768 View target = findViewByAccessibilityId (accessibilityId );
4769- if (target == null ) {
4769+ if (target == null || target . getVisibility () != View . VISIBLE ) {
47704770 return false ;
47714771 }
47724772 if (!target .isSelected ()) {
@@ -4783,18 +4783,21 @@ private View findViewByAccessibilityId(int accessibilityId) {
47834783 }
47844784 mFindByAccessibilityIdPredicate .init (accessibilityId );
47854785 View foundView = root .findViewByPredicate (mFindByAccessibilityIdPredicate );
4786- return (foundView != null && foundView .isShown ()) ? foundView : null ;
4786+ if (foundView == null || foundView .getVisibility () != View .VISIBLE ) {
4787+ return null ;
4788+ }
4789+ return foundView ;
47874790 }
47884791
47894792 private final class FindByAccessibilitytIdPredicate implements Predicate <View > {
4790- public int mSerchedId ;
4793+ public int mSearchedId ;
47914794
47924795 public void init (int searchedId ) {
4793- mSerchedId = searchedId ;
4796+ mSearchedId = searchedId ;
47944797 }
47954798
47964799 public boolean apply (View view ) {
4797- return (view .getAccessibilityViewId () == mSerchedId );
4800+ return (view .getAccessibilityViewId () == mSearchedId );
47984801 }
47994802 }
48004803 }
0 commit comments