Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
package okhttp3.internal.platform;
import android.net.ssl.SSLSockets;
import java.io.IOException;
import java.util.List;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
/* loaded from: classes5.dex */
public class Android10Platform extends AndroidPlatform {
public Android10Platform(Class cls) {
super(cls, null, null, null, null, null);
}
@Override // okhttp3.internal.platform.AndroidPlatform, okhttp3.internal.platform.Platform
public void configureTlsExtensions(SSLSocket sSLSocket, String str, List list) {
try {
enableSessionTickets(sSLSocket);
SSLParameters sSLParameters = sSLSocket.getSSLParameters();
sSLParameters.setApplicationProtocols((String[]) Platform.alpnProtocolNames(list).toArray(new String[0]));
sSLSocket.setSSLParameters(sSLParameters);
} catch (IllegalArgumentException e) {
throw new IOException("Android internal error", e);
}
}
public final void enableSessionTickets(SSLSocket sSLSocket) {
boolean isSupportedSocket;
isSupportedSocket = SSLSockets.isSupportedSocket(sSLSocket);
if (isSupportedSocket) {
SSLSockets.setUseSessionTickets(sSLSocket, true);
}
}
@Override // okhttp3.internal.platform.AndroidPlatform, okhttp3.internal.platform.Platform
public String getSelectedProtocol(SSLSocket sSLSocket) {
String applicationProtocol;
applicationProtocol = sSLSocket.getApplicationProtocol();
if (applicationProtocol == null || applicationProtocol.isEmpty()) {
return null;
}
return applicationProtocol;
}
public static Platform buildIfSupported() {
if (!Platform.isAndroid()) {
return null;
}
try {
if (AndroidPlatform.getSdkInt() >= 29) {
return new Android10Platform(Class.forName("com.android.org.conscrypt.SSLParametersImpl"));
}
} catch (ReflectiveOperationException unused) {
}
return null;
}
}

View File

@@ -0,0 +1,349 @@
package okhttp3.internal.platform;
import android.os.Build;
import android.util.Log;
import com.vungle.ads.internal.presenter.MRAIDPresenter;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
import java.security.cert.TrustAnchor;
import java.security.cert.X509Certificate;
import java.util.List;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.X509TrustManager;
import okhttp3.internal.Util;
import okhttp3.internal.tls.CertificateChainCleaner;
import okhttp3.internal.tls.TrustRootIndex;
/* loaded from: classes5.dex */
public class AndroidPlatform extends Platform {
public final CloseGuard closeGuard = CloseGuard.get();
public final Method getAlpnSelectedProtocol;
public final Method setAlpnProtocols;
public final Method setHostname;
public final Method setUseSessionTickets;
public final Class sslParametersClass;
public final Class sslSocketClass;
public static int getSdkInt() {
try {
return Build.VERSION.SDK_INT;
} catch (NoClassDefFoundError unused) {
return 0;
}
}
public AndroidPlatform(Class cls, Class cls2, Method method, Method method2, Method method3, Method method4) {
this.sslParametersClass = cls;
this.sslSocketClass = cls2;
this.setUseSessionTickets = method;
this.setHostname = method2;
this.getAlpnSelectedProtocol = method3;
this.setAlpnProtocols = method4;
}
@Override // okhttp3.internal.platform.Platform
public void connectSocket(Socket socket, InetSocketAddress inetSocketAddress, int i) {
try {
socket.connect(inetSocketAddress, i);
} catch (AssertionError e) {
if (!Util.isAndroidGetsocknameError(e)) {
throw e;
}
throw new IOException(e);
} catch (ClassCastException e2) {
if (Build.VERSION.SDK_INT == 26) {
throw new IOException("Exception in connect", e2);
}
throw e2;
}
}
@Override // okhttp3.internal.platform.Platform
public void configureTlsExtensions(SSLSocket sSLSocket, String str, List list) {
if (this.sslSocketClass.isInstance(sSLSocket)) {
if (str != null) {
try {
this.setUseSessionTickets.invoke(sSLSocket, Boolean.TRUE);
this.setHostname.invoke(sSLSocket, str);
} catch (IllegalAccessException e) {
e = e;
throw new AssertionError(e);
} catch (InvocationTargetException e2) {
e = e2;
throw new AssertionError(e);
}
}
this.setAlpnProtocols.invoke(sSLSocket, Platform.concatLengthPrefixed(list));
}
}
@Override // okhttp3.internal.platform.Platform
public String getSelectedProtocol(SSLSocket sSLSocket) {
if (!this.sslSocketClass.isInstance(sSLSocket)) {
return null;
}
try {
byte[] bArr = (byte[]) this.getAlpnSelectedProtocol.invoke(sSLSocket, new Object[0]);
if (bArr != null) {
return new String(bArr, StandardCharsets.UTF_8);
}
return null;
} catch (IllegalAccessException | InvocationTargetException e) {
throw new AssertionError(e);
}
}
@Override // okhttp3.internal.platform.Platform
public void log(int i, String str, Throwable th) {
int min;
int i2 = i != 5 ? 3 : 5;
if (th != null) {
str = str + '\n' + Log.getStackTraceString(th);
}
int length = str.length();
int i3 = 0;
while (i3 < length) {
int indexOf = str.indexOf(10, i3);
if (indexOf == -1) {
indexOf = length;
}
while (true) {
min = Math.min(indexOf, i3 + 4000);
Log.println(i2, "OkHttp", str.substring(i3, min));
if (min >= indexOf) {
break;
} else {
i3 = min;
}
}
i3 = min + 1;
}
}
@Override // okhttp3.internal.platform.Platform
public Object getStackTraceForCloseable(String str) {
return this.closeGuard.createAndOpen(str);
}
@Override // okhttp3.internal.platform.Platform
public void logCloseableLeak(String str, Object obj) {
if (this.closeGuard.warnIfOpen(obj)) {
return;
}
log(5, str, null);
}
@Override // okhttp3.internal.platform.Platform
public boolean isCleartextTrafficPermitted(String str) {
try {
Class<?> cls = Class.forName("android.security.NetworkSecurityPolicy");
return api24IsCleartextTrafficPermitted(str, cls, cls.getMethod("getInstance", new Class[0]).invoke(null, new Object[0]));
} catch (ClassNotFoundException | NoSuchMethodException unused) {
return super.isCleartextTrafficPermitted(str);
} catch (IllegalAccessException e) {
e = e;
throw new AssertionError("unable to determine cleartext support", e);
} catch (IllegalArgumentException e2) {
e = e2;
throw new AssertionError("unable to determine cleartext support", e);
} catch (InvocationTargetException e3) {
e = e3;
throw new AssertionError("unable to determine cleartext support", e);
}
}
public final boolean api24IsCleartextTrafficPermitted(String str, Class cls, Object obj) {
try {
return ((Boolean) cls.getMethod("isCleartextTrafficPermitted", String.class).invoke(obj, str)).booleanValue();
} catch (NoSuchMethodException unused) {
return api23IsCleartextTrafficPermitted(str, cls, obj);
}
}
public final boolean api23IsCleartextTrafficPermitted(String str, Class cls, Object obj) {
try {
return ((Boolean) cls.getMethod("isCleartextTrafficPermitted", new Class[0]).invoke(obj, new Object[0])).booleanValue();
} catch (NoSuchMethodException unused) {
return super.isCleartextTrafficPermitted(str);
}
}
@Override // okhttp3.internal.platform.Platform
public CertificateChainCleaner buildCertificateChainCleaner(X509TrustManager x509TrustManager) {
try {
Class<?> cls = Class.forName("android.net.http.X509TrustManagerExtensions");
return new AndroidCertificateChainCleaner(cls.getConstructor(X509TrustManager.class).newInstance(x509TrustManager), cls.getMethod("checkServerTrusted", X509Certificate[].class, String.class, String.class));
} catch (Exception unused) {
return super.buildCertificateChainCleaner(x509TrustManager);
}
}
public static Platform buildIfSupported() {
if (!Platform.isAndroid()) {
return null;
}
try {
Class<?> cls = Class.forName("com.android.org.conscrypt.SSLParametersImpl");
Class<?> cls2 = Class.forName("com.android.org.conscrypt.OpenSSLSocketImpl");
try {
return new AndroidPlatform(cls, cls2, cls2.getDeclaredMethod("setUseSessionTickets", Boolean.TYPE), cls2.getMethod("setHostname", String.class), cls2.getMethod("getAlpnSelectedProtocol", new Class[0]), cls2.getMethod("setAlpnProtocols", byte[].class));
} catch (NoSuchMethodException unused) {
throw new IllegalStateException("Expected Android API level 21+ but was " + Build.VERSION.SDK_INT);
}
} catch (ClassNotFoundException unused2) {
return null;
}
}
@Override // okhttp3.internal.platform.Platform
public TrustRootIndex buildTrustRootIndex(X509TrustManager x509TrustManager) {
try {
Method declaredMethod = x509TrustManager.getClass().getDeclaredMethod("findTrustAnchorByIssuerAndSignature", X509Certificate.class);
declaredMethod.setAccessible(true);
return new CustomTrustRootIndex(x509TrustManager, declaredMethod);
} catch (NoSuchMethodException unused) {
return super.buildTrustRootIndex(x509TrustManager);
}
}
public static final class AndroidCertificateChainCleaner extends CertificateChainCleaner {
public final Method checkServerTrusted;
public final Object x509TrustManagerExtensions;
public int hashCode() {
return 0;
}
public AndroidCertificateChainCleaner(Object obj, Method method) {
this.x509TrustManagerExtensions = obj;
this.checkServerTrusted = method;
}
@Override // okhttp3.internal.tls.CertificateChainCleaner
public List clean(List list, String str) {
try {
return (List) this.checkServerTrusted.invoke(this.x509TrustManagerExtensions, (X509Certificate[]) list.toArray(new X509Certificate[list.size()]), "RSA", str);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
} catch (InvocationTargetException e2) {
SSLPeerUnverifiedException sSLPeerUnverifiedException = new SSLPeerUnverifiedException(e2.getMessage());
sSLPeerUnverifiedException.initCause(e2);
throw sSLPeerUnverifiedException;
}
}
public boolean equals(Object obj) {
return obj instanceof AndroidCertificateChainCleaner;
}
}
public static final class CloseGuard {
public final Method getMethod;
public final Method openMethod;
public final Method warnIfOpenMethod;
public CloseGuard(Method method, Method method2, Method method3) {
this.getMethod = method;
this.openMethod = method2;
this.warnIfOpenMethod = method3;
}
public Object createAndOpen(String str) {
Method method = this.getMethod;
if (method != null) {
try {
Object invoke = method.invoke(null, new Object[0]);
this.openMethod.invoke(invoke, str);
return invoke;
} catch (Exception unused) {
}
}
return null;
}
public boolean warnIfOpen(Object obj) {
if (obj == null) {
return false;
}
try {
this.warnIfOpenMethod.invoke(obj, new Object[0]);
return true;
} catch (Exception unused) {
return false;
}
}
public static CloseGuard get() {
Method method;
Method method2;
Method method3;
try {
Class<?> cls = Class.forName("dalvik.system.CloseGuard");
method = cls.getMethod("get", new Class[0]);
method3 = cls.getMethod(MRAIDPresenter.OPEN, String.class);
method2 = cls.getMethod("warnIfOpen", new Class[0]);
} catch (Exception unused) {
method = null;
method2 = null;
method3 = null;
}
return new CloseGuard(method, method3, method2);
}
}
public static final class CustomTrustRootIndex implements TrustRootIndex {
public final Method findByIssuerAndSignatureMethod;
public final X509TrustManager trustManager;
public CustomTrustRootIndex(X509TrustManager x509TrustManager, Method method) {
this.findByIssuerAndSignatureMethod = method;
this.trustManager = x509TrustManager;
}
@Override // okhttp3.internal.tls.TrustRootIndex
public X509Certificate findByIssuerAndSignature(X509Certificate x509Certificate) {
try {
TrustAnchor trustAnchor = (TrustAnchor) this.findByIssuerAndSignatureMethod.invoke(this.trustManager, x509Certificate);
if (trustAnchor != null) {
return trustAnchor.getTrustedCert();
}
return null;
} catch (IllegalAccessException e) {
throw new AssertionError("unable to get issues and signature", e);
} catch (InvocationTargetException unused) {
return null;
}
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof CustomTrustRootIndex)) {
return false;
}
CustomTrustRootIndex customTrustRootIndex = (CustomTrustRootIndex) obj;
return this.trustManager.equals(customTrustRootIndex.trustManager) && this.findByIssuerAndSignatureMethod.equals(customTrustRootIndex.findByIssuerAndSignatureMethod);
}
public int hashCode() {
return this.trustManager.hashCode() + (this.findByIssuerAndSignatureMethod.hashCode() * 31);
}
}
@Override // okhttp3.internal.platform.Platform
public SSLContext getSSLContext() {
try {
return SSLContext.getInstance("TLS");
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("No TLS provider", e);
}
}
}

View File

@@ -0,0 +1,69 @@
package okhttp3.internal.platform;
import java.security.NoSuchAlgorithmException;
import java.security.Provider;
import java.util.List;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import org.conscrypt.Conscrypt;
/* loaded from: classes5.dex */
public class ConscryptPlatform extends Platform {
public final Provider getProvider() {
return Conscrypt.newProviderBuilder().provideTrustManager().build();
}
@Override // okhttp3.internal.platform.Platform
public void configureTlsExtensions(SSLSocket sSLSocket, String str, List list) {
if (Conscrypt.isConscrypt(sSLSocket)) {
if (str != null) {
Conscrypt.setUseSessionTickets(sSLSocket, true);
Conscrypt.setHostname(sSLSocket, str);
}
Conscrypt.setApplicationProtocols(sSLSocket, (String[]) Platform.alpnProtocolNames(list).toArray(new String[0]));
return;
}
super.configureTlsExtensions(sSLSocket, str, list);
}
@Override // okhttp3.internal.platform.Platform
public String getSelectedProtocol(SSLSocket sSLSocket) {
if (Conscrypt.isConscrypt(sSLSocket)) {
return Conscrypt.getApplicationProtocol(sSLSocket);
}
return super.getSelectedProtocol(sSLSocket);
}
@Override // okhttp3.internal.platform.Platform
public SSLContext getSSLContext() {
try {
return SSLContext.getInstance("TLSv1.3", getProvider());
} catch (NoSuchAlgorithmException e) {
try {
return SSLContext.getInstance("TLS", getProvider());
} catch (NoSuchAlgorithmException unused) {
throw new IllegalStateException("No TLS provider", e);
}
}
}
public static ConscryptPlatform buildIfSupported() {
try {
Class.forName("org.conscrypt.Conscrypt");
if (Conscrypt.isAvailable()) {
return new ConscryptPlatform();
}
return null;
} catch (ClassNotFoundException unused) {
return null;
}
}
@Override // okhttp3.internal.platform.Platform
public void configureSslSocketFactory(SSLSocketFactory sSLSocketFactory) {
if (Conscrypt.isConscrypt(sSLSocketFactory)) {
Conscrypt.setUseEngineSocket(sSLSocketFactory, true);
}
}
}

View File

@@ -0,0 +1,128 @@
package okhttp3.internal.platform;
import csdk.gluads.Consts;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.List;
import javax.net.ssl.SSLSocket;
import okhttp3.internal.Util;
/* loaded from: classes5.dex */
public class Jdk8WithJettyBootPlatform extends Platform {
public final Class clientProviderClass;
public final Method getMethod;
public final Method putMethod;
public final Method removeMethod;
public final Class serverProviderClass;
public Jdk8WithJettyBootPlatform(Method method, Method method2, Method method3, Class cls, Class cls2) {
this.putMethod = method;
this.getMethod = method2;
this.removeMethod = method3;
this.clientProviderClass = cls;
this.serverProviderClass = cls2;
}
@Override // okhttp3.internal.platform.Platform
public void configureTlsExtensions(SSLSocket sSLSocket, String str, List list) {
try {
this.putMethod.invoke(null, sSLSocket, Proxy.newProxyInstance(Platform.class.getClassLoader(), new Class[]{this.clientProviderClass, this.serverProviderClass}, new AlpnProvider(Platform.alpnProtocolNames(list))));
} catch (IllegalAccessException | InvocationTargetException e) {
throw new AssertionError("failed to set ALPN", e);
}
}
@Override // okhttp3.internal.platform.Platform
public void afterHandshake(SSLSocket sSLSocket) {
try {
this.removeMethod.invoke(null, sSLSocket);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new AssertionError("failed to remove ALPN", e);
}
}
@Override // okhttp3.internal.platform.Platform
public String getSelectedProtocol(SSLSocket sSLSocket) {
try {
AlpnProvider alpnProvider = (AlpnProvider) Proxy.getInvocationHandler(this.getMethod.invoke(null, sSLSocket));
boolean z = alpnProvider.unsupported;
if (!z && alpnProvider.selected == null) {
Platform.get().log(4, "ALPN callback dropped: HTTP/2 is disabled. Is alpn-boot on the boot class path?", null);
return null;
}
if (z) {
return null;
}
return alpnProvider.selected;
} catch (IllegalAccessException e) {
e = e;
throw new AssertionError("failed to get ALPN selected protocol", e);
} catch (InvocationTargetException e2) {
e = e2;
throw new AssertionError("failed to get ALPN selected protocol", e);
}
}
public static Platform buildIfSupported() {
try {
Class<?> cls = Class.forName("org.eclipse.jetty.alpn.ALPN", true, null);
Class<?> cls2 = Class.forName("org.eclipse.jetty.alpn.ALPN$Provider", true, null);
return new Jdk8WithJettyBootPlatform(cls.getMethod("put", SSLSocket.class, cls2), cls.getMethod("get", SSLSocket.class), cls.getMethod("remove", SSLSocket.class), Class.forName("org.eclipse.jetty.alpn.ALPN$ClientProvider", true, null), Class.forName("org.eclipse.jetty.alpn.ALPN$ServerProvider", true, null));
} catch (ClassNotFoundException | NoSuchMethodException unused) {
return null;
}
}
public static class AlpnProvider implements InvocationHandler {
public final List protocols;
public String selected;
public boolean unsupported;
public AlpnProvider(List list) {
this.protocols = list;
}
@Override // java.lang.reflect.InvocationHandler
public Object invoke(Object obj, Method method, Object[] objArr) {
String name = method.getName();
Class<?> returnType = method.getReturnType();
if (objArr == null) {
objArr = Util.EMPTY_STRING_ARRAY;
}
if (name.equals("supports") && Boolean.TYPE == returnType) {
return Boolean.TRUE;
}
if (name.equals(Consts.SDK_PRIVACY_STAGE_UNSUPPORTED) && Void.TYPE == returnType) {
this.unsupported = true;
return null;
}
if (name.equals("protocols") && objArr.length == 0) {
return this.protocols;
}
if ((name.equals("selectProtocol") || name.equals("select")) && String.class == returnType && objArr.length == 1) {
Object obj2 = objArr[0];
if (obj2 instanceof List) {
List list = (List) obj2;
int size = list.size();
for (int i = 0; i < size; i++) {
String str = (String) list.get(i);
if (this.protocols.contains(str)) {
this.selected = str;
return str;
}
}
String str2 = (String) this.protocols.get(0);
this.selected = str2;
return str2;
}
}
if ((name.equals("protocolSelected") || name.equals("selected")) && objArr.length == 1) {
this.selected = (String) objArr[0];
return null;
}
return method.invoke(this, objArr);
}
}
}

View File

@@ -0,0 +1,58 @@
package okhttp3.internal.platform;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
/* loaded from: classes5.dex */
public final class Jdk9Platform extends Platform {
public final Method getProtocolMethod;
public final Method setProtocolMethod;
public Jdk9Platform(Method method, Method method2) {
this.setProtocolMethod = method;
this.getProtocolMethod = method2;
}
@Override // okhttp3.internal.platform.Platform
public void configureTlsExtensions(SSLSocket sSLSocket, String str, List list) {
try {
SSLParameters sSLParameters = sSLSocket.getSSLParameters();
List alpnProtocolNames = Platform.alpnProtocolNames(list);
this.setProtocolMethod.invoke(sSLParameters, alpnProtocolNames.toArray(new String[alpnProtocolNames.size()]));
sSLSocket.setSSLParameters(sSLParameters);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new AssertionError("failed to set SSL parameters", e);
}
}
@Override // okhttp3.internal.platform.Platform
public String getSelectedProtocol(SSLSocket sSLSocket) {
try {
String str = (String) this.getProtocolMethod.invoke(sSLSocket, new Object[0]);
if (str != null) {
if (!str.equals("")) {
return str;
}
}
return null;
} catch (IllegalAccessException e) {
throw new AssertionError("failed to get ALPN selected protocol", e);
} catch (InvocationTargetException e2) {
if (e2.getCause() instanceof UnsupportedOperationException) {
return null;
}
throw new AssertionError("failed to get ALPN selected protocol", e2);
}
}
public static Jdk9Platform buildIfSupported() {
try {
return new Jdk9Platform(SSLParameters.class.getMethod("setApplicationProtocols", String[].class), SSLSocket.class.getMethod("getApplicationProtocol", new Class[0]));
} catch (NoSuchMethodException unused) {
return null;
}
}
}

View File

@@ -0,0 +1,163 @@
package okhttp3.internal.platform;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.security.NoSuchAlgorithmException;
import java.security.Security;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;
import okhttp3.OkHttpClient;
import okhttp3.Protocol;
import okhttp3.internal.Util;
import okhttp3.internal.tls.BasicCertificateChainCleaner;
import okhttp3.internal.tls.BasicTrustRootIndex;
import okhttp3.internal.tls.CertificateChainCleaner;
import okhttp3.internal.tls.TrustRootIndex;
import okio.Buffer;
/* loaded from: classes5.dex */
public class Platform {
public static final Platform PLATFORM = findPlatform();
public static final Logger logger = Logger.getLogger(OkHttpClient.class.getName());
public static Platform get() {
return PLATFORM;
}
public void afterHandshake(SSLSocket sSLSocket) {
}
public void configureSslSocketFactory(SSLSocketFactory sSLSocketFactory) {
}
public void configureTlsExtensions(SSLSocket sSLSocket, String str, List list) {
}
public String getPrefix() {
return "OkHttp";
}
public String getSelectedProtocol(SSLSocket sSLSocket) {
return null;
}
public boolean isCleartextTrafficPermitted(String str) {
return true;
}
public void connectSocket(Socket socket, InetSocketAddress inetSocketAddress, int i) {
socket.connect(inetSocketAddress, i);
}
public void log(int i, String str, Throwable th) {
logger.log(i == 5 ? Level.WARNING : Level.INFO, str, th);
}
public Object getStackTraceForCloseable(String str) {
if (logger.isLoggable(Level.FINE)) {
return new Throwable(str);
}
return null;
}
public void logCloseableLeak(String str, Object obj) {
if (obj == null) {
str = str + " To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);";
}
log(5, str, (Throwable) obj);
}
public static List alpnProtocolNames(List list) {
ArrayList arrayList = new ArrayList(list.size());
int size = list.size();
for (int i = 0; i < size; i++) {
Protocol protocol = (Protocol) list.get(i);
if (protocol != Protocol.HTTP_1_0) {
arrayList.add(protocol.toString());
}
}
return arrayList;
}
public CertificateChainCleaner buildCertificateChainCleaner(X509TrustManager x509TrustManager) {
return new BasicCertificateChainCleaner(buildTrustRootIndex(x509TrustManager));
}
public static boolean isConscryptPreferred() {
if ("conscrypt".equals(Util.getSystemProperty("okhttp.platform", null))) {
return true;
}
return "Conscrypt".equals(Security.getProviders()[0].getName());
}
public static Platform findPlatform() {
if (isAndroid()) {
return findAndroidPlatform();
}
return findJvmPlatform();
}
public static boolean isAndroid() {
return "Dalvik".equals(System.getProperty("java.vm.name"));
}
public static Platform findJvmPlatform() {
ConscryptPlatform buildIfSupported;
if (isConscryptPreferred() && (buildIfSupported = ConscryptPlatform.buildIfSupported()) != null) {
return buildIfSupported;
}
Jdk9Platform buildIfSupported2 = Jdk9Platform.buildIfSupported();
if (buildIfSupported2 != null) {
return buildIfSupported2;
}
Platform buildIfSupported3 = Jdk8WithJettyBootPlatform.buildIfSupported();
return buildIfSupported3 != null ? buildIfSupported3 : new Platform();
}
public static Platform findAndroidPlatform() {
Platform buildIfSupported = Android10Platform.buildIfSupported();
if (buildIfSupported != null) {
return buildIfSupported;
}
Platform buildIfSupported2 = AndroidPlatform.buildIfSupported();
if (buildIfSupported2 != null) {
return buildIfSupported2;
}
throw new NullPointerException("No platform found on Android");
}
public static byte[] concatLengthPrefixed(List list) {
Buffer buffer = new Buffer();
int size = list.size();
for (int i = 0; i < size; i++) {
Protocol protocol = (Protocol) list.get(i);
if (protocol != Protocol.HTTP_1_0) {
buffer.writeByte(protocol.toString().length());
buffer.writeUtf8(protocol.toString());
}
}
return buffer.readByteArray();
}
public SSLContext getSSLContext() {
try {
return SSLContext.getInstance("TLS");
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("No TLS provider", e);
}
}
public TrustRootIndex buildTrustRootIndex(X509TrustManager x509TrustManager) {
return new BasicTrustRootIndex(x509TrustManager.getAcceptedIssuers());
}
public String toString() {
return getClass().getSimpleName();
}
}