public static boolean isAccessibilityFocusable(
      @Nullable AccessibilityNodeInfoCompat node, @Nullable View view) {
    if (node == null || view == null) {
      return false;
    }

    // Never focus invisible nodes.
    if (!node.isVisibleToUser()) {
      return false;
    }

    // Always focus "actionable" nodes.
    if (isActionableForAccessibility(node)) {
      return true;
    }

    // only focus top-level list items with non-actionable speaking children.
    return isTopLevelScrollItem(node, view) && isSpeakingNode(node, view);
  }
Determines if the provided {@link View} and {@link AccessibilityNodeInfoCompat} meet the
criteria for gaining accessibility focus.

<p>Note: this is evaluating general focusability by accessibility services, and does not mean
this view will be guaranteed to be focused by specific services such as Talkback. For Talkback
focusability, see {@link #isTalkbackFocusable(View)}

@param view The {@link View} to evaluate
@param node The {@link AccessibilityNodeInfoCompat} to evaluate
@return {@code true} if it is possible to gain accessibility focus
core/src/main/java/com/facebook/testing/screenshot/layouthierarchy/AccessibilityUtil.java