public static boolean isCompatible()

in java/main/com/facebook/profilo/provider/stacktrace/ArtCompatibility.java [44:114]


  public static boolean isCompatible(Context context) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
      return false;
    }

    Boolean cached = sIsCompatible.get();
    if (cached != null) {
      return cached;
    }

    try {
      File file = getFileForRelease(context);
      boolean result = false;

      if (file.exists()) {
        result = readCompatFile(file);
      } else {
        switch (Build.VERSION.RELEASE) {
          case "9":
          case "9.0":
          case "9.0.0":
            result = nativeCheck(CPUProfiler.TRACER_ART_UNWINDC_9_0_0);
            break;
          case "8.1.0":
            result = nativeCheck(CPUProfiler.TRACER_ART_UNWINDC_8_1_0);
            break;
          case "8.0.0":
            result = nativeCheck(CPUProfiler.TRACER_ART_UNWINDC_8_0_0);
            break;
          case "7.1.2":
            result = nativeCheck(CPUProfiler.TRACER_ART_UNWINDC_7_1_2);
            break;
          case "7.1.1":
            result = nativeCheck(CPUProfiler.TRACER_ART_UNWINDC_7_1_1);
            break;
          case "7.1":
          case "7.1.0":
            result = nativeCheck(CPUProfiler.TRACER_ART_UNWINDC_7_1_0);
            break;
          case "7.0":
          case "7.0.0":
            result = nativeCheck(CPUProfiler.TRACER_ART_UNWINDC_7_0_0);
            break;
          case "6.0":
          case "6.0.1":
            result = nativeCheck(CPUProfiler.TRACER_ART_UNWINDC_6_0);
            break;
          case "5.1":
          case "5.1.0":
          case "5.1.1":
            result = nativeCheck(CPUProfiler.TRACER_ART_UNWINDC_5_1);
            break;
          case "5.0":
          case "5.0.1":
          case "5.0.2":
            result = nativeCheck(CPUProfiler.TRACER_ART_UNWINDC_5_0);
            break;
        }
        writeCompatFile(file, result);
      }

      // Either a complete read or complete run + write. Safe to cache this value.
      if (sIsCompatible.compareAndSet(null, result)) {
        return result;
      } else {
        return sIsCompatible.get();
      }
    } catch (IOException e) {
      return false;
    }
  }