public static AccessibilityRole getRole(View view) {
    AccessibilityNodeInfoCompat nodeInfo = createNodeInfoFromView(view);
    if (nodeInfo == null) {
      return AccessibilityRole.NONE;
    }

    AccessibilityRole role = getRole(nodeInfo);
    nodeInfo.recycle();
    return role;
  }
Gets the role from a given {@link View}. If no role is defined it will return
AccessibilityRole.NONE, which has a value of null.

@param view The View to check.
@return {@code AccessibilityRole} the defined role.
core/src/main/java/com/facebook/testing/screenshot/layouthierarchy/AccessibilityUtil.java