jimu-decompiled/sources/com/google/android/gms/measurement/internal/zzaw.java
2025-05-13 19:24:51 +02:00

81 lines
2.9 KiB
Java

package com.google.android.gms.measurement.internal;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import com.ijm.dataencryption.de.DataDecryptTool;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSocketFactory;
/* loaded from: classes.dex */
public final class zzaw extends zzfn {
private final SSLSocketFactory d;
public zzaw(zzfo zzfoVar) {
super(zzfoVar);
this.d = Build.VERSION.SDK_INT < 19 ? new zzfz() : null;
}
/* JADX INFO: Access modifiers changed from: private */
public static byte[] a(HttpURLConnection httpURLConnection) throws IOException {
InputStream inputStream = null;
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
inputStream = httpURLConnection.getInputStream();
byte[] bArr = new byte[DataDecryptTool.DECRYPT_SP_FILE];
while (true) {
int read = inputStream.read(bArr);
if (read <= 0) {
break;
}
byteArrayOutputStream.write(bArr, 0, read);
}
return byteArrayOutputStream.toByteArray();
} finally {
if (inputStream != null) {
inputStream.close();
}
}
}
@Override // com.google.android.gms.measurement.internal.zzfn
protected final boolean s() {
return false;
}
public final boolean u() {
NetworkInfo networkInfo;
r();
try {
networkInfo = ((ConnectivityManager) b().getSystemService("connectivity")).getActiveNetworkInfo();
} catch (SecurityException unused) {
networkInfo = null;
}
return networkInfo != null && networkInfo.isConnected();
}
protected final HttpURLConnection a(URL url) throws IOException {
URLConnection openConnection = url.openConnection();
if (openConnection instanceof HttpURLConnection) {
SSLSocketFactory sSLSocketFactory = this.d;
if (sSLSocketFactory != null && (openConnection instanceof HttpsURLConnection)) {
((HttpsURLConnection) openConnection).setSSLSocketFactory(sSLSocketFactory);
}
HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
httpURLConnection.setDefaultUseCaches(false);
httpURLConnection.setConnectTimeout(60000);
httpURLConnection.setReadTimeout(61000);
httpURLConnection.setInstanceFollowRedirects(false);
httpURLConnection.setDoInput(true);
return httpURLConnection;
}
throw new IOException("Failed to obtain HTTP connection");
}
}