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 o.C14953gcr; import o.C14957gcv; import okhttp3.Protocol; import okhttp3.internal.platform.Platform; import okhttp3.internal.platform.android.SocketAdapter; /* loaded from: classes.dex */ public final class Android10SocketAdapter implements SocketAdapter { public static final Companion Companion = new Companion(null); @Override // okhttp3.internal.platform.android.SocketAdapter public final boolean matchesSocketFactory(SSLSocketFactory sSLSocketFactory) { return SocketAdapter.DefaultImpls.matchesSocketFactory(this, sSLSocketFactory); } @Override // okhttp3.internal.platform.android.SocketAdapter public final X509TrustManager trustManager(SSLSocketFactory sSLSocketFactory) { return SocketAdapter.DefaultImpls.trustManager(this, sSLSocketFactory); } @Override // okhttp3.internal.platform.android.SocketAdapter public final boolean matchesSocket(SSLSocket sSLSocket) { C14957gcv.e(sSLSocket, ""); return SSLSockets.isSupportedSocket(sSLSocket); } @Override // okhttp3.internal.platform.android.SocketAdapter public final boolean isSupported() { return Companion.isSupported(); } @Override // okhttp3.internal.platform.android.SocketAdapter public final String getSelectedProtocol(SSLSocket sSLSocket) { C14957gcv.e(sSLSocket, ""); String applicationProtocol = sSLSocket.getApplicationProtocol(); if (applicationProtocol == null || C14957gcv.b((Object) applicationProtocol, (Object) "")) { return null; } return applicationProtocol; } @Override // okhttp3.internal.platform.android.SocketAdapter public final void configureTlsExtensions(SSLSocket sSLSocket, String str, List list) { C14957gcv.e(sSLSocket, ""); C14957gcv.e(list, ""); try { SSLSockets.setUseSessionTickets(sSLSocket, true); SSLParameters sSLParameters = sSLSocket.getSSLParameters(); Object[] array = Platform.Companion.alpnProtocolNames(list).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"); } catch (IllegalArgumentException e) { throw new IOException("Android internal error", e); } } /* loaded from: classes.dex */ public static final class Companion { private Companion() { } 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 /* synthetic */ Companion(C14953gcr c14953gcr) { this(); } } }