/** Checks whether or not touch to explore is enabled on the system. */
  public boolean accessibilityIsAvailable() {
    if (!getAccessibilityManager().isEnabled()
        || mContentViewCore.getContentSettings() == null
        || !mContentViewCore.getContentSettings().getJavaScriptEnabled()) {
      return false;
    }

    try {
      // Check that there is actually a service running that requires injecting this script.
      List<AccessibilityServiceInfo> services =
          getAccessibilityManager()
              .getEnabledAccessibilityServiceList(
                  FEEDBACK_BRAILLE | AccessibilityServiceInfo.FEEDBACK_SPOKEN);
      return services.size() > 0;
    } catch (NullPointerException e) {
      // getEnabledAccessibilityServiceList() can throw an NPE due to a bad
      // AccessibilityService.
      return false;
    }
  }