code: public static boolean nodeMatchesClassByType(
              Context context, AccessibilityNodeInfoCompat node, Class<?> referenceClass) {
          if ((node == null) || (referenceClass == null)) {
              return false;
          }
  
          // Attempt to take a shortcut.
          final CharSequence nodeClassName = node.getClassName();
          if (TextUtils.equals(nodeClassName, referenceClass.getName())) {
              return true;
          }
  
          final ClassLoadingManager loader = ClassLoadingManager.getInstance();
          final CharSequence appPackage = node.getPackageName();
          return loader.checkInstanceOf(context, nodeClassName, appPackage, referenceClass);
      }
docs: Determines if the generating class of an
  {@link AccessibilityNodeInfoCompat} matches a given {@link Class} by
  type.
  
  @param node A sealed {@link AccessibilityNodeInfoCompat} dispatched by
  the accessibility framework.
  @param referenceClass A {@link Class} to match by type or inherited type.
  @return {@code true} if the {@link AccessibilityNodeInfoCompat} object
  matches the {@link Class} by type or inherited type,
  {@code false} otherwise.