@@ -4529,7 +4529,7 @@ public void findAccessibilityNodeInfoByAccessibilityIdUiThread(Message message)
45294529 predicate .init (accessibilityId );
45304530 View root = ViewRootImpl .this .mView ;
45314531 View target = root .findViewByPredicate (predicate );
4532- if (target != null && target .isShown () ) {
4532+ if (target != null && target .getVisibility () == View . VISIBLE ) {
45334533 info = target .createAccessibilityNodeInfo ();
45344534 }
45354535 } finally {
@@ -4572,7 +4572,7 @@ public void findAccessibilityNodeInfoByViewIdUiThread(Message message) {
45724572 try {
45734573 View root = ViewRootImpl .this .mView ;
45744574 View target = root .findViewById (viewId );
4575- if (target != null && target .isShown () ) {
4575+ if (target != null && target .getVisibility () == View . VISIBLE ) {
45764576 info = target .createAccessibilityNodeInfo ();
45774577 }
45784578 } finally {
@@ -4623,14 +4623,14 @@ public void findAccessibilityNodeInfosByViewTextUiThread(Message message) {
46234623 ArrayList <View > foundViews = mAttachInfo .mFocusablesTempList ;
46244624 foundViews .clear ();
46254625
4626- View root ;
4626+ View root = null ;
46274627 if (accessibilityViewId != View .NO_ID ) {
46284628 root = findViewByAccessibilityId (accessibilityViewId );
46294629 } else {
46304630 root = ViewRootImpl .this .mView ;
46314631 }
46324632
4633- if (root == null || ! root .isShown () ) {
4633+ if (root == null || root .getVisibility () != View . VISIBLE ) {
46344634 return ;
46354635 }
46364636
@@ -4645,7 +4645,7 @@ public void findAccessibilityNodeInfosByViewTextUiThread(Message message) {
46454645 final int viewCount = foundViews .size ();
46464646 for (int i = 0 ; i < viewCount ; i ++) {
46474647 View foundView = foundViews .get (i );
4648- if (foundView .isShown () ) {
4648+ if (foundView .getVisibility () == View . VISIBLE ) {
46494649 infos .add (foundView .createAccessibilityNodeInfo ());
46504650 }
46514651 }
@@ -4718,7 +4718,7 @@ public void perfromAccessibilityActionUiThread(Message message) {
47184718
47194719 private boolean performActionFocus (int accessibilityId ) {
47204720 View target = findViewByAccessibilityId (accessibilityId );
4721- if (target == null ) {
4721+ if (target == null || target . getVisibility () != View . VISIBLE ) {
47224722 return false ;
47234723 }
47244724 // Get out of touch mode since accessibility wants to move focus around.
@@ -4728,7 +4728,7 @@ private boolean performActionFocus(int accessibilityId) {
47284728
47294729 private boolean performActionClearFocus (int accessibilityId ) {
47304730 View target = findViewByAccessibilityId (accessibilityId );
4731- if (target == null ) {
4731+ if (target == null || target . getVisibility () != View . VISIBLE ) {
47324732 return false ;
47334733 }
47344734 if (!target .isFocused ()) {
@@ -4740,7 +4740,7 @@ private boolean performActionClearFocus(int accessibilityId) {
47404740
47414741 private boolean performActionSelect (int accessibilityId ) {
47424742 View target = findViewByAccessibilityId (accessibilityId );
4743- if (target == null ) {
4743+ if (target == null || target . getVisibility () != View . VISIBLE ) {
47444744 return false ;
47454745 }
47464746 if (target .isSelected ()) {
@@ -4752,7 +4752,7 @@ private boolean performActionSelect(int accessibilityId) {
47524752
47534753 private boolean performActionClearSelection (int accessibilityId ) {
47544754 View target = findViewByAccessibilityId (accessibilityId );
4755- if (target == null ) {
4755+ if (target == null || target . getVisibility () != View . VISIBLE ) {
47564756 return false ;
47574757 }
47584758 if (!target .isSelected ()) {
@@ -4769,18 +4769,21 @@ private View findViewByAccessibilityId(int accessibilityId) {
47694769 }
47704770 mFindByAccessibilityIdPredicate .init (accessibilityId );
47714771 View foundView = root .findViewByPredicate (mFindByAccessibilityIdPredicate );
4772- return (foundView != null && foundView .isShown ()) ? foundView : null ;
4772+ if (foundView == null || foundView .getVisibility () != View .VISIBLE ) {
4773+ return null ;
4774+ }
4775+ return foundView ;
47734776 }
47744777
47754778 private final class FindByAccessibilitytIdPredicate implements Predicate <View > {
4776- public int mSerchedId ;
4779+ public int mSearchedId ;
47774780
47784781 public void init (int searchedId ) {
4779- mSerchedId = searchedId ;
4782+ mSearchedId = searchedId ;
47804783 }
47814784
47824785 public boolean apply (View view ) {
4783- return (view .getAccessibilityViewId () == mSerchedId );
4786+ return (view .getAccessibilityViewId () == mSearchedId );
47844787 }
47854788 }
47864789 }
0 commit comments