content: /*
   * Decompiled with CFR 0.153-SNAPSHOT (d6f6758-dirty).
   */
  package okhttp3.internal.platform.android;
  
  import java.lang.reflect.Method;
  import kotlin.Metadata;
  import kotlin.jvm.internal.DefaultConstructorMarker;
  import kotlin.jvm.internal.Intrinsics;
  import org.jetbrains.annotations.NotNull;
  import org.jetbrains.annotations.Nullable;
  
  @Metadata(mv={1, 4, 0}, bv={1, 0, 3}, k=1, d1={"\u0000 \n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\b\u0000\u0018\u0000 \r2\u00020\u0001:\u0001\rB#\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\b\u0010\u0004\u001a\u0004\u0018\u00010\u0003\u0012\b\u0010\u0005\u001a\u0004\u0018\u00010\u0003\u00a2\u0006\u0002\u0010\u0006J\u0010\u0010\u0007\u001a\u0004\u0018\u00010\u00012\u0006\u0010\b\u001a\u00020\tJ\u0010\u0010\n\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\u0001R\u0010\u0010\u0002\u001a\u0004\u0018\u00010\u0003X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0003X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u0010\u0010\u0005\u001a\u0004\u0018\u00010\u0003X\u0082\u0004\u00a2\u0006\u0002\n\u0000\u00a8\u0006\u000e"}, d2={"Lokhttp3/internal/platform/android/CloseGuard;", "", "getMethod", "Ljava/lang/reflect/Method;", "openMethod", "warnIfOpenMethod", "(Ljava/lang/reflect/Method;Ljava/lang/reflect/Method;Ljava/lang/reflect/Method;)V", "createAndOpen", "closer", "", "warnIfOpen", "", "closeGuardInstance", "Companion", "okhttp"})
  public final class CloseGuard {
      private final Method getMethod;
      private final Method openMethod;
      private final Method warnIfOpenMethod;
      public static final Companion Companion = new Companion(null);
  
      @Nullable
      public final Object createAndOpen(@NotNull String closer) {
          Intrinsics.checkNotNullParameter(closer, "closer");
          if (this.getMethod != null) {
              try {
                  Object closeGuardInstance = this.getMethod.invoke(null, new Object[0]);
                  Method method = this.openMethod;
                  Intrinsics.checkNotNull(method);
                  method.invoke(closeGuardInstance, closer);
                  return closeGuardInstance;
              } catch (Exception exception) {
                  // empty catch block
              }
          }
          return null;
      }
  
      public final boolean warnIfOpen(@Nullable Object closeGuardInstance) {
          boolean reported = false;
          if (closeGuardInstance != null) {
              try {
                  Method method = this.warnIfOpenMethod;
                  Intrinsics.checkNotNull(method);
                  method.invoke(closeGuardInstance, new Object[0]);
                  reported = true;
              } catch (Exception exception) {
                  // empty catch block
              }
          }
          return reported;
      }
  
      public CloseGuard(@Nullable Method getMethod, @Nullable Method openMethod, @Nullable Method warnIfOpenMethod) {
          this.getMethod = getMethod;
          this.openMethod = openMethod;
          this.warnIfOpenMethod = warnIfOpenMethod;
      }
  
      @Metadata(mv={1, 4, 0}, bv={1, 0, 3}, k=1, d1={"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002\u00a2\u0006\u0002\u0010\u0002J\u0006\u0010\u0003\u001a\u00020\u0004\u00a8\u0006\u0005"}, d2={"Lokhttp3/internal/platform/android/CloseGuard$Companion;", "", "()V", "get", "Lokhttp3/internal/platform/android/CloseGuard;", "okhttp"})
      public static final class Companion {
          @NotNull
          public final CloseGuard get() {
              Method getMethod = null;
              Method openMethod = null;
              Method warnIfOpenMethod = null;
              try {
                  Class<?> closeGuardClass = Class.forName("dalvik.system.CloseGuard");
                  getMethod = closeGuardClass.getMethod("get", new Class[0]);
                  openMethod = closeGuardClass.getMethod("open", String.class);
                  warnIfOpenMethod = closeGuardClass.getMethod("warnIfOpen", new Class[0]);
              } catch (Exception _) {
                  getMethod = null;
                  openMethod = null;
                  warnIfOpenMethod = null;
              }
              return new CloseGuard(getMethod, openMethod, warnIfOpenMethod);
          }
  
          private Companion() {
          }
  
          public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
              this();
          }
      }
  }
  
  