public static boolean hasText(@Nullable AccessibilityNodeInfoCompat node) {
    return node != null
        && node.getCollectionInfo() == null
        && (!TextUtils.isEmpty(node.getText()) || !TextUtils.isEmpty(node.getContentDescription()));
  }
Returns whether the specified node has text or a content description.

@param node The node to check.
@return {@code true} if the node has text.
core/src/main/java/com/facebook/testing/screenshot/layouthierarchy/AccessibilityUtil.java