public static String getFocusableReasons()

in stetho/src/main/java/com/facebook/stetho/inspector/elements/android/AccessibilityNodeInfoWrapper.java [132:172]


  public static String getFocusableReasons(View view) {
    AccessibilityNodeInfoCompat node = createNodeInfoFromView(view);
    try {
      boolean hasText = AccessibilityUtil.hasText(node);
      boolean isCheckable = node.isCheckable();
      boolean hasNonActionableSpeakingDescendants =
          AccessibilityUtil.hasNonActionableSpeakingDescendants(node, view);

      if (AccessibilityUtil.isActionableForAccessibility(node)) {
        if (node.getChildCount() <= 0) {
          return "View is actionable and has no children.";
        } else if (hasText) {
          return "View is actionable and has a description.";
        } else if (isCheckable) {
          return "View is actionable and checkable.";
        } else if (hasNonActionableSpeakingDescendants) {
          return "View is actionable and has non-actionable descendants with descriptions.";
        }
      }

      if (AccessibilityUtil.isTopLevelScrollItem(node, view)) {
        if (hasText) {
          return "View is a direct child of a scrollable container and has a description.";
        } else if (isCheckable) {
          return "View is a direct child of a scrollable container and is checkable.";
        } else if (hasNonActionableSpeakingDescendants) {
          return
              "View is a direct child of a scrollable container and has non-actionable " +
              "descendants with descriptions.";
        }
      }

      if (hasText) {
        return "View has a description and is not actionable, but has no actionable ancestor.";
      }

      return null;
    } finally {
      node.recycle();
    }
  }