content: package okhttp3.internal.platform.android;
  
  import javax.net.ssl.SSLSocket;
  import javax.net.ssl.SSLSocketFactory;
  import javax.net.ssl.X509TrustManager;
  import kotlin.Metadata;
  import kotlin.jvm.internal.DefaultConstructorMarker;
  import kotlin.jvm.internal.Intrinsics;
  import okhttp3.internal.Util;
  import okhttp3.internal.platform.Platform;
  
  @Metadata(bv = {1, 0, 3}, d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u0000 \u000e2\u00020\u0001:\u0001\u000eB1\u0012\u000e\u0010\u0002\u001a\n\u0012\u0006\b\u0000\u0012\u00020\u00040\u0003\u0012\u000e\u0010\u0005\u001a\n\u0012\u0006\b\u0000\u0012\u00020\u00060\u0003\u0012\n\u0010\u0007\u001a\u0006\u0012\u0002\b\u00030\u0003¢\u0006\u0002\u0010\bJ\u0010\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\u0006H\u0016J\u0012\u0010\f\u001a\u0004\u0018\u00010\r2\u0006\u0010\u000b\u001a\u00020\u0006H\u0016R\u0012\u0010\u0007\u001a\u0006\u0012\u0002\b\u00030\u0003X\u0004¢\u0006\u0002\n\u0000R\u0016\u0010\u0005\u001a\n\u0012\u0006\b\u0000\u0012\u00020\u00060\u0003X\u0004¢\u0006\u0002\n\u0000¨\u0006\u000f"}, d2 = {"Lokhttp3/internal/platform/android/StandardAndroidSocketAdapter;", "Lokhttp3/internal/platform/android/AndroidSocketAdapter;", "sslSocketClass", "Ljava/lang/Class;", "Ljavax/net/ssl/SSLSocket;", "sslSocketFactoryClass", "Ljavax/net/ssl/SSLSocketFactory;", "paramClass", "(Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;)V", "matchesSocketFactory", "", "sslSocketFactory", "trustManager", "Ljavax/net/ssl/X509TrustManager;", "Companion", "okhttp"}, k = 1, mv = {1, 4, 0})
  /* compiled from: StandardAndroidSocketAdapter.kt */
  public final class StandardAndroidSocketAdapter extends AndroidSocketAdapter {
      public static final Companion Companion = new Companion((DefaultConstructorMarker) null);
      private final Class<?> paramClass;
      private final Class<? super SSLSocketFactory> sslSocketFactoryClass;
  
      @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\b\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0012\u0010\u0003\u001a\u0004\u0018\u00010\u00042\b\b\u0002\u0010\u0005\u001a\u00020\u0006¨\u0006\u0007"}, d2 = {"Lokhttp3/internal/platform/android/StandardAndroidSocketAdapter$Companion;", "", "()V", "buildIfSupported", "Lokhttp3/internal/platform/android/SocketAdapter;", "packageName", "", "okhttp"}, k = 1, mv = {1, 4, 0})
      /* compiled from: StandardAndroidSocketAdapter.kt */
      public static final class Companion {
          private Companion() {
          }
  
          public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
              this();
          }
  
          public static /* synthetic */ SocketAdapter buildIfSupported$default(Companion companion, String str, int i, Object obj) {
              if ((i & 1) != 0) {
                  str = "com.android.org.conscrypt";
              }
              return companion.buildIfSupported(str);
          }
  
          public final SocketAdapter buildIfSupported(String packageName) {
              Intrinsics.checkNotNullParameter(packageName, "packageName");
              try {
                  Class<?> cls = Class.forName(packageName + ".OpenSSLSocketImpl");
                  if (cls != null) {
                      Class<?> cls2 = Class.forName(packageName + ".OpenSSLSocketFactoryImpl");
                      if (cls2 != null) {
                          Class<?> cls3 = Class.forName(packageName + ".SSLParametersImpl");
                          Intrinsics.checkNotNullExpressionValue(cls3, "paramsClass");
                          return new StandardAndroidSocketAdapter(cls, cls2, cls3);
                      }
                      throw new NullPointerException("null cannot be cast to non-null type java.lang.Class<in javax.net.ssl.SSLSocketFactory>");
                  }
                  throw new NullPointerException("null cannot be cast to non-null type java.lang.Class<in javax.net.ssl.SSLSocket>");
              } catch (Exception e) {
                  Platform.Companion.get().log("unable to load android socket classes", 5, e);
                  return null;
              }
          }
      }
  
      /* JADX INFO: super call moved to the top of the method (can break code semantics) */
      public StandardAndroidSocketAdapter(Class<? super SSLSocket> sslSocketClass, Class<? super SSLSocketFactory> sslSocketFactoryClass2, Class<?> paramClass2) {
          super(sslSocketClass);
          Intrinsics.checkNotNullParameter(sslSocketClass, "sslSocketClass");
          Intrinsics.checkNotNullParameter(sslSocketFactoryClass2, "sslSocketFactoryClass");
          Intrinsics.checkNotNullParameter(paramClass2, "paramClass");
          this.sslSocketFactoryClass = sslSocketFactoryClass2;
          this.paramClass = paramClass2;
      }
  
      public boolean matchesSocketFactory(SSLSocketFactory sslSocketFactory) {
          Intrinsics.checkNotNullParameter(sslSocketFactory, "sslSocketFactory");
          return this.sslSocketFactoryClass.isInstance(sslSocketFactory);
      }
  
      public X509TrustManager trustManager(SSLSocketFactory sslSocketFactory) {
          Intrinsics.checkNotNullParameter(sslSocketFactory, "sslSocketFactory");
          Object readFieldOrNull = Util.readFieldOrNull(sslSocketFactory, this.paramClass, "sslParameters");
          Intrinsics.checkNotNull(readFieldOrNull);
          X509TrustManager x509TrustManager = (X509TrustManager) Util.readFieldOrNull(readFieldOrNull, X509TrustManager.class, "x509TrustManager");
          return x509TrustManager != null ? x509TrustManager : (X509TrustManager) Util.readFieldOrNull(readFieldOrNull, X509TrustManager.class, "trustManager");
      }
  }
  