content: package okhttp3.internal.platform.android;
  
  import android.net.ssl.SSLSockets;
  import android.os.Build;
  import java.io.IOException;
  import java.util.List;
  import javax.net.ssl.SSLParameters;
  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.HttpUrl;
  import okhttp3.Protocol;
  import okhttp3.internal.platform.Platform;
  import okhttp3.internal.platform.android.SocketAdapter;
  
  @Metadata(bv = {1, 0, 3}, d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0003\b\u0007\u0018\u0000 \u00102\u00020\u0001:\u0001\u0010B\u0005¢\u0006\u0002\u0010\u0002J(\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\b\u0010\u0007\u001a\u0004\u0018\u00010\b2\f\u0010\t\u001a\b\u0012\u0004\u0012\u00020\u000b0\nH\u0017J\u0012\u0010\f\u001a\u0004\u0018\u00010\b2\u0006\u0010\u0005\u001a\u00020\u0006H\u0017J\b\u0010\r\u001a\u00020\u000eH\u0016J\u0010\u0010\u000f\u001a\u00020\u000e2\u0006\u0010\u0005\u001a\u00020\u0006H\u0016¨\u0006\u0011"}, d2 = {"Lokhttp3/internal/platform/android/Android10SocketAdapter;", "Lokhttp3/internal/platform/android/SocketAdapter;", "()V", "configureTlsExtensions", "", "sslSocket", "Ljavax/net/ssl/SSLSocket;", "hostname", "", "protocols", "", "Lokhttp3/Protocol;", "getSelectedProtocol", "isSupported", "", "matchesSocket", "Companion", "okhttp"}, k = 1, mv = {1, 4, 0})
  /* compiled from: Android10SocketAdapter.kt */
  public final class Android10SocketAdapter implements SocketAdapter {
      public static final Companion Companion = new Companion((DefaultConstructorMarker) null);
  
      @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\u000b\n\u0000\b\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\b\u0010\u0003\u001a\u0004\u0018\u00010\u0004J\u0006\u0010\u0005\u001a\u00020\u0006¨\u0006\u0007"}, d2 = {"Lokhttp3/internal/platform/android/Android10SocketAdapter$Companion;", "", "()V", "buildIfSupported", "Lokhttp3/internal/platform/android/SocketAdapter;", "isSupported", "", "okhttp"}, k = 1, mv = {1, 4, 0})
      /* compiled from: Android10SocketAdapter.kt */
      public static final class Companion {
          private Companion() {
          }
  
          public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
              this();
          }
  
          public final SocketAdapter buildIfSupported() {
              if (isSupported()) {
                  return new Android10SocketAdapter();
              }
              return null;
          }
  
          public final boolean isSupported() {
              return Platform.Companion.isAndroid() && Build.VERSION.SDK_INT >= 29;
          }
      }
  
      public void configureTlsExtensions(SSLSocket sslSocket, String hostname, List<? extends Protocol> protocols) {
          Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
          Intrinsics.checkNotNullParameter(protocols, "protocols");
          try {
              SSLSockets.setUseSessionTickets(sslSocket, true);
              SSLParameters sSLParameters = sslSocket.getSSLParameters();
              Intrinsics.checkNotNullExpressionValue(sSLParameters, "sslParameters");
              Object[] array = Platform.Companion.alpnProtocolNames(protocols).toArray(new String[0]);
              if (array != null) {
                  sSLParameters.setApplicationProtocols((String[]) array);
                  sslSocket.setSSLParameters(sSLParameters);
                  return;
              }
              throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
          } catch (IllegalArgumentException e) {
              throw new IOException("Android internal error", e);
          }
      }
  
      public String getSelectedProtocol(SSLSocket sslSocket) {
          Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
          String applicationProtocol = sslSocket.getApplicationProtocol();
          if (applicationProtocol != null) {
              String str = applicationProtocol;
              switch (applicationProtocol.hashCode()) {
                  case 0:
                      if (applicationProtocol.equals(HttpUrl.FRAGMENT_ENCODE_SET)) {
                          String str2 = str;
                          break;
                      } else {
                          return str;
                      }
                  default:
                      return str;
              }
          }
          return null;
      }
  
      public boolean isSupported() {
          return Companion.isSupported();
      }
  
      public boolean matchesSocket(SSLSocket sslSocket) {
          Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
          return SSLSockets.isSupportedSocket(sslSocket);
      }
  
      public boolean matchesSocketFactory(SSLSocketFactory sslSocketFactory) {
          Intrinsics.checkNotNullParameter(sslSocketFactory, "sslSocketFactory");
          return SocketAdapter.DefaultImpls.matchesSocketFactory(this, sslSocketFactory);
      }
  
      public X509TrustManager trustManager(SSLSocketFactory sslSocketFactory) {
          Intrinsics.checkNotNullParameter(sslSocketFactory, "sslSocketFactory");
          return SocketAdapter.DefaultImpls.trustManager(this, sslSocketFactory);
      }
  }
  