379 lines
15 KiB
Java
379 lines
15 KiB
Java
|
package com.google.android.gms.internal.gtm;
|
||
|
|
||
|
import android.net.ConnectivityManager;
|
||
|
import android.net.NetworkInfo;
|
||
|
import android.os.Build;
|
||
|
import com.google.android.gms.analytics.zzk;
|
||
|
import com.google.android.gms.common.internal.Preconditions;
|
||
|
import java.io.IOException;
|
||
|
import java.io.InputStream;
|
||
|
import java.io.UnsupportedEncodingException;
|
||
|
import java.net.HttpURLConnection;
|
||
|
import java.net.MalformedURLException;
|
||
|
import java.net.URL;
|
||
|
import java.net.URLConnection;
|
||
|
import java.net.URLEncoder;
|
||
|
import java.util.Locale;
|
||
|
import java.util.Map;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class zzck extends zzan {
|
||
|
private static final byte[] zzabr = "\n".getBytes();
|
||
|
private final String zzabp;
|
||
|
private final zzcv zzabq;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public zzck(zzap zzapVar) {
|
||
|
super(zzapVar);
|
||
|
this.zzabp = String.format("%s/%s (Linux; U; Android %s; %s; %s Build/%s)", "GoogleAnalytics", zzao.VERSION, Build.VERSION.RELEASE, zzcz.zza(Locale.getDefault()), Build.MODEL, Build.ID);
|
||
|
this.zzabq = new zzcv(zzapVar.zzcn());
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.internal.gtm.zzan
|
||
|
protected final void zzaw() {
|
||
|
zza("Network initialized. User agent", this.zzabp);
|
||
|
}
|
||
|
|
||
|
public final boolean zzfr() {
|
||
|
NetworkInfo networkInfo;
|
||
|
zzk.zzav();
|
||
|
zzdb();
|
||
|
try {
|
||
|
networkInfo = ((ConnectivityManager) getContext().getSystemService("connectivity")).getActiveNetworkInfo();
|
||
|
} catch (SecurityException unused) {
|
||
|
networkInfo = null;
|
||
|
}
|
||
|
if (networkInfo != null && networkInfo.isConnected()) {
|
||
|
return true;
|
||
|
}
|
||
|
zzq("No network connectivity");
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Removed duplicated region for block: B:13:0x005d */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:39:0x0102 */
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
public final java.util.List<java.lang.Long> zzb(java.util.List<com.google.android.gms.internal.gtm.zzcd> r9) {
|
||
|
/*
|
||
|
Method dump skipped, instructions count: 429
|
||
|
To view this dump add '--comments-level debug' option
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.gtm.zzck.zzb(java.util.List):java.util.List");
|
||
|
}
|
||
|
|
||
|
private final int zza(URL url) {
|
||
|
Preconditions.checkNotNull(url);
|
||
|
zzb("GET request", url);
|
||
|
HttpURLConnection httpURLConnection = null;
|
||
|
try {
|
||
|
try {
|
||
|
httpURLConnection = zzb(url);
|
||
|
httpURLConnection.connect();
|
||
|
zza(httpURLConnection);
|
||
|
int responseCode = httpURLConnection.getResponseCode();
|
||
|
if (responseCode == 200) {
|
||
|
zzcs().zzcl();
|
||
|
}
|
||
|
zzb("GET status", Integer.valueOf(responseCode));
|
||
|
if (httpURLConnection != null) {
|
||
|
httpURLConnection.disconnect();
|
||
|
}
|
||
|
return responseCode;
|
||
|
} catch (IOException e) {
|
||
|
zzd("Network GET connection error", e);
|
||
|
if (httpURLConnection == null) {
|
||
|
return 0;
|
||
|
}
|
||
|
httpURLConnection.disconnect();
|
||
|
return 0;
|
||
|
}
|
||
|
} catch (Throwable th) {
|
||
|
if (httpURLConnection != null) {
|
||
|
httpURLConnection.disconnect();
|
||
|
}
|
||
|
throw th;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:41:0x0099 */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:43:? A[SYNTHETIC] */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:44:0x008f A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||
|
/* JADX WARN: Type inference failed for: r7v1 */
|
||
|
/* JADX WARN: Type inference failed for: r7v3, types: [java.net.HttpURLConnection] */
|
||
|
/* JADX WARN: Type inference failed for: r7v5 */
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
private final int zza(java.net.URL r6, byte[] r7) {
|
||
|
/*
|
||
|
r5 = this;
|
||
|
java.lang.String r0 = "Error closing http post connection output stream"
|
||
|
com.google.android.gms.common.internal.Preconditions.checkNotNull(r6)
|
||
|
com.google.android.gms.common.internal.Preconditions.checkNotNull(r7)
|
||
|
int r1 = r7.length
|
||
|
java.lang.Integer r1 = java.lang.Integer.valueOf(r1)
|
||
|
java.lang.String r2 = "POST bytes, url"
|
||
|
r5.zzb(r2, r1, r6)
|
||
|
boolean r1 = zzda()
|
||
|
if (r1 == 0) goto L22
|
||
|
java.lang.String r1 = new java.lang.String
|
||
|
r1.<init>(r7)
|
||
|
java.lang.String r2 = "Post payload\n"
|
||
|
r5.zza(r2, r1)
|
||
|
L22:
|
||
|
r1 = 0
|
||
|
android.content.Context r2 = r5.getContext() // Catch: java.lang.Throwable -> L6d java.io.IOException -> L70
|
||
|
r2.getPackageName() // Catch: java.lang.Throwable -> L6d java.io.IOException -> L70
|
||
|
java.net.HttpURLConnection r6 = r5.zzb(r6) // Catch: java.lang.Throwable -> L6d java.io.IOException -> L70
|
||
|
r2 = 1
|
||
|
r6.setDoOutput(r2) // Catch: java.io.IOException -> L6b java.lang.Throwable -> L89
|
||
|
int r2 = r7.length // Catch: java.io.IOException -> L6b java.lang.Throwable -> L89
|
||
|
r6.setFixedLengthStreamingMode(r2) // Catch: java.io.IOException -> L6b java.lang.Throwable -> L89
|
||
|
r6.connect() // Catch: java.io.IOException -> L6b java.lang.Throwable -> L89
|
||
|
java.io.OutputStream r1 = r6.getOutputStream() // Catch: java.io.IOException -> L6b java.lang.Throwable -> L89
|
||
|
r1.write(r7) // Catch: java.io.IOException -> L6b java.lang.Throwable -> L89
|
||
|
r5.zza(r6) // Catch: java.io.IOException -> L6b java.lang.Throwable -> L89
|
||
|
int r7 = r6.getResponseCode() // Catch: java.io.IOException -> L6b java.lang.Throwable -> L89
|
||
|
r2 = 200(0xc8, float:2.8E-43)
|
||
|
if (r7 != r2) goto L52
|
||
|
com.google.android.gms.internal.gtm.zzae r2 = r5.zzcs() // Catch: java.io.IOException -> L6b java.lang.Throwable -> L89
|
||
|
r2.zzcl() // Catch: java.io.IOException -> L6b java.lang.Throwable -> L89
|
||
|
L52:
|
||
|
java.lang.String r2 = "POST status"
|
||
|
java.lang.Integer r3 = java.lang.Integer.valueOf(r7) // Catch: java.io.IOException -> L6b java.lang.Throwable -> L89
|
||
|
r5.zzb(r2, r3) // Catch: java.io.IOException -> L6b java.lang.Throwable -> L89
|
||
|
if (r1 == 0) goto L65
|
||
|
r1.close() // Catch: java.io.IOException -> L61
|
||
|
goto L65
|
||
|
L61:
|
||
|
r1 = move-exception
|
||
|
r5.zze(r0, r1)
|
||
|
L65:
|
||
|
if (r6 == 0) goto L6a
|
||
|
r6.disconnect()
|
||
|
L6a:
|
||
|
return r7
|
||
|
L6b:
|
||
|
r7 = move-exception
|
||
|
goto L73
|
||
|
L6d:
|
||
|
r6 = move-exception
|
||
|
r7 = r1
|
||
|
goto L8d
|
||
|
L70:
|
||
|
r6 = move-exception
|
||
|
r7 = r6
|
||
|
r6 = r1
|
||
|
L73:
|
||
|
java.lang.String r2 = "Network POST connection error"
|
||
|
r5.zzd(r2, r7) // Catch: java.lang.Throwable -> L89
|
||
|
if (r1 == 0) goto L82
|
||
|
r1.close() // Catch: java.io.IOException -> L7e
|
||
|
goto L82
|
||
|
L7e:
|
||
|
r7 = move-exception
|
||
|
r5.zze(r0, r7)
|
||
|
L82:
|
||
|
if (r6 == 0) goto L87
|
||
|
r6.disconnect()
|
||
|
L87:
|
||
|
r6 = 0
|
||
|
return r6
|
||
|
L89:
|
||
|
r7 = move-exception
|
||
|
r4 = r7
|
||
|
r7 = r6
|
||
|
r6 = r4
|
||
|
L8d:
|
||
|
if (r1 == 0) goto L97
|
||
|
r1.close() // Catch: java.io.IOException -> L93
|
||
|
goto L97
|
||
|
L93:
|
||
|
r1 = move-exception
|
||
|
r5.zze(r0, r1)
|
||
|
L97:
|
||
|
if (r7 == 0) goto L9c
|
||
|
r7.disconnect()
|
||
|
L9c:
|
||
|
throw r6
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.gtm.zzck.zza(java.net.URL, byte[]):int");
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Removed duplicated region for block: B:47:0x00ed */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:49:? A[SYNTHETIC] */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:50:0x00e3 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
private final int zzb(java.net.URL r10, byte[] r11) {
|
||
|
/*
|
||
|
Method dump skipped, instructions count: 241
|
||
|
To view this dump add '--comments-level debug' option
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.gtm.zzck.zzb(java.net.URL, byte[]):int");
|
||
|
}
|
||
|
|
||
|
private final void zza(HttpURLConnection httpURLConnection) throws IOException {
|
||
|
InputStream inputStream;
|
||
|
try {
|
||
|
inputStream = httpURLConnection.getInputStream();
|
||
|
try {
|
||
|
do {
|
||
|
} while (inputStream.read(new byte[1024]) > 0);
|
||
|
if (inputStream != null) {
|
||
|
try {
|
||
|
inputStream.close();
|
||
|
} catch (IOException e) {
|
||
|
zze("Error closing http connection input stream", e);
|
||
|
}
|
||
|
}
|
||
|
} catch (Throwable th) {
|
||
|
th = th;
|
||
|
if (inputStream != null) {
|
||
|
try {
|
||
|
inputStream.close();
|
||
|
} catch (IOException e2) {
|
||
|
zze("Error closing http connection input stream", e2);
|
||
|
}
|
||
|
}
|
||
|
throw th;
|
||
|
}
|
||
|
} catch (Throwable th2) {
|
||
|
th = th2;
|
||
|
inputStream = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private final HttpURLConnection zzb(URL url) throws IOException {
|
||
|
URLConnection openConnection = url.openConnection();
|
||
|
if (!(openConnection instanceof HttpURLConnection)) {
|
||
|
throw new IOException("Failed to obtain http connection");
|
||
|
}
|
||
|
HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
|
||
|
httpURLConnection.setDefaultUseCaches(false);
|
||
|
httpURLConnection.setConnectTimeout(zzby.zzaad.get().intValue());
|
||
|
httpURLConnection.setReadTimeout(zzby.zzaae.get().intValue());
|
||
|
httpURLConnection.setInstanceFollowRedirects(false);
|
||
|
httpURLConnection.setRequestProperty("User-Agent", this.zzabp);
|
||
|
httpURLConnection.setDoInput(true);
|
||
|
return httpURLConnection;
|
||
|
}
|
||
|
|
||
|
private final URL zzd(zzcd zzcdVar) {
|
||
|
String str;
|
||
|
String concat;
|
||
|
if (zzcdVar.zzfj()) {
|
||
|
String valueOf = String.valueOf(zzbq.zzet());
|
||
|
String valueOf2 = String.valueOf(zzbq.zzev());
|
||
|
if (valueOf2.length() != 0) {
|
||
|
concat = valueOf.concat(valueOf2);
|
||
|
} else {
|
||
|
str = new String(valueOf);
|
||
|
concat = str;
|
||
|
}
|
||
|
} else {
|
||
|
String valueOf3 = String.valueOf(zzbq.zzeu());
|
||
|
String valueOf4 = String.valueOf(zzbq.zzev());
|
||
|
if (valueOf4.length() != 0) {
|
||
|
concat = valueOf3.concat(valueOf4);
|
||
|
} else {
|
||
|
str = new String(valueOf3);
|
||
|
concat = str;
|
||
|
}
|
||
|
}
|
||
|
try {
|
||
|
return new URL(concat);
|
||
|
} catch (MalformedURLException e) {
|
||
|
zze("Error trying to parse the hardcoded host url", e);
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private final URL zzb(zzcd zzcdVar, String str) {
|
||
|
String sb;
|
||
|
if (zzcdVar.zzfj()) {
|
||
|
String zzet = zzbq.zzet();
|
||
|
String zzev = zzbq.zzev();
|
||
|
StringBuilder sb2 = new StringBuilder(String.valueOf(zzet).length() + 1 + String.valueOf(zzev).length() + String.valueOf(str).length());
|
||
|
sb2.append(zzet);
|
||
|
sb2.append(zzev);
|
||
|
sb2.append("?");
|
||
|
sb2.append(str);
|
||
|
sb = sb2.toString();
|
||
|
} else {
|
||
|
String zzeu = zzbq.zzeu();
|
||
|
String zzev2 = zzbq.zzev();
|
||
|
StringBuilder sb3 = new StringBuilder(String.valueOf(zzeu).length() + 1 + String.valueOf(zzev2).length() + String.valueOf(str).length());
|
||
|
sb3.append(zzeu);
|
||
|
sb3.append(zzev2);
|
||
|
sb3.append("?");
|
||
|
sb3.append(str);
|
||
|
sb = sb3.toString();
|
||
|
}
|
||
|
try {
|
||
|
return new URL(sb);
|
||
|
} catch (MalformedURLException e) {
|
||
|
zze("Error trying to parse the hardcoded host url", e);
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private final URL zzfs() {
|
||
|
String valueOf = String.valueOf(zzbq.zzet());
|
||
|
String valueOf2 = String.valueOf(zzby.zzzs.get());
|
||
|
try {
|
||
|
return new URL(valueOf2.length() != 0 ? valueOf.concat(valueOf2) : new String(valueOf));
|
||
|
} catch (MalformedURLException e) {
|
||
|
zze("Error trying to parse the hardcoded host url", e);
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public final String zza(zzcd zzcdVar, boolean z) {
|
||
|
String valueOf;
|
||
|
Preconditions.checkNotNull(zzcdVar);
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
try {
|
||
|
for (Map.Entry<String, String> entry : zzcdVar.zzdm().entrySet()) {
|
||
|
String key = entry.getKey();
|
||
|
if (!"ht".equals(key) && !"qt".equals(key) && !"AppUID".equals(key) && !"z".equals(key) && !"_gmsv".equals(key)) {
|
||
|
zza(sb, key, entry.getValue());
|
||
|
}
|
||
|
}
|
||
|
zza(sb, "ht", String.valueOf(zzcdVar.zzfh()));
|
||
|
zza(sb, "qt", String.valueOf(zzcn().currentTimeMillis() - zzcdVar.zzfh()));
|
||
|
if (z) {
|
||
|
long zzfk = zzcdVar.zzfk();
|
||
|
if (zzfk != 0) {
|
||
|
valueOf = String.valueOf(zzfk);
|
||
|
} else {
|
||
|
valueOf = String.valueOf(zzcdVar.zzfg());
|
||
|
}
|
||
|
zza(sb, "z", valueOf);
|
||
|
}
|
||
|
return sb.toString();
|
||
|
} catch (UnsupportedEncodingException e) {
|
||
|
zze("Failed to encode name or value", e);
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private static void zza(StringBuilder sb, String str, String str2) throws UnsupportedEncodingException {
|
||
|
if (sb.length() != 0) {
|
||
|
sb.append('&');
|
||
|
}
|
||
|
sb.append(URLEncoder.encode(str, "UTF-8"));
|
||
|
sb.append('=');
|
||
|
sb.append(URLEncoder.encode(str2, "UTF-8"));
|
||
|
}
|
||
|
}
|