public static AccessibilityNodeInfoCompat searchFocus(TraversalStrategy traversal,AccessibilityNodeInfoCompat currentFocus,int direction,NodeFilter filter){
  if (traversal == null || currentFocus == null) {
    return null;
  }
  if (filter == null) {
    filter=DEFAULT_FILTER;
  }
  AccessibilityNodeInfoCompat targetNode=AccessibilityNodeInfoCompat.obtain(currentFocus);
  Set<AccessibilityNodeInfoCompat> seenNodes=new HashSet<>();
  try {
    do {
      seenNodes.add(targetNode);
      targetNode=traversal.findFocus(targetNode,direction);
      if (seenNodes.contains(targetNode)) {
        LogUtils.log(AccessibilityNodeInfoUtils.class,Log.ERROR,"Found duplicate during traversal: %s",targetNode.getInfo());
        return null;
      }
    }
 while (targetNode != null && !filter.accept(targetNode));
  }
  finally {
    AccessibilityNodeInfoUtils.recycleNodes(seenNodes);
  }
  return targetNode;
}

public static AccessibilityNodeInfoCompat searchFocus ( TraversalStrategy traversal , AccessibilityNodeInfoCompat currentFocus , int direction , NodeFilter filter ) { if ( traversal == null || currentFocus == null ) { return null ; } if ( filter == null ) { filter = DEFAULT_FILTER ; } AccessibilityNodeInfoCompat targetNode = AccessibilityNodeInfoCompat . obtain ( currentFocus ) ; Set < AccessibilityNodeInfoCompat > seenNodes = new HashSet < > ( ) ; try { do { seenNodes . add ( targetNode ) ; targetNode = traversal . findFocus ( targetNode , direction ) ; if ( seenNodes . contains ( targetNode ) ) { LogUtils . log ( AccessibilityNodeInfoUtils . class , Log . ERROR , "Found duplicate during traversal: %s" , targetNode . getInfo ( ) ) ; return null ; } } while ( targetNode != null && ! filter . accept ( targetNode ) ) ; } finally { AccessibilityNodeInfoUtils . recycleNodes ( seenNodes ) ; } return targetNode ; }
search focus that satisfied specified node filter from currentfocus to specified direction according to ordertraversal strategy
