content: package okhttp3.internal.platform;
  
  import android.os.Build;
  import android.security.NetworkSecurityPolicy;
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.Iterator;
  import java.util.List;
  import javax.net.ssl.SSLSocket;
  import javax.net.ssl.SSLSocketFactory;
  import javax.net.ssl.X509TrustManager;
  import kotlin.Metadata;
  import kotlin.collections.CollectionsKt;
  import kotlin.jvm.internal.DefaultConstructorMarker;
  import kotlin.jvm.internal.Intrinsics;
  import okhttp3.Protocol;
  import okhttp3.internal.platform.android.Android10SocketAdapter;
  import okhttp3.internal.platform.android.AndroidCertificateChainCleaner;
  import okhttp3.internal.platform.android.AndroidSocketAdapter;
  import okhttp3.internal.platform.android.BouncyCastleSocketAdapter;
  import okhttp3.internal.platform.android.ConscryptSocketAdapter;
  import okhttp3.internal.platform.android.DeferredSocketAdapter;
  import okhttp3.internal.platform.android.SocketAdapter;
  import okhttp3.internal.tls.CertificateChainCleaner;
  
  @Metadata(bv = {1, 0, 3}, d1 = {"\u0000J\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0007\u0018\u0000 \u00172\u00020\u0001:\u0001\u0017B\u0005¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\tH\u0016J(\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\r2\b\u0010\u000e\u001a\u0004\u0018\u00010\u000f2\f\u0010\u0010\u001a\b\u0012\u0004\u0012\u00020\u00110\u0004H\u0016J\u0012\u0010\u0012\u001a\u0004\u0018\u00010\u000f2\u0006\u0010\f\u001a\u00020\rH\u0016J\u0010\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u000e\u001a\u00020\u000fH\u0017J\u0012\u0010\b\u001a\u0004\u0018\u00010\t2\u0006\u0010\u0015\u001a\u00020\u0016H\u0016R\u0014\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X\u0004¢\u0006\u0002\n\u0000¨\u0006\u0018"}, d2 = {"Lokhttp3/internal/platform/Android10Platform;", "Lokhttp3/internal/platform/Platform;", "()V", "socketAdapters", "", "Lokhttp3/internal/platform/android/SocketAdapter;", "buildCertificateChainCleaner", "Lokhttp3/internal/tls/CertificateChainCleaner;", "trustManager", "Ljavax/net/ssl/X509TrustManager;", "configureTlsExtensions", "", "sslSocket", "Ljavax/net/ssl/SSLSocket;", "hostname", "", "protocols", "Lokhttp3/Protocol;", "getSelectedProtocol", "isCleartextTrafficPermitted", "", "sslSocketFactory", "Ljavax/net/ssl/SSLSocketFactory;", "Companion", "okhttp"}, k = 1, mv = {1, 4, 0})
  /* compiled from: Android10Platform.kt */
  public final class Android10Platform extends Platform {
      public static final Companion Companion = new Companion((DefaultConstructorMarker) null);
      /* access modifiers changed from: private */
      public static final boolean isSupported = (Platform.Companion.isAndroid() && Build.VERSION.SDK_INT >= 29);
      private final List<SocketAdapter> socketAdapters;
  
      @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\b\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\b\u0010\u0006\u001a\u0004\u0018\u00010\u0007R\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0003\u0010\u0005¨\u0006\b"}, d2 = {"Lokhttp3/internal/platform/Android10Platform$Companion;", "", "()V", "isSupported", "", "()Z", "buildIfSupported", "Lokhttp3/internal/platform/Platform;", "okhttp"}, k = 1, mv = {1, 4, 0})
      /* compiled from: Android10Platform.kt */
      public static final class Companion {
          private Companion() {
          }
  
          public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
              this();
          }
  
          public final Platform buildIfSupported() {
              if (isSupported()) {
                  return new Android10Platform();
              }
              return null;
          }
  
          public final boolean isSupported() {
              return Android10Platform.isSupported;
          }
      }
  
      public Android10Platform() {
          SocketAdapter[] socketAdapterArr = {Android10SocketAdapter.Companion.buildIfSupported(), new DeferredSocketAdapter(AndroidSocketAdapter.Companion.getPlayProviderFactory()), new DeferredSocketAdapter(ConscryptSocketAdapter.Companion.getFactory()), new DeferredSocketAdapter(BouncyCastleSocketAdapter.Companion.getFactory())};
          Collection arrayList = new ArrayList();
          for (Object next : CollectionsKt.listOfNotNull((T[]) socketAdapterArr)) {
              if (((SocketAdapter) next).isSupported()) {
                  arrayList.add(next);
              }
          }
          this.socketAdapters = (List) arrayList;
      }
  
      public CertificateChainCleaner buildCertificateChainCleaner(X509TrustManager trustManager) {
          Intrinsics.checkNotNullParameter(trustManager, "trustManager");
          AndroidCertificateChainCleaner buildIfSupported = AndroidCertificateChainCleaner.Companion.buildIfSupported(trustManager);
          return buildIfSupported != null ? buildIfSupported : super.buildCertificateChainCleaner(trustManager);
      }
  
      public void configureTlsExtensions(SSLSocket sslSocket, String hostname, List<? extends Protocol> protocols) {
          Object obj;
          Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
          Intrinsics.checkNotNullParameter(protocols, "protocols");
          Iterator it = this.socketAdapters.iterator();
          while (true) {
              if (!it.hasNext()) {
                  obj = null;
                  break;
              }
              obj = it.next();
              if (((SocketAdapter) obj).matchesSocket(sslSocket)) {
                  break;
              }
          }
          SocketAdapter socketAdapter = (SocketAdapter) obj;
          if (socketAdapter != null) {
              socketAdapter.configureTlsExtensions(sslSocket, hostname, protocols);
          }
      }
  
      public String getSelectedProtocol(SSLSocket sslSocket) {
          Object obj;
          Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
          Iterator it = this.socketAdapters.iterator();
          while (true) {
              if (!it.hasNext()) {
                  obj = null;
                  break;
              }
              obj = it.next();
              if (((SocketAdapter) obj).matchesSocket(sslSocket)) {
                  break;
              }
          }
          SocketAdapter socketAdapter = (SocketAdapter) obj;
          if (socketAdapter != null) {
              return socketAdapter.getSelectedProtocol(sslSocket);
          }
          return null;
      }
  
      public boolean isCleartextTrafficPermitted(String hostname) {
          Intrinsics.checkNotNullParameter(hostname, "hostname");
          return NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted(hostname);
      }
  
      public X509TrustManager trustManager(SSLSocketFactory sslSocketFactory) {
          Object obj;
          Intrinsics.checkNotNullParameter(sslSocketFactory, "sslSocketFactory");
          Iterator it = this.socketAdapters.iterator();
          while (true) {
              if (!it.hasNext()) {
                  obj = null;
                  break;
              }
              obj = it.next();
              if (((SocketAdapter) obj).matchesSocketFactory(sslSocketFactory)) {
                  break;
              }
          }
          SocketAdapter socketAdapter = (SocketAdapter) obj;
          if (socketAdapter != null) {
              return socketAdapter.trustManager(sslSocketFactory);
          }
          return null;
      }
  }
  