discord-jadx/app/src/main/java/b/i/a/f/i/b/k9.java

2603 lines
126 KiB
Java

package b.i.a.f.i.b;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.content.ComponentName;
import android.content.ContentValues;
import android.content.Context;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
import androidx.annotation.NonNull;
import androidx.annotation.WorkerThread;
import androidx.collection.ArrayMap;
import b.c.a.a0.d;
import b.i.a.f.e.o.c;
import b.i.a.f.e.p.b;
import b.i.a.f.h.l.a1;
import b.i.a.f.h.l.a4;
import b.i.a.f.h.l.c1;
import b.i.a.f.h.l.d1;
import b.i.a.f.h.l.da;
import b.i.a.f.h.l.e1;
import b.i.a.f.h.l.ea;
import b.i.a.f.h.l.hb;
import b.i.a.f.h.l.i1;
import b.i.a.f.h.l.m9;
import b.i.a.f.h.l.o8;
import b.i.a.f.h.l.p9;
import b.i.a.f.h.l.t8;
import b.i.a.f.h.l.u0;
import b.i.a.f.h.l.u4;
import b.i.a.f.h.l.x7;
import com.google.android.gms.measurement.internal.zzap;
import com.google.android.gms.measurement.internal.zzaq;
import com.google.android.gms.measurement.internal.zzku;
import com.google.android.gms.measurement.internal.zzn;
import com.google.android.gms.measurement.internal.zzz;
import com.google.android.material.shadow.ShadowDrawableWrapper;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.nio.channels.OverlappingFileLockException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
/* compiled from: com.google.android.gms:play-services-measurement@@18.0.0 */
/* loaded from: classes3.dex */
public class k9 implements t5 {
public static volatile k9 a;
/* renamed from: b reason: collision with root package name */
public p4 f1539b;
public x3 c;
public g d;
public b4 e;
public h9 f;
public ba g;
public final q9 h;
public g7 i;
public q8 j;
public final u4 k;
public boolean m;
public long n;
public List<Runnable> o;
public int p;
public int q;
public boolean r;
/* renamed from: s reason: collision with root package name */
public boolean f1540s;
public boolean t;
public FileLock u;
public FileChannel v;
public List<Long> w;
/* renamed from: x reason: collision with root package name */
public List<Long> f1541x;
public boolean l = false;
public final v9 A = new n9(this);
/* renamed from: y reason: collision with root package name */
public long f1542y = -1;
/* renamed from: z reason: collision with root package name */
public final Map<String, d> f1543z = new HashMap();
/* compiled from: com.google.android.gms:play-services-measurement@@18.0.0 */
/* loaded from: classes3.dex */
public class a {
public e1 a;
/* renamed from: b reason: collision with root package name */
public List<Long> f1544b;
public List<a1> c;
public long d;
public a(k9 k9Var, j9 j9Var) {
}
public final void a(e1 e1Var) {
this.a = e1Var;
}
public final boolean b(long j, a1 a1Var) {
if (this.c == null) {
this.c = new ArrayList();
}
if (this.f1544b == null) {
this.f1544b = new ArrayList();
}
if (this.c.size() > 0 && ((this.c.get(0).H() / 1000) / 60) / 60 != ((a1Var.H() / 1000) / 60) / 60) {
return false;
}
long g = this.d + a1Var.g();
if (g >= Math.max(0, p.i.a(null).intValue())) {
return false;
}
this.d = g;
this.c.add(a1Var);
this.f1544b.add(Long.valueOf(j));
return this.c.size() < Math.max(1, p.j.a(null).intValue());
}
}
public k9(r9 r9Var) {
u4 b2 = u4.b(r9Var.a, null, null);
this.k = b2;
q9 q9Var = new q9(this);
q9Var.o();
this.h = q9Var;
x3 x3Var = new x3(this);
x3Var.o();
this.c = x3Var;
p4 p4Var = new p4(this);
p4Var.o();
this.f1539b = p4Var;
b2.f().v(new j9(this, r9Var));
}
public static void C(i9 i9Var) {
if (i9Var == null) {
throw new IllegalStateException("Upload Component not created");
} else if (!i9Var.c) {
String valueOf = String.valueOf(i9Var.getClass());
throw new IllegalStateException(b.d.b.a.a.i(valueOf.length() + 27, "Component not initialized: ", valueOf));
}
}
public static k9 b(Context context) {
Objects.requireNonNull(context, "null reference");
Objects.requireNonNull(context.getApplicationContext(), "null reference");
if (a == null) {
synchronized (k9.class) {
if (a == null) {
a = new k9(new r9(context));
}
}
}
return a;
}
public static void d(a1.a aVar, int i, String str) {
List<c1> v = aVar.v();
for (int i2 = 0; i2 < v.size(); i2++) {
if ("_err".equals(v.get(i2).B())) {
return;
}
}
c1.a Q = c1.Q();
Q.s("_err");
Q.r(Long.valueOf(i).longValue());
c1 c1Var = (c1) ((u4) Q.p());
c1.a Q2 = c1.Q();
Q2.s("_ev");
Q2.t(str);
c1 c1Var2 = (c1) ((u4) Q2.p());
if (aVar.l) {
aVar.n();
aVar.l = false;
}
a1.A((a1) aVar.k, c1Var);
if (aVar.l) {
aVar.n();
aVar.l = false;
}
a1.A((a1) aVar.k, c1Var2);
}
public static void e(a1.a aVar, @NonNull String str) {
List<c1> v = aVar.v();
for (int i = 0; i < v.size(); i++) {
if (str.equals(v.get(i).B())) {
aVar.x(i);
return;
}
}
}
public final void A(a1.a aVar, a1.a aVar2) {
d.l("_e".equals(aVar.y()));
N();
c1 w = q9.w((a1) ((u4) aVar.p()), "_et");
if (w.I() && w.J() > 0) {
long J = w.J();
N();
c1 w2 = q9.w((a1) ((u4) aVar2.p()), "_et");
if (w2 != null && w2.J() > 0) {
J += w2.J();
}
N();
q9.E(aVar2, "_et", Long.valueOf(J));
N();
q9.E(aVar, "_fr", 1L);
}
}
@WorkerThread
public final void B(zzaq zzaqVar, zzn zznVar) {
if (ea.b() && this.k.h.o(p.A0)) {
u3 b2 = u3.b(zzaqVar);
this.k.t().H(b2.d, K().h0(zznVar.j));
this.k.t().Q(b2, this.k.h.m(zznVar.j));
zzaqVar = b2.a();
}
if (this.k.h.o(p.f1553e0) && "_cmp".equals(zzaqVar.j) && "referrer API v2".equals(zzaqVar.k.j.getString("_cis"))) {
String string = zzaqVar.k.j.getString("gclid");
if (!TextUtils.isEmpty(string)) {
o(new zzku("_lgclid", zzaqVar.m, string, "auto"), zznVar);
}
}
l(zzaqVar, zznVar);
}
@WorkerThread
public final void D(zzku zzkuVar, zzn zznVar) {
U();
P();
if (L(zznVar)) {
if (!zznVar.q) {
G(zznVar);
} else if (!"_npa".equals(zzkuVar.k) || zznVar.B == null) {
this.k.g().m.b("Removing user property", this.k.u().y(zzkuVar.k));
K().b0();
try {
G(zznVar);
K().V(zznVar.j, zzkuVar.k);
K().s();
this.k.g().m.b("User property removed", this.k.u().y(zzkuVar.k));
} finally {
K().e0();
}
} else {
this.k.g().m.a("Falling back to manifest metadata value for ad personalization");
Objects.requireNonNull((c) this.k.o);
o(new zzku("_npa", System.currentTimeMillis(), Long.valueOf(zznVar.B.booleanValue() ? 1L : 0L), "auto"), zznVar);
}
}
}
/* JADX WARN: Can't wrap try/catch for region: R(7:158|97|(2:101|(8:103|(3:105|(2:107|(1:109))(1:110)|111)(1:112)|113|(1:115)(1:116)|117|164|119|(4:123|(1:125)|126|(1:128))))|118|164|119|(0)) */
/* JADX WARN: Code restructure failed: missing block: B:120:0x039d, code lost:
r0 = move-exception;
*/
/* JADX WARN: Code restructure failed: missing block: B:121:0x039e, code lost:
r22.k.g().f.c("Application info is null, first open report might be inaccurate. appId", b.i.a.f.i.b.q3.s(r23.j), r0);
r14 = r18;
*/
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:123:0x03b5 A[Catch: all -> 0x04b4, TryCatch #2 {all -> 0x04b4, blocks: (B:24:0x00ad, B:26:0x00bb, B:30:0x00c9, B:32:0x00cd, B:36:0x00dc, B:38:0x00f6, B:40:0x0100, B:43:0x0109, B:44:0x0119, B:46:0x0125, B:48:0x013c, B:49:0x0162, B:51:0x01b4, B:53:0x01c5, B:56:0x01d8, B:58:0x01e3, B:62:0x01f0, B:64:0x01fb, B:66:0x0201, B:70:0x0210, B:72:0x0213, B:74:0x0238, B:76:0x023d, B:79:0x024d, B:82:0x025e, B:85:0x0273, B:87:0x02cb, B:89:0x02d7, B:91:0x02db, B:92:0x02de, B:94:0x02fd, B:97:0x0317, B:99:0x0328, B:101:0x033f, B:103:0x0347, B:105:0x034f, B:109:0x0361, B:110:0x0367, B:113:0x036f, B:117:0x037a, B:119:0x038d, B:121:0x039e, B:123:0x03b5, B:125:0x03bb, B:126:0x03c0, B:128:0x03c6, B:131:0x03d1, B:132:0x03d4, B:135:0x03f0, B:137:0x0423, B:139:0x042b, B:141:0x042f, B:142:0x0432, B:143:0x0446, B:145:0x0454, B:147:0x046c, B:148:0x0473, B:149:0x0488, B:151:0x048c, B:152:0x04a5), top: B:162:0x00ad, inners: #0, #1, #3 }] */
/* JADX WARN: Removed duplicated region for block: B:149:0x0488 A[Catch: all -> 0x04b4, TryCatch #2 {all -> 0x04b4, blocks: (B:24:0x00ad, B:26:0x00bb, B:30:0x00c9, B:32:0x00cd, B:36:0x00dc, B:38:0x00f6, B:40:0x0100, B:43:0x0109, B:44:0x0119, B:46:0x0125, B:48:0x013c, B:49:0x0162, B:51:0x01b4, B:53:0x01c5, B:56:0x01d8, B:58:0x01e3, B:62:0x01f0, B:64:0x01fb, B:66:0x0201, B:70:0x0210, B:72:0x0213, B:74:0x0238, B:76:0x023d, B:79:0x024d, B:82:0x025e, B:85:0x0273, B:87:0x02cb, B:89:0x02d7, B:91:0x02db, B:92:0x02de, B:94:0x02fd, B:97:0x0317, B:99:0x0328, B:101:0x033f, B:103:0x0347, B:105:0x034f, B:109:0x0361, B:110:0x0367, B:113:0x036f, B:117:0x037a, B:119:0x038d, B:121:0x039e, B:123:0x03b5, B:125:0x03bb, B:126:0x03c0, B:128:0x03c6, B:131:0x03d1, B:132:0x03d4, B:135:0x03f0, B:137:0x0423, B:139:0x042b, B:141:0x042f, B:142:0x0432, B:143:0x0446, B:145:0x0454, B:147:0x046c, B:148:0x0473, B:149:0x0488, B:151:0x048c, B:152:0x04a5), top: B:162:0x00ad, inners: #0, #1, #3 }] */
/* JADX WARN: Removed duplicated region for block: B:46:0x0125 A[Catch: all -> 0x04b4, TryCatch #2 {all -> 0x04b4, blocks: (B:24:0x00ad, B:26:0x00bb, B:30:0x00c9, B:32:0x00cd, B:36:0x00dc, B:38:0x00f6, B:40:0x0100, B:43:0x0109, B:44:0x0119, B:46:0x0125, B:48:0x013c, B:49:0x0162, B:51:0x01b4, B:53:0x01c5, B:56:0x01d8, B:58:0x01e3, B:62:0x01f0, B:64:0x01fb, B:66:0x0201, B:70:0x0210, B:72:0x0213, B:74:0x0238, B:76:0x023d, B:79:0x024d, B:82:0x025e, B:85:0x0273, B:87:0x02cb, B:89:0x02d7, B:91:0x02db, B:92:0x02de, B:94:0x02fd, B:97:0x0317, B:99:0x0328, B:101:0x033f, B:103:0x0347, B:105:0x034f, B:109:0x0361, B:110:0x0367, B:113:0x036f, B:117:0x037a, B:119:0x038d, B:121:0x039e, B:123:0x03b5, B:125:0x03bb, B:126:0x03c0, B:128:0x03c6, B:131:0x03d1, B:132:0x03d4, B:135:0x03f0, B:137:0x0423, B:139:0x042b, B:141:0x042f, B:142:0x0432, B:143:0x0446, B:145:0x0454, B:147:0x046c, B:148:0x0473, B:149:0x0488, B:151:0x048c, B:152:0x04a5), top: B:162:0x00ad, inners: #0, #1, #3 }] */
/* JADX WARN: Removed duplicated region for block: B:56:0x01d8 A[Catch: all -> 0x04b4, TryCatch #2 {all -> 0x04b4, blocks: (B:24:0x00ad, B:26:0x00bb, B:30:0x00c9, B:32:0x00cd, B:36:0x00dc, B:38:0x00f6, B:40:0x0100, B:43:0x0109, B:44:0x0119, B:46:0x0125, B:48:0x013c, B:49:0x0162, B:51:0x01b4, B:53:0x01c5, B:56:0x01d8, B:58:0x01e3, B:62:0x01f0, B:64:0x01fb, B:66:0x0201, B:70:0x0210, B:72:0x0213, B:74:0x0238, B:76:0x023d, B:79:0x024d, B:82:0x025e, B:85:0x0273, B:87:0x02cb, B:89:0x02d7, B:91:0x02db, B:92:0x02de, B:94:0x02fd, B:97:0x0317, B:99:0x0328, B:101:0x033f, B:103:0x0347, B:105:0x034f, B:109:0x0361, B:110:0x0367, B:113:0x036f, B:117:0x037a, B:119:0x038d, B:121:0x039e, B:123:0x03b5, B:125:0x03bb, B:126:0x03c0, B:128:0x03c6, B:131:0x03d1, B:132:0x03d4, B:135:0x03f0, B:137:0x0423, B:139:0x042b, B:141:0x042f, B:142:0x0432, B:143:0x0446, B:145:0x0454, B:147:0x046c, B:148:0x0473, B:149:0x0488, B:151:0x048c, B:152:0x04a5), top: B:162:0x00ad, inners: #0, #1, #3 }] */
/* JADX WARN: Removed duplicated region for block: B:76:0x023d A[Catch: all -> 0x04b4, TryCatch #2 {all -> 0x04b4, blocks: (B:24:0x00ad, B:26:0x00bb, B:30:0x00c9, B:32:0x00cd, B:36:0x00dc, B:38:0x00f6, B:40:0x0100, B:43:0x0109, B:44:0x0119, B:46:0x0125, B:48:0x013c, B:49:0x0162, B:51:0x01b4, B:53:0x01c5, B:56:0x01d8, B:58:0x01e3, B:62:0x01f0, B:64:0x01fb, B:66:0x0201, B:70:0x0210, B:72:0x0213, B:74:0x0238, B:76:0x023d, B:79:0x024d, B:82:0x025e, B:85:0x0273, B:87:0x02cb, B:89:0x02d7, B:91:0x02db, B:92:0x02de, B:94:0x02fd, B:97:0x0317, B:99:0x0328, B:101:0x033f, B:103:0x0347, B:105:0x034f, B:109:0x0361, B:110:0x0367, B:113:0x036f, B:117:0x037a, B:119:0x038d, B:121:0x039e, B:123:0x03b5, B:125:0x03bb, B:126:0x03c0, B:128:0x03c6, B:131:0x03d1, B:132:0x03d4, B:135:0x03f0, B:137:0x0423, B:139:0x042b, B:141:0x042f, B:142:0x0432, B:143:0x0446, B:145:0x0454, B:147:0x046c, B:148:0x0473, B:149:0x0488, B:151:0x048c, B:152:0x04a5), top: B:162:0x00ad, inners: #0, #1, #3 }] */
/* JADX WARN: Removed duplicated region for block: B:77:0x024a */
/* JADX WARN: Removed duplicated region for block: B:82:0x025e A[Catch: all -> 0x04b4, TRY_LEAVE, TryCatch #2 {all -> 0x04b4, blocks: (B:24:0x00ad, B:26:0x00bb, B:30:0x00c9, B:32:0x00cd, B:36:0x00dc, B:38:0x00f6, B:40:0x0100, B:43:0x0109, B:44:0x0119, B:46:0x0125, B:48:0x013c, B:49:0x0162, B:51:0x01b4, B:53:0x01c5, B:56:0x01d8, B:58:0x01e3, B:62:0x01f0, B:64:0x01fb, B:66:0x0201, B:70:0x0210, B:72:0x0213, B:74:0x0238, B:76:0x023d, B:79:0x024d, B:82:0x025e, B:85:0x0273, B:87:0x02cb, B:89:0x02d7, B:91:0x02db, B:92:0x02de, B:94:0x02fd, B:97:0x0317, B:99:0x0328, B:101:0x033f, B:103:0x0347, B:105:0x034f, B:109:0x0361, B:110:0x0367, B:113:0x036f, B:117:0x037a, B:119:0x038d, B:121:0x039e, B:123:0x03b5, B:125:0x03bb, B:126:0x03c0, B:128:0x03c6, B:131:0x03d1, B:132:0x03d4, B:135:0x03f0, B:137:0x0423, B:139:0x042b, B:141:0x042f, B:142:0x0432, B:143:0x0446, B:145:0x0454, B:147:0x046c, B:148:0x0473, B:149:0x0488, B:151:0x048c, B:152:0x04a5), top: B:162:0x00ad, inners: #0, #1, #3 }] */
@WorkerThread
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public final void E(zzn zznVar) {
a4 a4Var;
a4 T;
String str;
long j;
long j2;
String str2;
PackageInfo packageInfo;
long j3;
ApplicationInfo applicationInfo;
boolean z2;
U();
P();
Objects.requireNonNull(zznVar, "null reference");
d.w(zznVar.j);
if (L(zznVar)) {
a4 T2 = K().T(zznVar.j);
if (T2 != null && TextUtils.isEmpty(T2.v()) && !TextUtils.isEmpty(zznVar.k)) {
T2.F(0L);
K().I(T2);
p4 H = H();
String str3 = zznVar.j;
H.b();
H.g.remove(str3);
}
if (!zznVar.q) {
G(zznVar);
return;
}
long j4 = zznVar.v;
if (j4 == 0) {
Objects.requireNonNull((c) this.k.o);
j4 = System.currentTimeMillis();
}
j y2 = this.k.y();
y2.b();
y2.g = null;
y2.h = 0L;
int i = zznVar.w;
if (!(i == 0 || i == 1)) {
this.k.g().i.c("Incorrect app type, assuming installed app. appId, appType", q3.s(zznVar.j), Integer.valueOf(i));
i = 0;
}
K().b0();
try {
u9 Y = K().Y(zznVar.j, "_npa");
if (Y != null && !"auto".equals(Y.f1573b)) {
a4Var = null;
T = K().T(zznVar.j);
if (T != null) {
this.k.t();
if (t9.d0(zznVar.k, T.v(), zznVar.A, T.y())) {
this.k.g().i.b("New GMP App Id passed in. Removing cached database data. appId", q3.s(T.o()));
g K = K();
String o = T.o();
K.n();
K.b();
d.w(o);
try {
SQLiteDatabase t = K.t();
String[] strArr = {o};
int delete = t.delete("events", "app_id=?", strArr) + 0 + t.delete("user_attributes", "app_id=?", strArr) + t.delete("conditional_properties", "app_id=?", strArr) + t.delete("apps", "app_id=?", strArr) + t.delete("raw_events", "app_id=?", strArr) + t.delete("raw_events_metadata", "app_id=?", strArr) + t.delete("event_filters", "app_id=?", strArr) + t.delete("property_filters", "app_id=?", strArr) + t.delete("audience_filter_values", "app_id=?", strArr) + t.delete("consent_settings", "app_id=?", strArr);
if (delete > 0) {
K.g().n.c("Deleted application data. app, records", o, Integer.valueOf(delete));
}
} catch (SQLiteException e) {
K.g().f.c("Error deleting application data. appId, error", q3.s(o), e);
}
T = a4Var;
}
}
if (T != null) {
if (((T.N() == -2147483648L || T.N() == zznVar.f2985s) ? false : true) || (T.N() == -2147483648L && T.M() != null && !T.M().equals(zznVar.l))) {
Bundle bundle = new Bundle();
bundle.putString("_pv", T.M());
l(new zzaq("_au", new zzap(bundle), "auto", j4), zznVar);
G(zznVar);
if ((i == 0 ? K().z(zznVar.j, "_f") : i == 1 ? K().z(zznVar.j, "_v") : a4Var) == null) {
long j5 = ((j4 / 3600000) + 1) * 3600000;
if (i == 0) {
o(new zzku("_fot", j4, Long.valueOf(j5), "auto"), zznVar);
U();
this.k.f1569x.a(zznVar.j);
U();
P();
Bundle bundle2 = new Bundle();
bundle2.putLong("_c", 1L);
bundle2.putLong("_r", 1L);
bundle2.putLong("_uwa", 0L);
bundle2.putLong("_pfo", 0L);
bundle2.putLong("_sys", 0L);
bundle2.putLong("_sysu", 0L);
if (this.k.h.u(zznVar.j, p.T)) {
str2 = "_et";
j2 = 1;
bundle2.putLong(str2, 1L);
} else {
str2 = "_et";
j2 = 1;
}
if (zznVar.f2988z) {
bundle2.putLong("_dac", j2);
}
g K2 = K();
String str4 = zznVar.j;
d.w(str4);
K2.b();
K2.n();
long g02 = K2.g0(str4, "first_open_count");
if (this.k.f1567b.getPackageManager() == null) {
this.k.g().f.b("PackageManager is null, first open report might be inaccurate. appId", q3.s(zznVar.j));
str = str2;
j3 = g02;
} else {
try {
packageInfo = b.a(this.k.f1567b).b(zznVar.j, 0);
} catch (PackageManager.NameNotFoundException e2) {
this.k.g().f.c("Package info is null, first open report might be inaccurate. appId", q3.s(zznVar.j), e2);
packageInfo = a4Var;
}
if (packageInfo != 0) {
long j6 = packageInfo.firstInstallTime;
if (j6 != 0) {
str = str2;
if (j6 != packageInfo.lastUpdateTime) {
if (!this.k.h.o(p.n0)) {
bundle2.putLong("_uwa", 1L);
} else if (g02 == 0) {
bundle2.putLong("_uwa", 1L);
}
z2 = false;
} else {
z2 = true;
}
j3 = g02;
o(new zzku("_fi", j4, Long.valueOf(z2 ? 1L : 0L), "auto"), zznVar);
applicationInfo = b.a(this.k.f1567b).a(zznVar.j, 0);
if (applicationInfo != null) {
if ((applicationInfo.flags & 1) != 0) {
bundle2.putLong("_sys", 1L);
}
if ((applicationInfo.flags & 128) != 0) {
bundle2.putLong("_sysu", 1L);
}
}
}
}
str = str2;
j3 = g02;
applicationInfo = b.a(this.k.f1567b).a(zznVar.j, 0);
if (applicationInfo != null) {
}
}
if (j3 >= 0) {
bundle2.putLong("_pfo", j3);
}
B(new zzaq("_f", new zzap(bundle2), "auto", j4), zznVar);
} else {
str = "_et";
if (i == 1) {
o(new zzku("_fvt", j4, Long.valueOf(j5), "auto"), zznVar);
U();
P();
Bundle bundle3 = new Bundle();
bundle3.putLong("_c", 1L);
bundle3.putLong("_r", 1L);
if (this.k.h.u(zznVar.j, p.T)) {
j = 1;
bundle3.putLong(str, 1L);
} else {
j = 1;
}
if (zznVar.f2988z) {
bundle3.putLong("_dac", j);
}
B(new zzaq("_v", new zzap(bundle3), "auto", j4), zznVar);
}
}
if (!this.k.h.u(zznVar.j, p.U)) {
Bundle bundle4 = new Bundle();
bundle4.putLong(str, 1L);
if (this.k.h.u(zznVar.j, p.T)) {
bundle4.putLong("_fr", 1L);
}
B(new zzaq("_e", new zzap(bundle4), "auto", j4), zznVar);
}
} else if (zznVar.r) {
B(new zzaq("_cd", new zzap(new Bundle()), "auto", j4), zznVar);
}
K().s();
}
}
G(zznVar);
if ((i == 0 ? K().z(zznVar.j, "_f") : i == 1 ? K().z(zznVar.j, "_v") : a4Var) == null) {
}
K().s();
}
Boolean bool = zznVar.B;
if (bool != null) {
a4Var = null;
zzku zzkuVar = new zzku("_npa", j4, Long.valueOf(bool.booleanValue() ? 1L : 0L), "auto");
if (Y == null || !Y.e.equals(zzkuVar.m)) {
o(zzkuVar, zznVar);
}
} else {
a4Var = null;
if (Y != null) {
D(new zzku("_npa", j4, null, "auto"), zznVar);
}
}
T = K().T(zznVar.j);
if (T != null) {
}
if (T != null) {
}
G(zznVar);
if ((i == 0 ? K().z(zznVar.j, "_f") : i == 1 ? K().z(zznVar.j, "_v") : a4Var) == null) {
}
K().s();
} finally {
K().e0();
}
}
}
@WorkerThread
public final void F(zzz zzzVar, zzn zznVar) {
Objects.requireNonNull(zzzVar, "null reference");
d.w(zzzVar.j);
Objects.requireNonNull(zzzVar.l, "null reference");
d.w(zzzVar.l.k);
U();
P();
if (L(zznVar)) {
if (!zznVar.q) {
G(zznVar);
return;
}
K().b0();
try {
G(zznVar);
zzz Z = K().Z(zzzVar.j, zzzVar.l.k);
if (Z != null) {
this.k.g().m.c("Removing conditional user property", zzzVar.j, this.k.u().y(zzzVar.l.k));
K().a0(zzzVar.j, zzzVar.l.k);
if (Z.n) {
K().V(zzzVar.j, zzzVar.l.k);
}
zzaq zzaqVar = zzzVar.t;
if (zzaqVar != null) {
Bundle bundle = null;
zzap zzapVar = zzaqVar.k;
if (zzapVar != null) {
bundle = zzapVar.x0();
}
t9 t = this.k.t();
String str = zzzVar.j;
zzaq zzaqVar2 = zzzVar.t;
I(t.B(str, zzaqVar2.j, bundle, Z.k, zzaqVar2.m, true, x7.b() && this.k.h.o(p.M0)), zznVar);
}
} else {
this.k.g().i.c("Conditional user property doesn't exist", q3.s(zzzVar.j), this.k.u().y(zzzVar.l.k));
}
K().s();
} finally {
K().e0();
}
}
}
/* JADX WARN: Removed duplicated region for block: B:129:0x02bf */
/* JADX WARN: Removed duplicated region for block: B:132:0x02d1 */
/* JADX WARN: Removed duplicated region for block: B:157:0x0351 */
/* JADX WARN: Removed duplicated region for block: B:165:0x0375 */
/* JADX WARN: Removed duplicated region for block: B:168:0x0383 */
/* JADX WARN: Removed duplicated region for block: B:171:0x0391 */
/* JADX WARN: Removed duplicated region for block: B:181:0x03ce */
/* JADX WARN: Removed duplicated region for block: B:184:0x03dc */
/* JADX WARN: Removed duplicated region for block: B:187:0x03ea */
/* JADX WARN: Removed duplicated region for block: B:195:0x0407 */
@WorkerThread
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public final a4 G(zzn zznVar) {
long j;
String str;
long j2;
U();
P();
Objects.requireNonNull(zznVar, "null reference");
d.w(zznVar.j);
a4 T = K().T(zznVar.j);
d dVar = d.a;
d h = (!t8.b() || !this.k.h.o(p.J0)) ? dVar : a(zznVar.j).h(d.b(zznVar.F));
String t = (!t8.b() || !this.k.h.o(p.J0) || h.j()) ? this.j.t(zznVar.j) : "";
if (!((p9) m9.j.a()).a() || !this.k.h.o(p.o0)) {
if (t8.b() && this.k.h.o(p.J0)) {
dVar = a(zznVar.j).h(d.b(zznVar.F));
}
boolean z2 = true;
if (T == null) {
T = new a4(this.k, zznVar.j);
if (!t8.b() || !this.k.h.o(p.J0)) {
T.c(W());
T.x(t);
} else {
if (dVar.k()) {
T.c(c(dVar));
}
if (dVar.j()) {
T.x(t);
}
}
} else if ((!t8.b() || !this.k.h.o(p.J0) || dVar.j()) && !t.equals(T.E())) {
T.x(t);
if (!t8.b() || !this.k.h.o(p.J0)) {
T.c(W());
} else if (dVar.k()) {
T.c(c(dVar));
}
} else if (!t8.b() || !this.k.h.o(p.J0) || !TextUtils.isEmpty(T.s()) || !dVar.k()) {
z2 = false;
if (!TextUtils.equals(zznVar.k, T.v())) {
T.m(zznVar.k);
z2 = true;
}
if (!TextUtils.equals(zznVar.A, T.y())) {
T.q(zznVar.A);
z2 = true;
}
if (da.b() && this.k.h.u(T.o(), p.f1558j0) && !TextUtils.equals(zznVar.E, T.B())) {
T.u(zznVar.E);
z2 = true;
}
if (!TextUtils.isEmpty(zznVar.t) && !zznVar.t.equals(T.H())) {
T.A(zznVar.t);
z2 = true;
}
j = zznVar.n;
if (!(j == 0 || j == T.P())) {
T.t(zznVar.n);
z2 = true;
}
if (!TextUtils.isEmpty(zznVar.l) && !zznVar.l.equals(T.M())) {
T.D(zznVar.l);
z2 = true;
}
if (zznVar.f2985s != T.N()) {
T.p(zznVar.f2985s);
z2 = true;
}
str = zznVar.m;
if (str != null && !str.equals(T.O())) {
T.G(zznVar.m);
z2 = true;
}
if (zznVar.o != T.Q()) {
T.w(zznVar.o);
z2 = true;
}
if (zznVar.q != T.T()) {
T.e(zznVar.q);
z2 = true;
}
if (!TextUtils.isEmpty(zznVar.p)) {
String str2 = zznVar.p;
T.a.f().b();
if (!str2.equals(T.D)) {
T.J(zznVar.p);
z2 = true;
}
}
if (!this.k.h.o(p.y0) && zznVar.u != T.g()) {
T.R(zznVar.u);
z2 = true;
}
if (zznVar.f2986x != T.h()) {
T.n(zznVar.f2986x);
z2 = true;
}
if (zznVar.f2987y != T.i()) {
T.r(zznVar.f2987y);
z2 = true;
}
if (zznVar.B != T.j()) {
T.b(zznVar.B);
z2 = true;
}
j2 = zznVar.C;
if (j2 == 0 && j2 != T.S()) {
T.z(zznVar.C);
}
if (z2) {
K().I(T);
}
return T;
} else {
T.c(c(dVar));
}
z2 = true;
if (!TextUtils.equals(zznVar.k, T.v())) {
}
if (!TextUtils.equals(zznVar.A, T.y())) {
}
if (da.b()) {
T.u(zznVar.E);
z2 = true;
}
if (!TextUtils.isEmpty(zznVar.t)) {
T.A(zznVar.t);
z2 = true;
}
j = zznVar.n;
if (j == 0) {
T.t(zznVar.n);
z2 = true;
}
if (!TextUtils.isEmpty(zznVar.l)) {
T.D(zznVar.l);
z2 = true;
}
if (zznVar.f2985s != T.N()) {
}
str = zznVar.m;
if (str != null) {
T.G(zznVar.m);
z2 = true;
}
if (zznVar.o != T.Q()) {
}
if (zznVar.q != T.T()) {
}
if (!TextUtils.isEmpty(zznVar.p)) {
}
if (!this.k.h.o(p.y0)) {
T.R(zznVar.u);
z2 = true;
}
if (zznVar.f2986x != T.h()) {
}
if (zznVar.f2987y != T.i()) {
}
if (zznVar.B != T.j()) {
}
j2 = zznVar.C;
if (j2 == 0) {
}
if (z2) {
}
return T;
}
if (T == null) {
T = new a4(this.k, zznVar.j);
if (!t8.b() || !this.k.h.o(p.J0)) {
T.c(W());
T.x(t);
} else {
if (h.k()) {
T.c(c(h));
}
if (h.j()) {
T.x(t);
}
}
} else if ((!t8.b() || !this.k.h.o(p.J0) || h.j()) && !t.equals(T.E())) {
T.x(t);
if (!t8.b() || !this.k.h.o(p.J0)) {
T.c(W());
} else {
T.c(c(h));
}
} else if (t8.b() && this.k.h.o(p.J0) && TextUtils.isEmpty(T.s()) && h.k()) {
T.c(c(h));
}
T.m(zznVar.k);
T.q(zznVar.A);
if (da.b() && this.k.h.u(T.o(), p.f1558j0)) {
T.u(zznVar.E);
}
if (!TextUtils.isEmpty(zznVar.t)) {
T.A(zznVar.t);
}
long j3 = zznVar.n;
if (j3 != 0) {
T.t(j3);
}
if (!TextUtils.isEmpty(zznVar.l)) {
T.D(zznVar.l);
}
T.p(zznVar.f2985s);
String str3 = zznVar.m;
if (str3 != null) {
T.G(str3);
}
T.w(zznVar.o);
T.e(zznVar.q);
if (!TextUtils.isEmpty(zznVar.p)) {
T.J(zznVar.p);
}
if (!this.k.h.o(p.y0)) {
T.R(zznVar.u);
}
T.n(zznVar.f2986x);
T.r(zznVar.f2987y);
T.b(zznVar.B);
T.z(zznVar.C);
T.a.f().b();
if (T.E) {
K().I(T);
}
return T;
}
public final p4 H() {
C(this.f1539b);
return this.f1539b;
}
/* JADX WARN: Can't wrap try/catch for region: R(13:73|(1:75)(1:76)|77|(2:79|(1:81)(6:82|83|90|(1:92)|94|(0)))|84|303|85|89|83|90|(0)|94|(0)) */
/* JADX WARN: Code restructure failed: missing block: B:289:0x0942, code lost:
if (r7.e < r26.k.a().s(r4.a)) goto L_0x0944;
*/
/* JADX WARN: Code restructure failed: missing block: B:290:0x0944, code lost:
r5 = true;
*/
/* JADX WARN: Code restructure failed: missing block: B:86:0x0280, code lost:
r0 = move-exception;
*/
/* JADX WARN: Code restructure failed: missing block: B:88:0x0282, code lost:
r7.g().z().c("Error pruning currencies. appId", b.i.a.f.i.b.q3.s(r15), r0);
*/
/* JADX WARN: Removed duplicated region for block: B:102:0x0352 A[Catch: all -> 0x099c, TryCatch #2 {all -> 0x099c, blocks: (B:37:0x013e, B:40:0x014d, B:42:0x0157, B:47:0x0163, B:54:0x0175, B:57:0x0181, B:59:0x0198, B:64:0x01b1, B:67:0x01bf, B:68:0x01dc, B:69:0x01e6, B:71:0x01ec, B:73:0x01fa, B:75:0x0202, B:76:0x0207, B:77:0x020c, B:79:0x0217, B:82:0x021e, B:84:0x0248, B:85:0x0267, B:88:0x0282, B:89:0x0293, B:90:0x02b0, B:92:0x02ba, B:96:0x02f3, B:100:0x0305, B:102:0x0352, B:104:0x0357, B:105:0x0370, B:109:0x0381, B:111:0x0396, B:113:0x039b, B:114:0x03b4, B:118:0x03d9, B:122:0x03fe, B:123:0x0417, B:126:0x0426, B:129:0x0449, B:130:0x0465, B:132:0x046f, B:134:0x047b, B:136:0x0481, B:137:0x048c, B:139:0x0498, B:140:0x04af, B:142:0x04d7, B:145:0x04f0, B:148:0x0536, B:149:0x0540, B:150:0x054e, B:152:0x0585, B:153:0x058a, B:155:0x0592, B:156:0x0597, B:158:0x059f, B:159:0x05a4, B:161:0x05ad, B:162:0x05b1, B:164:0x05be, B:165:0x05c3, B:167:0x05c9, B:169:0x05d7, B:170:0x05ee, B:172:0x05f4, B:174:0x0604, B:176:0x060e, B:178:0x0616, B:179:0x061b, B:181:0x0625, B:183:0x062f, B:185:0x0637, B:186:0x063d, B:188:0x0647, B:190:0x064f, B:191:0x0654, B:193:0x065c, B:194:0x065f, B:196:0x066e, B:197:0x0671, B:199:0x0687, B:201:0x0695, B:203:0x069b, B:205:0x06ad, B:207:0x06b1, B:209:0x06bc, B:210:0x06c7, B:212:0x06d9, B:214:0x06dd, B:216:0x06e3, B:218:0x06f3, B:220:0x0705, B:221:0x071f, B:223:0x0725, B:224:0x073c, B:225:0x073f, B:227:0x0784, B:228:0x0789, B:230:0x0791, B:232:0x0797, B:234:0x07a5, B:235:0x07a9, B:236:0x07ac, B:239:0x07b4, B:240:0x07b7, B:241:0x07b8, B:243:0x07c4, B:245:0x07d3, B:247:0x07e1, B:248:0x07e9, B:249:0x07f0, B:251:0x0800, B:253:0x080e, B:255:0x0814, B:256:0x081f, B:258:0x0854, B:259:0x0859, B:260:0x0865, B:262:0x086b, B:264:0x0879, B:266:0x087f, B:268:0x0889, B:269:0x0890, B:271:0x089a, B:272:0x08a1, B:273:0x08ac, B:275:0x08b2, B:277:0x08e1, B:278:0x08f1, B:280:0x08f9, B:281:0x08fd, B:283:0x0906, B:286:0x0913, B:288:0x0931, B:292:0x0947, B:294:0x094d, B:296:0x0951, B:297:0x0969), top: B:307:0x013e, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:108:0x037f */
/* JADX WARN: Removed duplicated region for block: B:54:0x0175 A[Catch: all -> 0x099c, TRY_LEAVE, TryCatch #2 {all -> 0x099c, blocks: (B:37:0x013e, B:40:0x014d, B:42:0x0157, B:47:0x0163, B:54:0x0175, B:57:0x0181, B:59:0x0198, B:64:0x01b1, B:67:0x01bf, B:68:0x01dc, B:69:0x01e6, B:71:0x01ec, B:73:0x01fa, B:75:0x0202, B:76:0x0207, B:77:0x020c, B:79:0x0217, B:82:0x021e, B:84:0x0248, B:85:0x0267, B:88:0x0282, B:89:0x0293, B:90:0x02b0, B:92:0x02ba, B:96:0x02f3, B:100:0x0305, B:102:0x0352, B:104:0x0357, B:105:0x0370, B:109:0x0381, B:111:0x0396, B:113:0x039b, B:114:0x03b4, B:118:0x03d9, B:122:0x03fe, B:123:0x0417, B:126:0x0426, B:129:0x0449, B:130:0x0465, B:132:0x046f, B:134:0x047b, B:136:0x0481, B:137:0x048c, B:139:0x0498, B:140:0x04af, B:142:0x04d7, B:145:0x04f0, B:148:0x0536, B:149:0x0540, B:150:0x054e, B:152:0x0585, B:153:0x058a, B:155:0x0592, B:156:0x0597, B:158:0x059f, B:159:0x05a4, B:161:0x05ad, B:162:0x05b1, B:164:0x05be, B:165:0x05c3, B:167:0x05c9, B:169:0x05d7, B:170:0x05ee, B:172:0x05f4, B:174:0x0604, B:176:0x060e, B:178:0x0616, B:179:0x061b, B:181:0x0625, B:183:0x062f, B:185:0x0637, B:186:0x063d, B:188:0x0647, B:190:0x064f, B:191:0x0654, B:193:0x065c, B:194:0x065f, B:196:0x066e, B:197:0x0671, B:199:0x0687, B:201:0x0695, B:203:0x069b, B:205:0x06ad, B:207:0x06b1, B:209:0x06bc, B:210:0x06c7, B:212:0x06d9, B:214:0x06dd, B:216:0x06e3, B:218:0x06f3, B:220:0x0705, B:221:0x071f, B:223:0x0725, B:224:0x073c, B:225:0x073f, B:227:0x0784, B:228:0x0789, B:230:0x0791, B:232:0x0797, B:234:0x07a5, B:235:0x07a9, B:236:0x07ac, B:239:0x07b4, B:240:0x07b7, B:241:0x07b8, B:243:0x07c4, B:245:0x07d3, B:247:0x07e1, B:248:0x07e9, B:249:0x07f0, B:251:0x0800, B:253:0x080e, B:255:0x0814, B:256:0x081f, B:258:0x0854, B:259:0x0859, B:260:0x0865, B:262:0x086b, B:264:0x0879, B:266:0x087f, B:268:0x0889, B:269:0x0890, B:271:0x089a, B:272:0x08a1, B:273:0x08ac, B:275:0x08b2, B:277:0x08e1, B:278:0x08f1, B:280:0x08f9, B:281:0x08fd, B:283:0x0906, B:286:0x0913, B:288:0x0931, B:292:0x0947, B:294:0x094d, B:296:0x0951, B:297:0x0969), top: B:307:0x013e, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:92:0x02ba A[Catch: all -> 0x099c, TryCatch #2 {all -> 0x099c, blocks: (B:37:0x013e, B:40:0x014d, B:42:0x0157, B:47:0x0163, B:54:0x0175, B:57:0x0181, B:59:0x0198, B:64:0x01b1, B:67:0x01bf, B:68:0x01dc, B:69:0x01e6, B:71:0x01ec, B:73:0x01fa, B:75:0x0202, B:76:0x0207, B:77:0x020c, B:79:0x0217, B:82:0x021e, B:84:0x0248, B:85:0x0267, B:88:0x0282, B:89:0x0293, B:90:0x02b0, B:92:0x02ba, B:96:0x02f3, B:100:0x0305, B:102:0x0352, B:104:0x0357, B:105:0x0370, B:109:0x0381, B:111:0x0396, B:113:0x039b, B:114:0x03b4, B:118:0x03d9, B:122:0x03fe, B:123:0x0417, B:126:0x0426, B:129:0x0449, B:130:0x0465, B:132:0x046f, B:134:0x047b, B:136:0x0481, B:137:0x048c, B:139:0x0498, B:140:0x04af, B:142:0x04d7, B:145:0x04f0, B:148:0x0536, B:149:0x0540, B:150:0x054e, B:152:0x0585, B:153:0x058a, B:155:0x0592, B:156:0x0597, B:158:0x059f, B:159:0x05a4, B:161:0x05ad, B:162:0x05b1, B:164:0x05be, B:165:0x05c3, B:167:0x05c9, B:169:0x05d7, B:170:0x05ee, B:172:0x05f4, B:174:0x0604, B:176:0x060e, B:178:0x0616, B:179:0x061b, B:181:0x0625, B:183:0x062f, B:185:0x0637, B:186:0x063d, B:188:0x0647, B:190:0x064f, B:191:0x0654, B:193:0x065c, B:194:0x065f, B:196:0x066e, B:197:0x0671, B:199:0x0687, B:201:0x0695, B:203:0x069b, B:205:0x06ad, B:207:0x06b1, B:209:0x06bc, B:210:0x06c7, B:212:0x06d9, B:214:0x06dd, B:216:0x06e3, B:218:0x06f3, B:220:0x0705, B:221:0x071f, B:223:0x0725, B:224:0x073c, B:225:0x073f, B:227:0x0784, B:228:0x0789, B:230:0x0791, B:232:0x0797, B:234:0x07a5, B:235:0x07a9, B:236:0x07ac, B:239:0x07b4, B:240:0x07b7, B:241:0x07b8, B:243:0x07c4, B:245:0x07d3, B:247:0x07e1, B:248:0x07e9, B:249:0x07f0, B:251:0x0800, B:253:0x080e, B:255:0x0814, B:256:0x081f, B:258:0x0854, B:259:0x0859, B:260:0x0865, B:262:0x086b, B:264:0x0879, B:266:0x087f, B:268:0x0889, B:269:0x0890, B:271:0x089a, B:272:0x08a1, B:273:0x08ac, B:275:0x08b2, B:277:0x08e1, B:278:0x08f1, B:280:0x08f9, B:281:0x08fd, B:283:0x0906, B:286:0x0913, B:288:0x0931, B:292:0x0947, B:294:0x094d, B:296:0x0951, B:297:0x0969), top: B:307:0x013e, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:96:0x02f3 A[Catch: all -> 0x099c, TRY_LEAVE, TryCatch #2 {all -> 0x099c, blocks: (B:37:0x013e, B:40:0x014d, B:42:0x0157, B:47:0x0163, B:54:0x0175, B:57:0x0181, B:59:0x0198, B:64:0x01b1, B:67:0x01bf, B:68:0x01dc, B:69:0x01e6, B:71:0x01ec, B:73:0x01fa, B:75:0x0202, B:76:0x0207, B:77:0x020c, B:79:0x0217, B:82:0x021e, B:84:0x0248, B:85:0x0267, B:88:0x0282, B:89:0x0293, B:90:0x02b0, B:92:0x02ba, B:96:0x02f3, B:100:0x0305, B:102:0x0352, B:104:0x0357, B:105:0x0370, B:109:0x0381, B:111:0x0396, B:113:0x039b, B:114:0x03b4, B:118:0x03d9, B:122:0x03fe, B:123:0x0417, B:126:0x0426, B:129:0x0449, B:130:0x0465, B:132:0x046f, B:134:0x047b, B:136:0x0481, B:137:0x048c, B:139:0x0498, B:140:0x04af, B:142:0x04d7, B:145:0x04f0, B:148:0x0536, B:149:0x0540, B:150:0x054e, B:152:0x0585, B:153:0x058a, B:155:0x0592, B:156:0x0597, B:158:0x059f, B:159:0x05a4, B:161:0x05ad, B:162:0x05b1, B:164:0x05be, B:165:0x05c3, B:167:0x05c9, B:169:0x05d7, B:170:0x05ee, B:172:0x05f4, B:174:0x0604, B:176:0x060e, B:178:0x0616, B:179:0x061b, B:181:0x0625, B:183:0x062f, B:185:0x0637, B:186:0x063d, B:188:0x0647, B:190:0x064f, B:191:0x0654, B:193:0x065c, B:194:0x065f, B:196:0x066e, B:197:0x0671, B:199:0x0687, B:201:0x0695, B:203:0x069b, B:205:0x06ad, B:207:0x06b1, B:209:0x06bc, B:210:0x06c7, B:212:0x06d9, B:214:0x06dd, B:216:0x06e3, B:218:0x06f3, B:220:0x0705, B:221:0x071f, B:223:0x0725, B:224:0x073c, B:225:0x073f, B:227:0x0784, B:228:0x0789, B:230:0x0791, B:232:0x0797, B:234:0x07a5, B:235:0x07a9, B:236:0x07ac, B:239:0x07b4, B:240:0x07b7, B:241:0x07b8, B:243:0x07c4, B:245:0x07d3, B:247:0x07e1, B:248:0x07e9, B:249:0x07f0, B:251:0x0800, B:253:0x080e, B:255:0x0814, B:256:0x081f, B:258:0x0854, B:259:0x0859, B:260:0x0865, B:262:0x086b, B:264:0x0879, B:266:0x087f, B:268:0x0889, B:269:0x0890, B:271:0x089a, B:272:0x08a1, B:273:0x08ac, B:275:0x08b2, B:277:0x08e1, B:278:0x08f1, B:280:0x08f9, B:281:0x08fd, B:283:0x0906, B:286:0x0913, B:288:0x0931, B:292:0x0947, B:294:0x094d, B:296:0x0951, B:297:0x0969), top: B:307:0x013e, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:99:0x0302 */
@WorkerThread
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public final void I(zzaq zzaqVar, zzn zznVar) {
boolean z2;
boolean z3;
long j;
int i;
long intValue;
l lVar;
u9 Y;
boolean z4;
long j2;
u9 u9Var;
Long l;
a4 T;
zzaq zzaqVar2 = zzaqVar;
d.A(zznVar);
d.w(zznVar.j);
long nanoTime = System.nanoTime();
U();
P();
String str = zznVar.j;
N();
if (q9.O(zzaqVar, zznVar)) {
if (!zznVar.q) {
G(zznVar);
return;
}
boolean z5 = true;
if (H().x(str, zzaqVar2.j)) {
this.k.g().A().c("Dropping blacklisted event. appId", q3.s(str), this.k.u().u(zzaqVar2.j));
if (!H().C(str) && !H().D(str)) {
z5 = false;
}
if (z5 || "_err".equals(zzaqVar2.j)) {
l = null;
} else {
l = null;
this.k.t().S(this.A, str, 11, "_ev", zzaqVar2.j, 0);
}
if (z5 && (T = K().T(str)) != null && Math.abs(((c) this.k.i()).a() - Math.max(T.W(), T.V())) > p.f1562z.a(l).longValue()) {
this.k.g().C().a("Fetching config for blacklisted app");
n(T);
return;
}
return;
}
if (o8.b() && this.k.a().o(p.w0)) {
u3 b2 = u3.b(zzaqVar);
this.k.t().Q(b2, this.k.a().m(str));
zzaqVar2 = b2.a();
}
if (this.k.g().x(2)) {
this.k.g().D().b("Logging event", this.k.u().t(zzaqVar2));
}
K().b0();
try {
G(zznVar);
if (!"ecommerce_purchase".equals(zzaqVar2.j) && !"purchase".equals(zzaqVar2.j) && !"refund".equals(zzaqVar2.j)) {
z2 = false;
if (!"_iap".equals(zzaqVar2.j) && !z2) {
z3 = false;
if (!z3) {
String A0 = zzaqVar2.k.A0("currency");
if (z2) {
double doubleValue = zzaqVar2.k.z0("value").doubleValue() * 1000000.0d;
if (doubleValue == ShadowDrawableWrapper.COS_45) {
doubleValue = zzaqVar2.k.y0("value").longValue() * 1000000.0d;
}
if (doubleValue > 9.223372036854776E18d || doubleValue < -9.223372036854776E18d) {
this.k.g().A().c("Data lost. Currency value is too big. appId", q3.s(str), Double.valueOf(doubleValue));
j = nanoTime;
i = 0;
z4 = false;
if (!z4) {
K().s();
return;
}
} else {
j2 = Math.round(doubleValue);
if ("refund".equals(zzaqVar2.j)) {
j2 = -j2;
}
}
} else {
j2 = zzaqVar2.k.y0("value").longValue();
}
if (!TextUtils.isEmpty(A0)) {
String upperCase = A0.toUpperCase(Locale.US);
if (upperCase.matches("[A-Z]{3}")) {
String concat = upperCase.length() != 0 ? "_ltv_".concat(upperCase) : new String("_ltv_");
u9 Y2 = K().Y(str, concat);
if (Y2 != null) {
Object obj = Y2.e;
if (obj instanceof Long) {
j = nanoTime;
i = 0;
u9Var = new u9(str, zzaqVar2.l, concat, ((c) this.k.i()).a(), Long.valueOf(((Long) obj).longValue() + j2));
if (!K().M(u9Var)) {
this.k.g().z().d("Too many unique user properties are set. Ignoring user property. appId", q3.s(str), this.k.u().y(u9Var.c), u9Var.e);
this.k.t().S(this.A, str, 9, null, null, 0);
}
z4 = true;
if (!z4) {
}
}
}
j = nanoTime;
i = 0;
g K = K();
int q = this.k.a().q(str, p.E) - 1;
d.w(str);
K.b();
K.n();
K.t().execSQL("delete from user_attributes where app_id=? and name in (select name from user_attributes where app_id=? and name like '_ltv_%' order by set_timestamp desc limit ?,10);", new String[]{str, str, String.valueOf(q)});
u9Var = new u9(str, zzaqVar2.l, concat, ((c) this.k.i()).a(), Long.valueOf(j2));
if (!K().M(u9Var)) {
}
z4 = true;
if (!z4) {
}
}
}
j = nanoTime;
i = 0;
z4 = true;
if (!z4) {
}
} else {
j = nanoTime;
i = 0;
}
boolean X = t9.X(zzaqVar2.j);
boolean equals = "_err".equals(zzaqVar2.j);
this.k.t();
f x2 = K().x(V(), str, t9.v(zzaqVar2.k) + 1, true, X, false, equals, false);
intValue = x2.f1529b - p.k.a(null).intValue();
if (intValue <= 0) {
if (intValue % 1000 == 1) {
this.k.g().z().c("Data loss. Too many events logged. appId, count", q3.s(str), Long.valueOf(x2.f1529b));
}
K().s();
return;
}
if (X) {
long intValue2 = x2.a - p.m.a(null).intValue();
if (intValue2 > 0) {
if (intValue2 % 1000 == 1) {
this.k.g().z().c("Data loss. Too many public events logged. appId, count", q3.s(str), Long.valueOf(x2.a));
}
this.k.t().S(this.A, str, 16, "_ev", zzaqVar2.j, 0);
K().s();
return;
}
}
if (equals) {
long max = x2.d - Math.max(i, Math.min(1000000, this.k.a().q(zznVar.j, p.l)));
if (max > 0) {
if (max == 1) {
this.k.g().z().c("Too many error events logged. appId, count", q3.s(str), Long.valueOf(x2.d));
}
K().s();
return;
}
}
Bundle x0 = zzaqVar2.k.x0();
this.k.t().I(x0, "_o", zzaqVar2.l);
if (this.k.t().s0(str)) {
this.k.t().I(x0, "_dbg", 1L);
this.k.t().I(x0, "_r", 1L);
}
if ("_s".equals(zzaqVar2.j) && (Y = K().Y(zznVar.j, "_sno")) != null && (Y.e instanceof Long)) {
this.k.t().I(x0, "_sno", Y.e);
}
long X2 = K().X(str);
if (X2 > 0) {
this.k.g().A().c("Data lost. Too many events stored on disk, deleted. appId", q3.s(str), Long.valueOf(X2));
}
m mVar = new m(this.k, zzaqVar2.l, str, zzaqVar2.j, zzaqVar2.m, 0L, x0);
l z6 = K().z(str, mVar.f1546b);
if (z6 != null) {
mVar = mVar.a(this.k, z6.f);
lVar = z6.a(mVar.d);
} else if (K().f0(str) < this.k.a().p(str) || !X) {
lVar = new l(str, mVar.f1546b, mVar.d);
} else {
this.k.g().z().d("Too many event names used, ignoring event. appId, name, supported count", q3.s(str), this.k.u().u(mVar.f1546b), Integer.valueOf(this.k.a().p(str)));
this.k.t().S(this.A, str, 8, null, null, 0);
return;
}
K().H(lVar);
U();
P();
d.A(mVar);
d.A(zznVar);
d.w(mVar.a);
d.l(mVar.a.equals(zznVar.j));
e1.a u0 = e1.u0();
u0.q();
u0.x("android");
if (!TextUtils.isEmpty(zznVar.j)) {
u0.X(zznVar.j);
}
if (!TextUtils.isEmpty(zznVar.m)) {
u0.T(zznVar.m);
}
if (!TextUtils.isEmpty(zznVar.l)) {
u0.a0(zznVar.l);
}
long j3 = zznVar.f2985s;
if (j3 != -2147483648L) {
u0.c0((int) j3);
}
u0.W(zznVar.n);
if (!TextUtils.isEmpty(zznVar.k)) {
u0.m0(zznVar.k);
}
if (t8.b() && this.k.a().o(p.J0)) {
u0.w0(a(zznVar.j).h(d.b(zznVar.F)).d());
}
if (da.b() && this.k.a().v(zznVar.j, p.f1558j0)) {
if (TextUtils.isEmpty(u0.s0()) && !TextUtils.isEmpty(zznVar.E)) {
u0.u0(zznVar.E);
}
if (TextUtils.isEmpty(u0.s0()) && TextUtils.isEmpty(u0.x0()) && !TextUtils.isEmpty(zznVar.A)) {
u0.r0(zznVar.A);
}
} else if (TextUtils.isEmpty(u0.s0()) && !TextUtils.isEmpty(zznVar.A)) {
u0.r0(zznVar.A);
}
long j4 = zznVar.o;
if (j4 != 0) {
u0.d0(j4);
}
u0.l0(zznVar.C);
List<Integer> U = N().U();
if (U != null) {
u0.M(U);
}
d h = a(zznVar.j).h(d.b(zznVar.F));
if (!t8.b() || !this.k.a().o(p.J0) || h.j()) {
Pair<String, Boolean> s2 = this.j.s(zznVar.j, h);
if (!TextUtils.isEmpty((CharSequence) s2.first)) {
if (zznVar.f2986x) {
u0.e0((String) s2.first);
Object obj2 = s2.second;
if (obj2 != null) {
u0.y(((Boolean) obj2).booleanValue());
}
}
} else if (!this.k.y().s(this.k.j()) && zznVar.f2987y && (!hb.b() || !this.k.a().v(zznVar.j, p.G0))) {
String string = Settings.Secure.getString(this.k.j().getContentResolver(), "android_id");
if (string == null) {
this.k.g().A().b("null secure ID. appId", q3.s(u0.k0()));
string = "null";
} else if (string.isEmpty()) {
this.k.g().A().b("empty secure ID. appId", q3.s(u0.k0()));
}
u0.o0(string);
}
}
this.k.y().o();
u0.J(Build.MODEL);
this.k.y().o();
u0.E(Build.VERSION.RELEASE);
u0.V((int) this.k.y().t());
u0.N(this.k.y().u());
if (!this.k.a().o(p.y0)) {
u0.i0(zznVar.u);
}
if (this.k.d()) {
if (!t8.b() || !this.k.a().o(p.J0)) {
u0.k0();
} else {
u0.k0();
}
if (!TextUtils.isEmpty(null)) {
u0.q0();
throw null;
}
}
a4 T2 = K().T(zznVar.j);
if (T2 == null) {
T2 = new a4(this.k, zznVar.j);
if (!t8.b() || !this.k.a().o(p.J0)) {
T2.c(W());
} else {
T2.c(c(h));
}
T2.A(zznVar.t);
T2.m(zznVar.k);
if (!t8.b() || !this.k.a().o(p.J0) || h.j()) {
T2.x(this.j.t(zznVar.j));
}
T2.C(0L);
T2.a(0L);
T2.l(0L);
T2.D(zznVar.l);
T2.p(zznVar.f2985s);
T2.G(zznVar.m);
T2.t(zznVar.n);
T2.w(zznVar.o);
T2.e(zznVar.q);
if (!this.k.a().o(p.y0)) {
T2.R(zznVar.u);
}
T2.z(zznVar.C);
K().I(T2);
}
if ((!t8.b() || !this.k.a().o(p.J0) || h.k()) && !TextUtils.isEmpty(T2.s())) {
u0.h0(T2.s());
}
if (!TextUtils.isEmpty(T2.H())) {
u0.n0(T2.H());
}
List<u9> C = K().C(zznVar.j);
for (int i2 = 0; i2 < C.size(); i2++) {
i1.a L = i1.L();
L.r(C.get(i2).c);
L.q(C.get(i2).d);
N().G(L, C.get(i2).e);
u0.u(L);
}
try {
long v = K().v((e1) ((u4) u0.p()));
g K2 = K();
zzap zzapVar = mVar.f;
if (zzapVar != null) {
Iterator<String> it = zzapVar.iterator();
while (true) {
n nVar = (n) it;
if (nVar.hasNext()) {
if ("_r".equals((String) nVar.next())) {
break;
}
} else {
boolean y2 = H().y(mVar.a, mVar.f1546b);
f y3 = K().y(V(), mVar.a, false, false);
if (y2) {
}
}
}
}
boolean z7 = false;
if (K2.L(mVar, v, z7)) {
this.n = 0L;
}
} catch (IOException e) {
this.k.g().z().c("Data loss. Failed to insert raw event metadata. appId", q3.s(u0.k0()), e);
}
K().s();
K().e0();
w();
this.k.g().D().b("Background event processing time, ms", Long.valueOf(((System.nanoTime() - j) + 500000) / 1000000));
return;
}
z3 = true;
if (!z3) {
}
boolean X3 = t9.X(zzaqVar2.j);
boolean equals2 = "_err".equals(zzaqVar2.j);
this.k.t();
f x22 = K().x(V(), str, t9.v(zzaqVar2.k) + 1, true, X3, false, equals2, false);
intValue = x22.f1529b - p.k.a(null).intValue();
if (intValue <= 0) {
}
}
z2 = true;
if (!"_iap".equals(zzaqVar2.j)) {
z3 = false;
if (!z3) {
}
boolean X32 = t9.X(zzaqVar2.j);
boolean equals22 = "_err".equals(zzaqVar2.j);
this.k.t();
f x222 = K().x(V(), str, t9.v(zzaqVar2.k) + 1, true, X32, false, equals22, false);
intValue = x222.f1529b - p.k.a(null).intValue();
if (intValue <= 0) {
}
}
z3 = true;
if (!z3) {
}
boolean X322 = t9.X(zzaqVar2.j);
boolean equals222 = "_err".equals(zzaqVar2.j);
this.k.t();
f x2222 = K().x(V(), str, t9.v(zzaqVar2.k) + 1, true, X322, false, equals222, false);
intValue = x2222.f1529b - p.k.a(null).intValue();
if (intValue <= 0) {
}
} finally {
K().e0();
}
}
}
public final x3 J() {
C(this.c);
return this.c;
}
public final g K() {
C(this.d);
return this.d;
}
public final boolean L(zzn zznVar) {
return (!da.b() || !this.k.h.u(zznVar.j, p.f1558j0)) ? !TextUtils.isEmpty(zznVar.k) || !TextUtils.isEmpty(zznVar.A) : !TextUtils.isEmpty(zznVar.k) || !TextUtils.isEmpty(zznVar.E) || !TextUtils.isEmpty(zznVar.A);
}
public final ba M() {
C(this.g);
return this.g;
}
public final q9 N() {
C(this.h);
return this.h;
}
public final o3 O() {
return this.k.u();
}
public final void P() {
if (!this.l) {
throw new IllegalStateException("UploadController is not initialized");
}
}
/* JADX WARN: Removed duplicated region for block: B:140:0x031d A[Catch: all -> 0x0407, TryCatch #1 {all -> 0x0407, blocks: (B:3:0x000c, B:5:0x0016, B:8:0x0029, B:10:0x002f, B:13:0x0042, B:15:0x004a, B:18:0x0053, B:23:0x005f, B:26:0x0072, B:28:0x007c, B:31:0x0092, B:33:0x00bb, B:35:0x00c1, B:36:0x00c4, B:38:0x00d4, B:39:0x00eb, B:41:0x00fb, B:43:0x0101, B:44:0x010b, B:46:0x0131, B:48:0x0137, B:50:0x0143, B:52:0x014d, B:53:0x0151, B:55:0x0157, B:57:0x016b, B:61:0x0174, B:63:0x017a, B:65:0x018e, B:67:0x0198, B:68:0x019d, B:69:0x01a0, B:71:0x01c5, B:73:0x01cb, B:75:0x01d7, B:79:0x01e4, B:81:0x01ea, B:83:0x01f6, B:88:0x0204, B:90:0x020a, B:92:0x0216, B:99:0x0227, B:101:0x024f, B:102:0x0254, B:104:0x025f, B:105:0x0264, B:107:0x026f, B:108:0x0274, B:110:0x027d, B:112:0x0281, B:113:0x0286, B:114:0x028d, B:116:0x0293, B:119:0x02a1, B:121:0x02a5, B:122:0x02aa, B:124:0x02b5, B:125:0x02ba, B:127:0x02c3, B:129:0x02c7, B:130:0x02cc, B:131:0x02d3, B:133:0x02df, B:135:0x02f7, B:136:0x02fc, B:137:0x0303, B:138:0x030e, B:140:0x031d, B:142:0x032f, B:143:0x0347, B:147:0x0355, B:149:0x035c, B:150:0x036a, B:151:0x0373, B:153:0x0382, B:154:0x038e, B:155:0x03c4, B:156:0x03d6, B:158:0x03f4, B:160:0x03fe), top: B:168:0x000c, inners: #0 }] */
/* JADX WARN: Removed duplicated region for block: B:141:0x032e */
/* JADX WARN: Removed duplicated region for block: B:145:0x0352 */
/* JADX WARN: Removed duplicated region for block: B:146:0x0354 */
/* JADX WARN: Removed duplicated region for block: B:149:0x035c A[Catch: MalformedURLException -> 0x03c4, all -> 0x0407, TryCatch #0 {MalformedURLException -> 0x03c4, blocks: (B:143:0x0347, B:147:0x0355, B:149:0x035c, B:150:0x036a, B:151:0x0373, B:153:0x0382, B:154:0x038e), top: B:166:0x0347, outer: #1 }] */
/* JADX WARN: Removed duplicated region for block: B:150:0x036a A[Catch: MalformedURLException -> 0x03c4, all -> 0x0407, TryCatch #0 {MalformedURLException -> 0x03c4, blocks: (B:143:0x0347, B:147:0x0355, B:149:0x035c, B:150:0x036a, B:151:0x0373, B:153:0x0382, B:154:0x038e), top: B:166:0x0347, outer: #1 }] */
/* JADX WARN: Removed duplicated region for block: B:153:0x0382 A[Catch: MalformedURLException -> 0x03c4, all -> 0x0407, TryCatch #0 {MalformedURLException -> 0x03c4, blocks: (B:143:0x0347, B:147:0x0355, B:149:0x035c, B:150:0x036a, B:151:0x0373, B:153:0x0382, B:154:0x038e), top: B:166:0x0347, outer: #1 }] */
/* JADX WARN: Removed duplicated region for block: B:99:0x0227 A[Catch: all -> 0x0407, TryCatch #1 {all -> 0x0407, blocks: (B:3:0x000c, B:5:0x0016, B:8:0x0029, B:10:0x002f, B:13:0x0042, B:15:0x004a, B:18:0x0053, B:23:0x005f, B:26:0x0072, B:28:0x007c, B:31:0x0092, B:33:0x00bb, B:35:0x00c1, B:36:0x00c4, B:38:0x00d4, B:39:0x00eb, B:41:0x00fb, B:43:0x0101, B:44:0x010b, B:46:0x0131, B:48:0x0137, B:50:0x0143, B:52:0x014d, B:53:0x0151, B:55:0x0157, B:57:0x016b, B:61:0x0174, B:63:0x017a, B:65:0x018e, B:67:0x0198, B:68:0x019d, B:69:0x01a0, B:71:0x01c5, B:73:0x01cb, B:75:0x01d7, B:79:0x01e4, B:81:0x01ea, B:83:0x01f6, B:88:0x0204, B:90:0x020a, B:92:0x0216, B:99:0x0227, B:101:0x024f, B:102:0x0254, B:104:0x025f, B:105:0x0264, B:107:0x026f, B:108:0x0274, B:110:0x027d, B:112:0x0281, B:113:0x0286, B:114:0x028d, B:116:0x0293, B:119:0x02a1, B:121:0x02a5, B:122:0x02aa, B:124:0x02b5, B:125:0x02ba, B:127:0x02c3, B:129:0x02c7, B:130:0x02cc, B:131:0x02d3, B:133:0x02df, B:135:0x02f7, B:136:0x02fc, B:137:0x0303, B:138:0x030e, B:140:0x031d, B:142:0x032f, B:143:0x0347, B:147:0x0355, B:149:0x035c, B:150:0x036a, B:151:0x0373, B:153:0x0382, B:154:0x038e, B:155:0x03c4, B:156:0x03d6, B:158:0x03f4, B:160:0x03fe), top: B:168:0x000c, inners: #0 }] */
@WorkerThread
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public final void Q() {
a4 T;
boolean z2;
boolean z3;
int i;
String a2;
String str;
U();
P();
this.t = true;
try {
Boolean bool = this.k.x().e;
if (bool == null) {
this.k.g().i.a("Upload data called on the client side before use of service was decided");
} else if (bool.booleanValue()) {
this.k.g().f.a("Upload called in the client side when service should be used");
} else if (this.n > 0) {
w();
} else {
U();
if (this.w != null) {
this.k.g().n.a("Uploading requested multiple times");
} else if (!J().u()) {
this.k.g().n.a("Network not connected, ignoring upload request");
w();
} else {
Objects.requireNonNull((c) this.k.o);
long currentTimeMillis = System.currentTimeMillis();
int q = this.k.h.q(null, p.Q);
long longValue = currentTimeMillis - p.d.a(null).longValue();
for (int i2 = 0; i2 < q && t(longValue); i2++) {
}
long a3 = this.k.o().f.a();
if (a3 != 0) {
this.k.g().m.b("Uploading events. Elapsed time since last upload attempt (ms)", Long.valueOf(Math.abs(currentTimeMillis - a3)));
}
String u = K().u();
if (!TextUtils.isEmpty(u)) {
if (this.f1542y == -1) {
this.f1542y = K().j0();
}
List<Pair<e1, Long>> D = K().D(u, this.k.h.q(u, p.g), Math.max(0, this.k.h.q(u, p.h)));
if (!D.isEmpty()) {
if (!t8.b() || !this.k.h.o(p.J0) || a(u).j()) {
Iterator<Pair<e1, Long>> it = D.iterator();
while (true) {
if (!it.hasNext()) {
str = null;
break;
}
e1 e1Var = (e1) it.next().first;
if (!TextUtils.isEmpty(e1Var.J())) {
str = e1Var.J();
break;
}
}
if (str != null) {
int i3 = 0;
while (true) {
if (i3 >= D.size()) {
break;
}
e1 e1Var2 = (e1) D.get(i3).first;
if (!(TextUtils.isEmpty(e1Var2.J()) || e1Var2.J().equals(str))) {
D = D.subList(0, i3);
break;
}
i3++;
}
}
}
d1.a x2 = d1.x();
int size = D.size();
ArrayList arrayList = new ArrayList(D.size());
boolean z4 = "1".equals(this.k.h.c.h(u, "gaia_collection_enabled")) && (!t8.b() || !this.k.h.o(p.J0) || a(u).j());
try {
if (t8.b() && this.k.h.o(p.J0) && !a(u).j()) {
z2 = false;
if (t8.b() && this.k.h.o(p.J0) && !a(u).k()) {
z3 = false;
i = 0;
while (i < size) {
e1.a t = ((e1) D.get(i).first).t();
arrayList.add((Long) D.get(i).second);
if (t.l) {
t.n();
t.l = false;
}
e1.W0((e1) t.k, 33025L);
if (t.l) {
t.n();
t.l = false;
}
e1.y((e1) t.k, currentTimeMillis);
if (t.l) {
t.n();
t.l = false;
}
e1.m0((e1) t.k, false);
if (!z4) {
if (t.l) {
t.n();
t.l = false;
}
e1.i1((e1) t.k);
}
if (t8.b() && this.k.h.o(p.J0)) {
if (!z2) {
if (t.l) {
t.n();
t.l = false;
}
e1.F0((e1) t.k);
if (t.l) {
t.n();
t.l = false;
}
e1.L0((e1) t.k);
}
if (!z3) {
if (t.l) {
t.n();
t.l = false;
}
e1.Q0((e1) t.k);
}
}
if (this.k.h.u(u, p.X)) {
long t2 = N().t(((e1) ((u4) t.p())).d());
if (t.l) {
t.n();
t.l = false;
}
e1.p1((e1) t.k, t2);
}
x2.q(t);
i++;
arrayList = arrayList;
}
String z5 = !this.k.g().x(2) ? N().z((d1) ((u4) x2.p())) : null;
N();
byte[] d = ((d1) ((u4) x2.p())).d();
a2 = p.q.a(null);
URL url = new URL(a2);
d.l(arrayList.isEmpty());
if (this.w == null) {
this.k.g().f.a("Set uploading progress before finishing the previous upload");
} else {
this.w = new ArrayList(arrayList);
}
this.k.o().g.b(currentTimeMillis);
String str2 = "?";
if (size > 0) {
str2 = ((d1) x2.k).u().G1();
}
this.k.g().n.d("Uploading data. app, uncompressed size, data", str2, Integer.valueOf(d.length), z5);
this.f1540s = true;
x3 J = J();
m9 m9Var = new m9(this, u);
J.b();
J.n();
J.f().x(new c4(J, u, url, d, null, m9Var));
}
z3 = true;
i = 0;
while (i < size) {
}
if (!this.k.g().x(2)) {
}
N();
byte[] d2 = ((d1) ((u4) x2.p())).d();
a2 = p.q.a(null);
URL url2 = new URL(a2);
d.l(arrayList.isEmpty());
if (this.w == null) {
}
this.k.o().g.b(currentTimeMillis);
String str22 = "?";
if (size > 0) {
}
this.k.g().n.d("Uploading data. app, uncompressed size, data", str22, Integer.valueOf(d2.length), z5);
this.f1540s = true;
x3 J2 = J();
m9 m9Var2 = new m9(this, u);
J2.b();
J2.n();
J2.f().x(new c4(J2, u, url2, d2, null, m9Var2));
}
if (t8.b()) {
z3 = false;
i = 0;
while (i < size) {
}
if (!this.k.g().x(2)) {
}
N();
byte[] d22 = ((d1) ((u4) x2.p())).d();
a2 = p.q.a(null);
URL url22 = new URL(a2);
d.l(arrayList.isEmpty());
if (this.w == null) {
}
this.k.o().g.b(currentTimeMillis);
String str222 = "?";
if (size > 0) {
}
this.k.g().n.d("Uploading data. app, uncompressed size, data", str222, Integer.valueOf(d22.length), z5);
this.f1540s = true;
x3 J22 = J();
m9 m9Var22 = new m9(this, u);
J22.b();
J22.n();
J22.f().x(new c4(J22, u, url22, d22, null, m9Var22));
}
URL url222 = new URL(a2);
d.l(arrayList.isEmpty());
if (this.w == null) {
}
this.k.o().g.b(currentTimeMillis);
String str2222 = "?";
if (size > 0) {
}
this.k.g().n.d("Uploading data. app, uncompressed size, data", str2222, Integer.valueOf(d22.length), z5);
this.f1540s = true;
x3 J222 = J();
m9 m9Var222 = new m9(this, u);
J222.b();
J222.n();
J222.f().x(new c4(J222, u, url222, d22, null, m9Var222));
} catch (MalformedURLException unused) {
this.k.g().f.c("Failed to parse upload URL. Not uploading. appId", q3.s(u), a2);
}
z2 = true;
z3 = true;
i = 0;
while (i < size) {
}
if (!this.k.g().x(2)) {
}
N();
byte[] d222 = ((d1) ((u4) x2.p())).d();
a2 = p.q.a(null);
}
} else {
this.f1542y = -1L;
String B = K().B(currentTimeMillis - p.d.a(null).longValue());
if (!TextUtils.isEmpty(B) && (T = K().T(B)) != null) {
n(T);
}
}
}
}
} finally {
this.t = false;
x();
}
}
/* JADX WARN: Removed duplicated region for block: B:25:0x00a3 */
/* JADX WARN: Removed duplicated region for block: B:42:0x010b */
/* JADX WARN: Removed duplicated region for block: B:43:0x0122 */
/* JADX WARN: Removed duplicated region for block: B:57:0x018b */
/* JADX WARN: Removed duplicated region for block: B:58:0x01a1 */
/* JADX WARN: Removed duplicated region for block: B:65:? A[RETURN, SYNTHETIC] */
@WorkerThread
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public final void R() {
boolean z2;
int i;
int i2;
int read;
FileLock tryLock;
FileLock fileLock;
U();
P();
if (!this.m) {
boolean z3 = true;
this.m = true;
U();
if (!this.k.h.o(p.f1557i0) || (fileLock = this.u) == null || !fileLock.isValid()) {
try {
FileChannel channel = new RandomAccessFile(new File(this.k.f1567b.getFilesDir(), "google_app_measurement.db"), "rw").getChannel();
this.v = channel;
tryLock = channel.tryLock();
this.u = tryLock;
} catch (FileNotFoundException e) {
this.k.g().f.b("Failed to acquire storage lock", e);
} catch (IOException e2) {
this.k.g().f.b("Failed to access storage lock file", e2);
} catch (OverlappingFileLockException e3) {
this.k.g().i.b("Storage lock already acquired", e3);
}
if (tryLock != null) {
this.k.g().n.a("Storage concurrent access okay");
} else {
this.k.g().f.a("Storage concurrent data access panic");
z2 = false;
if (!z2) {
FileChannel fileChannel = this.v;
U();
if (fileChannel == null || !fileChannel.isOpen()) {
this.k.g().f.a("Bad channel to read from");
} else {
ByteBuffer allocate = ByteBuffer.allocate(4);
try {
fileChannel.position(0L);
read = fileChannel.read(allocate);
} catch (IOException e4) {
this.k.g().f.b("Failed to read from channel", e4);
}
if (read == 4) {
allocate.flip();
i = allocate.getInt();
n3 z4 = this.k.z();
z4.t();
i2 = z4.e;
U();
if (i <= i2) {
this.k.g().f.c("Panic: can't downgrade version. Previous, current version", Integer.valueOf(i), Integer.valueOf(i2));
return;
} else if (i < i2) {
FileChannel fileChannel2 = this.v;
U();
if (fileChannel2 == null || !fileChannel2.isOpen()) {
this.k.g().f.a("Bad channel to read from");
} else {
ByteBuffer allocate2 = ByteBuffer.allocate(4);
allocate2.putInt(i2);
allocate2.flip();
try {
fileChannel2.truncate(0L);
this.k.h.o(p.s0);
fileChannel2.write(allocate2);
fileChannel2.force(true);
if (fileChannel2.size() != 4) {
this.k.g().f.b("Error writing to channel. Bytes written", Long.valueOf(fileChannel2.size()));
}
} catch (IOException e5) {
this.k.g().f.b("Failed to write to channel", e5);
}
if (!z3) {
this.k.g().n.c("Storage version upgraded. Previous, current version", Integer.valueOf(i), Integer.valueOf(i2));
return;
} else {
this.k.g().f.c("Storage version upgrade failed. Previous, current version", Integer.valueOf(i), Integer.valueOf(i2));
return;
}
}
z3 = false;
if (!z3) {
}
} else {
return;
}
} else if (read != -1) {
this.k.g().i.b("Unexpected data length. Bytes read", Integer.valueOf(read));
}
}
i = 0;
n3 z42 = this.k.z();
z42.t();
i2 = z42.e;
U();
if (i <= i2) {
}
} else {
return;
}
}
} else {
this.k.g().n.a("Storage concurrent access okay");
}
z2 = true;
if (!z2) {
}
}
}
public final b4 S() {
b4 b4Var = this.e;
if (b4Var != null) {
return b4Var;
}
throw new IllegalStateException("Network broadcast receiver not created");
}
public final h9 T() {
C(this.f);
return this.f;
}
@WorkerThread
public final void U() {
this.k.f().b();
}
public final long V() {
Objects.requireNonNull((c) this.k.o);
long currentTimeMillis = System.currentTimeMillis();
d4 o = this.k.o();
o.o();
o.b();
long a2 = o.j.a();
if (a2 == 0) {
a2 = 1 + o.e().v0().nextInt(86400000);
o.j.b(a2);
}
return ((((currentTimeMillis + a2) / 1000) / 60) / 60) / 24;
}
@WorkerThread
@Deprecated
public final String W() {
byte[] bArr = new byte[16];
this.k.t().v0().nextBytes(bArr);
return String.format(Locale.US, "%032x", new BigInteger(1, bArr));
}
@WorkerThread
public final d a(String str) {
String str2;
d dVar = d.a;
if (!t8.b() || !this.k.h.o(p.J0)) {
return dVar;
}
U();
P();
d dVar2 = this.f1543z.get(str);
if (dVar2 != null) {
return dVar2;
}
g K = K();
Objects.requireNonNull(K);
Objects.requireNonNull(str, "null reference");
K.b();
K.n();
Cursor cursor = null;
try {
try {
cursor = K.t().rawQuery("select consent_state from consent_settings where app_id=? limit 1;", new String[]{str});
if (cursor.moveToFirst()) {
str2 = cursor.getString(0);
cursor.close();
} else {
cursor.close();
str2 = "G1";
}
d b2 = d.b(str2);
s(str, b2);
return b2;
} catch (SQLiteException e) {
K.g().f.c("Database error", "select consent_state from consent_settings where app_id=? limit 1;", e);
throw e;
}
} catch (Throwable th) {
if (cursor != null) {
cursor.close();
}
throw th;
}
}
@WorkerThread
public final String c(d dVar) {
if (!t8.b() || !this.k.h.o(p.J0) || dVar.k()) {
return W();
}
return null;
}
@Override // b.i.a.f.i.b.t5
public final r4 f() {
return this.k.f();
}
@Override // b.i.a.f.i.b.t5
public final q3 g() {
return this.k.g();
}
public final void h(e1.a aVar, long j, boolean z2) {
u9 u9Var;
boolean z3;
String str = z2 ? "_se" : "_lte";
u9 Y = K().Y(aVar.k0(), str);
if (Y == null || Y.e == null) {
String k0 = aVar.k0();
Objects.requireNonNull((c) this.k.o);
u9Var = new u9(k0, "auto", str, System.currentTimeMillis(), Long.valueOf(j));
} else {
String k02 = aVar.k0();
Objects.requireNonNull((c) this.k.o);
u9Var = new u9(k02, "auto", str, System.currentTimeMillis(), Long.valueOf(((Long) Y.e).longValue() + j));
}
i1.a L = i1.L();
L.r(str);
Objects.requireNonNull((c) this.k.o);
L.q(System.currentTimeMillis());
L.s(((Long) u9Var.e).longValue());
i1 i1Var = (i1) ((u4) L.p());
int s2 = q9.s(aVar, str);
if (s2 >= 0) {
if (aVar.l) {
aVar.n();
aVar.l = false;
}
e1.x((e1) aVar.k, s2, i1Var);
z3 = true;
} else {
z3 = false;
}
if (!z3) {
if (aVar.l) {
aVar.n();
aVar.l = false;
}
e1.A((e1) aVar.k, i1Var);
}
if (j > 0) {
K().M(u9Var);
this.k.g().n.c("Updated engagement user property. scope, value", z2 ? "session-scoped" : "lifetime", u9Var.e);
}
}
@Override // b.i.a.f.i.b.t5
public final b.i.a.f.e.o.b i() {
return this.k.o;
}
@Override // b.i.a.f.i.b.t5
public final Context j() {
return this.k.f1567b;
}
@Override // b.i.a.f.i.b.t5
public final ga k() {
return this.k.g;
}
@WorkerThread
public final void l(zzaq zzaqVar, zzn zznVar) {
List<zzz> list;
List<zzz> list2;
List<zzz> list3;
zzaq zzaqVar2 = zzaqVar;
Objects.requireNonNull(zznVar, "null reference");
d.w(zznVar.j);
U();
P();
String str = zznVar.j;
long j = zzaqVar2.m;
N();
if (q9.O(zzaqVar, zznVar)) {
if (!zznVar.q) {
G(zznVar);
return;
}
List<String> list4 = zznVar.D;
if (list4 != null) {
if (list4.contains(zzaqVar2.j)) {
Bundle x0 = zzaqVar2.k.x0();
x0.putLong("ga_safelisted", 1L);
zzaqVar2 = new zzaq(zzaqVar2.j, new zzap(x0), zzaqVar2.l, zzaqVar2.m);
} else {
this.k.g().m.d("Dropping non-safelisted event. appId, event name, origin", str, zzaqVar2.j, zzaqVar2.l);
return;
}
}
K().b0();
try {
g K = K();
d.w(str);
K.b();
K.n();
int i = (j > 0L ? 1 : (j == 0L ? 0 : -1));
if (i < 0) {
K.g().i.c("Invalid time querying timed out conditional properties", q3.s(str), Long.valueOf(j));
list = Collections.emptyList();
} else {
list = K.F("active=0 and app_id=? and abs(? - creation_timestamp) > trigger_timeout", new String[]{str, String.valueOf(j)});
}
for (zzz zzzVar : list) {
if (zzzVar != null) {
this.k.g().n.d("User property timed out", zzzVar.j, this.k.u().y(zzzVar.l.k), zzzVar.l.w0());
zzaq zzaqVar3 = zzzVar.p;
if (zzaqVar3 != null) {
I(new zzaq(zzaqVar3, j), zznVar);
}
K().a0(str, zzzVar.l.k);
}
}
g K2 = K();
d.w(str);
K2.b();
K2.n();
if (i < 0) {
K2.g().i.c("Invalid time querying expired conditional properties", q3.s(str), Long.valueOf(j));
list2 = Collections.emptyList();
} else {
list2 = K2.F("active<>0 and app_id=? and abs(? - triggered_timestamp) > time_to_live", new String[]{str, String.valueOf(j)});
}
ArrayList arrayList = new ArrayList(list2.size());
for (zzz zzzVar2 : list2) {
if (zzzVar2 != null) {
this.k.g().n.d("User property expired", zzzVar2.j, this.k.u().y(zzzVar2.l.k), zzzVar2.l.w0());
K().V(str, zzzVar2.l.k);
zzaq zzaqVar4 = zzzVar2.t;
if (zzaqVar4 != null) {
arrayList.add(zzaqVar4);
}
K().a0(str, zzzVar2.l.k);
}
}
int size = arrayList.size();
int i2 = 0;
while (i2 < size) {
Object obj = arrayList.get(i2);
i2++;
I(new zzaq((zzaq) obj, j), zznVar);
}
g K3 = K();
String str2 = zzaqVar2.j;
d.w(str);
d.w(str2);
K3.b();
K3.n();
if (i < 0) {
K3.g().i.d("Invalid time querying triggered conditional properties", q3.s(str), K3.d().u(str2), Long.valueOf(j));
list3 = Collections.emptyList();
} else {
list3 = K3.F("active=0 and app_id=? and trigger_event_name=? and abs(? - creation_timestamp) <= trigger_timeout", new String[]{str, str2, String.valueOf(j)});
}
ArrayList arrayList2 = new ArrayList(list3.size());
for (zzz zzzVar3 : list3) {
if (zzzVar3 != null) {
zzku zzkuVar = zzzVar3.l;
u9 u9Var = new u9(zzzVar3.j, zzzVar3.k, zzkuVar.k, j, zzkuVar.w0());
if (K().M(u9Var)) {
this.k.g().n.d("User property triggered", zzzVar3.j, this.k.u().y(u9Var.c), u9Var.e);
} else {
this.k.g().f.d("Too many active user properties, ignoring", q3.s(zzzVar3.j), this.k.u().y(u9Var.c), u9Var.e);
}
zzaq zzaqVar5 = zzzVar3.r;
if (zzaqVar5 != null) {
arrayList2.add(zzaqVar5);
}
zzzVar3.l = new zzku(u9Var);
zzzVar3.n = true;
K().N(zzzVar3);
}
}
I(zzaqVar2, zznVar);
int size2 = arrayList2.size();
int i3 = 0;
while (i3 < size2) {
Object obj2 = arrayList2.get(i3);
i3++;
I(new zzaq((zzaq) obj2, j), zznVar);
}
K().s();
} finally {
K().e0();
}
}
}
@WorkerThread
public final void m(zzaq zzaqVar, String str) {
boolean z2;
String str2;
a4 T = K().T(str);
if (T == null || TextUtils.isEmpty(T.M())) {
this.k.g().m.b("No app data available; dropping event", str);
return;
}
Boolean z3 = z(T);
if (z3 == null) {
if (!"_ui".equals(zzaqVar.j)) {
this.k.g().i.b("Could not find package. appId", q3.s(str));
}
} else if (!z3.booleanValue()) {
this.k.g().f.b("App version does not match; dropping event. appId", q3.s(str));
return;
}
String v = T.v();
String M = T.M();
long N = T.N();
String O = T.O();
long P = T.P();
long Q = T.Q();
boolean T2 = T.T();
String H = T.H();
long g = T.g();
boolean h = T.h();
boolean i = T.i();
String y2 = T.y();
Boolean j = T.j();
long S = T.S();
List<String> k = T.k();
if (da.b()) {
z2 = T2;
if (this.k.h.u(T.o(), p.f1558j0)) {
str2 = T.B();
B(zzaqVar, new zzn(str, v, M, N, O, P, Q, (String) null, z2, false, H, g, 0L, 0, h, i, false, y2, j, S, k, str2, (t8.b() || !this.k.h.o(p.J0)) ? "" : a(str).d()));
}
} else {
z2 = T2;
}
str2 = null;
B(zzaqVar, new zzn(str, v, M, N, O, P, Q, (String) null, z2, false, H, g, 0L, 0, h, i, false, y2, j, S, k, str2, (t8.b() || !this.k.h.o(p.J0)) ? "" : a(str).d()));
}
/* JADX WARN: Code restructure failed: missing block: B:27:0x009b, code lost:
if (android.text.TextUtils.isEmpty(r2) != false) goto L_0x009d;
*/
@WorkerThread
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public final void n(a4 a4Var) {
U();
if (!da.b() || !this.k.h.u(a4Var.o(), p.f1558j0)) {
if (TextUtils.isEmpty(a4Var.v()) && TextUtils.isEmpty(a4Var.y())) {
r(a4Var.o(), 204, null, null, null);
return;
}
} else if (TextUtils.isEmpty(a4Var.v()) && TextUtils.isEmpty(a4Var.B()) && TextUtils.isEmpty(a4Var.y())) {
r(a4Var.o(), 204, null, null, null);
return;
}
c cVar = this.k.h;
Objects.requireNonNull(cVar);
Uri.Builder builder = new Uri.Builder();
String v = a4Var.v();
if (TextUtils.isEmpty(v)) {
if (da.b() && cVar.a.h.u(a4Var.o(), p.f1558j0)) {
v = a4Var.B();
}
v = a4Var.y();
}
ArrayMap arrayMap = null;
Uri.Builder encodedAuthority = builder.scheme(p.e.a(null)).encodedAuthority(p.f.a(null));
String valueOf = String.valueOf(v);
encodedAuthority.path(valueOf.length() != 0 ? "config/app/".concat(valueOf) : new String("config/app/")).appendQueryParameter("app_instance_id", a4Var.s()).appendQueryParameter("platform", "android").appendQueryParameter("gmp_version", "33025");
String uri = builder.build().toString();
try {
URL url = new URL(uri);
this.k.g().n.b("Fetching remote configuration", a4Var.o());
u0 s2 = H().s(a4Var.o());
p4 H = H();
String o = a4Var.o();
H.b();
String str = H.i.get(o);
if (s2 != null && !TextUtils.isEmpty(str)) {
arrayMap = new ArrayMap();
arrayMap.put("If-Modified-Since", str);
}
this.r = true;
x3 J = J();
String o2 = a4Var.o();
l9 l9Var = new l9(this);
J.b();
J.n();
J.f().x(new c4(J, o2, url, null, arrayMap, l9Var));
} catch (MalformedURLException unused) {
this.k.g().f.c("Failed to parse config URL. Not fetching. appId", q3.s(a4Var.o()), uri);
}
}
@WorkerThread
public final void o(zzku zzkuVar, zzn zznVar) {
U();
P();
if (L(zznVar)) {
if (!zznVar.q) {
G(zznVar);
return;
}
int h02 = this.k.t().h0(zzkuVar.k);
if (h02 != 0) {
this.k.t();
String E = t9.E(zzkuVar.k, 24, true);
String str = zzkuVar.k;
this.k.t().S(this.A, zznVar.j, h02, "_ev", E, str != null ? str.length() : 0);
return;
}
int i02 = this.k.t().i0(zzkuVar.k, zzkuVar.w0());
if (i02 != 0) {
this.k.t();
String E2 = t9.E(zzkuVar.k, 24, true);
Object w0 = zzkuVar.w0();
this.k.t().S(this.A, zznVar.j, i02, "_ev", E2, (w0 == null || (!(w0 instanceof String) && !(w0 instanceof CharSequence))) ? 0 : String.valueOf(w0).length());
return;
}
Object n0 = this.k.t().n0(zzkuVar.k, zzkuVar.w0());
if (n0 != null) {
if ("_sid".equals(zzkuVar.k)) {
long j = zzkuVar.l;
String str2 = zzkuVar.o;
long j2 = 0;
u9 Y = K().Y(zznVar.j, "_sno");
if (Y != null) {
Object obj = Y.e;
if (obj instanceof Long) {
j2 = ((Long) obj).longValue();
o(new zzku("_sno", j, Long.valueOf(j2 + 1), str2), zznVar);
}
}
if (Y != null) {
this.k.g().i.b("Retrieved last session number from database does not contain a valid (long) value", Y.e);
}
l z2 = K().z(zznVar.j, "_s");
if (z2 != null) {
j2 = z2.c;
this.k.g().n.b("Backfill the session number. Last used session number", Long.valueOf(j2));
}
o(new zzku("_sno", j, Long.valueOf(j2 + 1), str2), zznVar);
}
u9 u9Var = new u9(zznVar.j, zzkuVar.o, zzkuVar.k, zzkuVar.l, n0);
this.k.g().n.c("Setting user property", this.k.u().y(u9Var.c), n0);
K().b0();
try {
G(zznVar);
boolean M = K().M(u9Var);
K().s();
if (!M) {
this.k.g().f.c("Too many unique user properties are set. Ignoring user property", this.k.u().y(u9Var.c), u9Var.e);
this.k.t().S(this.A, zznVar.j, 9, null, null, 0);
}
} finally {
K().e0();
}
}
}
}
@WorkerThread
public final void p(zzn zznVar) {
if (this.w != null) {
ArrayList arrayList = new ArrayList();
this.f1541x = arrayList;
arrayList.addAll(this.w);
}
g K = K();
String str = zznVar.j;
d.w(str);
K.b();
K.n();
try {
SQLiteDatabase t = K.t();
String[] strArr = {str};
int delete = t.delete("apps", "app_id=?", strArr) + 0 + t.delete("events", "app_id=?", strArr) + t.delete("user_attributes", "app_id=?", strArr) + t.delete("conditional_properties", "app_id=?", strArr) + t.delete("raw_events", "app_id=?", strArr) + t.delete("raw_events_metadata", "app_id=?", strArr) + t.delete("queue", "app_id=?", strArr) + t.delete("audience_filter_values", "app_id=?", strArr) + t.delete("main_event_params", "app_id=?", strArr) + t.delete("default_event_params", "app_id=?", strArr);
if (delete > 0) {
K.g().n.c("Reset analytics data. app, records", str, Integer.valueOf(delete));
}
} catch (SQLiteException e) {
K.g().f.c("Error resetting analytics data. appId, error", q3.s(str), e);
}
if (zznVar.q) {
E(zznVar);
}
}
@WorkerThread
public final void q(zzz zzzVar, zzn zznVar) {
zzaq zzaqVar;
boolean z2;
Objects.requireNonNull(zzzVar, "null reference");
d.w(zzzVar.j);
Objects.requireNonNull(zzzVar.k, "null reference");
Objects.requireNonNull(zzzVar.l, "null reference");
d.w(zzzVar.l.k);
U();
P();
if (L(zznVar)) {
if (!zznVar.q) {
G(zznVar);
return;
}
zzz zzzVar2 = new zzz(zzzVar);
boolean z3 = false;
zzzVar2.n = false;
K().b0();
try {
zzz Z = K().Z(zzzVar2.j, zzzVar2.l.k);
if (Z != null && !Z.k.equals(zzzVar2.k)) {
this.k.g().i.d("Updating a conditional user property with different origin. name, origin, origin (from DB)", this.k.u().y(zzzVar2.l.k), zzzVar2.k, Z.k);
}
if (Z != null && (z2 = Z.n)) {
zzzVar2.k = Z.k;
zzzVar2.m = Z.m;
zzzVar2.q = Z.q;
zzzVar2.o = Z.o;
zzzVar2.r = Z.r;
zzzVar2.n = z2;
zzku zzkuVar = zzzVar2.l;
zzzVar2.l = new zzku(zzkuVar.k, Z.l.l, zzkuVar.w0(), Z.l.o);
} else if (TextUtils.isEmpty(zzzVar2.o)) {
zzku zzkuVar2 = zzzVar2.l;
zzzVar2.l = new zzku(zzkuVar2.k, zzzVar2.m, zzkuVar2.w0(), zzzVar2.l.o);
zzzVar2.n = true;
z3 = true;
}
if (zzzVar2.n) {
zzku zzkuVar3 = zzzVar2.l;
u9 u9Var = new u9(zzzVar2.j, zzzVar2.k, zzkuVar3.k, zzkuVar3.l, zzkuVar3.w0());
if (K().M(u9Var)) {
this.k.g().m.d("User property updated immediately", zzzVar2.j, this.k.u().y(u9Var.c), u9Var.e);
} else {
this.k.g().f.d("(2)Too many active user properties, ignoring", q3.s(zzzVar2.j), this.k.u().y(u9Var.c), u9Var.e);
}
if (z3 && (zzaqVar = zzzVar2.r) != null) {
I(new zzaq(zzaqVar, zzzVar2.m), zznVar);
}
}
if (K().N(zzzVar2)) {
this.k.g().m.d("Conditional property added", zzzVar2.j, this.k.u().y(zzzVar2.l.k), zzzVar2.l.w0());
} else {
this.k.g().f.d("Too many conditional properties, ignoring", q3.s(zzzVar2.j), this.k.u().y(zzzVar2.l.k), zzzVar2.l.w0());
}
K().s();
} finally {
K().e0();
}
}
}
/* JADX WARN: Code restructure failed: missing block: B:27:0x00b6, code lost:
r8 = r7.k.o().h;
java.util.Objects.requireNonNull((b.i.a.f.e.o.c) r7.k.o);
r8.b(java.lang.System.currentTimeMillis());
*/
/* JADX WARN: Code restructure failed: missing block: B:30:0x00d5, code lost:
r10 = r12.get("Last-Modified");
*/
/* JADX WARN: Removed duplicated region for block: B:46:0x0126 A[Catch: all -> 0x0175, TryCatch #1 {all -> 0x017e, blocks: (B:4:0x000c, B:5:0x000e, B:55:0x0168, B:6:0x0027, B:15:0x0043, B:20:0x005e, B:27:0x00b6, B:28:0x00ce, B:30:0x00d5, B:33:0x00e1, B:35:0x00e7, B:40:0x00f4, B:41:0x00fc, B:43:0x0106, B:44:0x010d, B:46:0x0126, B:47:0x0134, B:48:0x014a, B:50:0x0154, B:52:0x015a, B:53:0x015e, B:54:0x0161), top: B:61:0x000c }] */
/* JADX WARN: Removed duplicated region for block: B:47:0x0134 A[Catch: all -> 0x0175, TryCatch #1 {all -> 0x017e, blocks: (B:4:0x000c, B:5:0x000e, B:55:0x0168, B:6:0x0027, B:15:0x0043, B:20:0x005e, B:27:0x00b6, B:28:0x00ce, B:30:0x00d5, B:33:0x00e1, B:35:0x00e7, B:40:0x00f4, B:41:0x00fc, B:43:0x0106, B:44:0x010d, B:46:0x0126, B:47:0x0134, B:48:0x014a, B:50:0x0154, B:52:0x015a, B:53:0x015e, B:54:0x0161), top: B:61:0x000c }] */
@WorkerThread
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public final void r(String str, int i, Throwable th, byte[] bArr, Map<String, List<String>> map) {
U();
P();
d.w(str);
if (bArr == null) {
try {
bArr = new byte[0];
} finally {
this.r = false;
x();
}
}
this.k.g().n.b("onConfigFetched. Response size", Integer.valueOf(bArr.length));
K().b0();
a4 T = K().T(str);
boolean z2 = true;
boolean z3 = (i == 200 || i == 204 || i == 304) && th == null;
if (T == null) {
this.k.g().i.b("App does not exist in onConfigFetched. appId", q3.s(str));
} else {
if (!z3 && i != 404) {
Objects.requireNonNull((c) this.k.o);
T.I(System.currentTimeMillis());
K().I(T);
this.k.g().n.c("Fetching config failed. code, error", Integer.valueOf(i), th);
p4 H = H();
H.b();
H.i.put(str, null);
h4 h4Var = this.k.o().g;
Objects.requireNonNull((c) this.k.o);
h4Var.b(System.currentTimeMillis());
if (!(i == 503 || i == 429)) {
z2 = false;
}
w();
}
List<String> list = null;
String str2 = (list == null || list.size() <= 0) ? null : list.get(0);
if (!(i == 404 || i == 304)) {
H().w(str, bArr, str2);
Objects.requireNonNull((c) this.k.o);
T.F(System.currentTimeMillis());
K().I(T);
if (i != 404) {
this.k.g().k.b("Config not found. Using empty config. appId", str);
} else {
this.k.g().n.c("Successfully fetched config. Got network response. code, size", Integer.valueOf(i), Integer.valueOf(bArr.length));
}
if (J().u() || !v()) {
w();
} else {
Q();
}
}
if (H().s(str) == null) {
H().w(str, null, null);
}
Objects.requireNonNull((c) this.k.o);
T.F(System.currentTimeMillis());
K().I(T);
if (i != 404) {
}
if (J().u()) {
}
w();
}
K().s();
K().e0();
}
@WorkerThread
public final void s(String str, d dVar) {
if (t8.b() && this.k.h.o(p.J0)) {
U();
P();
this.f1543z.put(str, dVar);
g K = K();
if (t8.b() && K.a.h.o(p.J0)) {
Objects.requireNonNull(str, "null reference");
K.b();
K.n();
ContentValues contentValues = new ContentValues();
contentValues.put("app_id", str);
contentValues.put("consent_state", dVar.d());
try {
if (K.t().insertWithOnConflict("consent_settings", null, contentValues, 5) == -1) {
K.g().f.b("Failed to insert/update consent setting (got -1). appId", q3.s(str));
}
} catch (SQLiteException e) {
K.g().f.c("Error storing consent setting. appId, error", q3.s(str), e);
}
}
}
}
/* JADX ERROR: JadxRuntimeException in pass: BlockProcessor
jadx.core.utils.exceptions.JadxRuntimeException: Unreachable block: B:72:0x018e
at jadx.core.dex.visitors.blocks.BlockProcessor.checkForUnreachableBlocks(BlockProcessor.java:90)
at jadx.core.dex.visitors.blocks.BlockProcessor.processBlocksTree(BlockProcessor.java:52)
at jadx.core.dex.visitors.blocks.BlockProcessor.visit(BlockProcessor.java:44)
*/
@androidx.annotation.WorkerThread
public final boolean t(long r44) {
/*
Method dump skipped, instructions count: 4262
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: b.i.a.f.i.b.k9.t(long):boolean");
}
public final boolean u(a1.a aVar, a1.a aVar2) {
d.l("_e".equals(aVar.y()));
N();
c1 w = q9.w((a1) ((u4) aVar.p()), "_sc");
String str = null;
String G = w == null ? null : w.G();
N();
c1 w2 = q9.w((a1) ((u4) aVar2.p()), "_pc");
if (w2 != null) {
str = w2.G();
}
if (str == null || !str.equals(G)) {
return false;
}
A(aVar, aVar2);
return true;
}
public final boolean v() {
U();
P();
return ((K().S("select count(1) > 0 from raw_events", null) > 0L ? 1 : (K().S("select count(1) > 0 from raw_events", null) == 0L ? 0 : -1)) != 0) || !TextUtils.isEmpty(K().u());
}
/* JADX WARN: Removed duplicated region for block: B:102:0x0399 */
/* JADX WARN: Removed duplicated region for block: B:26:0x00a8 */
/* JADX WARN: Removed duplicated region for block: B:32:0x00e4 */
/* JADX WARN: Removed duplicated region for block: B:35:0x012c */
/* JADX WARN: Removed duplicated region for block: B:56:0x01a4 */
/* JADX WARN: Removed duplicated region for block: B:58:0x01c2 */
@WorkerThread
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public final void w() {
boolean z2;
long j;
long max;
long j2;
int i;
Method method;
U();
P();
if (this.n > 0) {
Objects.requireNonNull((c) this.k.o);
long abs = 3600000 - Math.abs(SystemClock.elapsedRealtime() - this.n);
if (abs > 0) {
this.k.g().n.b("Upload has been suspended. Will update scheduling later in approximately ms", Long.valueOf(abs));
S().a();
T().s();
return;
}
this.n = 0L;
}
if (!this.k.m() || !v()) {
this.k.g().n.a("Nothing to upload or uploading impossible");
S().a();
T().s();
return;
}
Objects.requireNonNull((c) this.k.o);
long currentTimeMillis = System.currentTimeMillis();
long max2 = Math.max(0L, p.A.a(null).longValue());
if (!(K().S("select count(1) > 0 from raw_events where realtime = 1", null) != 0)) {
if (!(K().S("select count(1) > 0 from queue where has_realtime = 1", null) != 0)) {
z2 = false;
if (!z2) {
String h = this.k.h.h("debug.firebase.analytics.app", "");
j = (TextUtils.isEmpty(h) || ".none.".equals(h)) ? Math.max(0L, p.u.a(null).longValue()) : Math.max(0L, p.v.a(null).longValue());
} else {
j = Math.max(0L, p.t.a(null).longValue());
}
long a2 = this.k.o().f.a();
long a3 = this.k.o().g.a();
max = Math.max(K().w("select max(bundle_end_timestamp) from queue", null, 0L), K().w("select max(timestamp) from raw_events", null, 0L));
if (max != 0) {
long abs2 = currentTimeMillis - Math.abs(max - currentTimeMillis);
long abs3 = currentTimeMillis - Math.abs(a2 - currentTimeMillis);
long abs4 = currentTimeMillis - Math.abs(a3 - currentTimeMillis);
long max3 = Math.max(abs3, abs4);
j2 = max2 + abs2;
if (z2 && max3 > 0) {
j2 = Math.min(abs2, max3) + j;
}
if (!N().N(max3, j)) {
j2 = max3 + j;
}
if (abs4 != 0 && abs4 >= abs2) {
for (int i2 = 0; i2 < Math.min(20, Math.max(0, p.C.a(null).intValue())); i2++) {
j2 += Math.max(0L, p.B.a(null).longValue()) * (1 << i2);
if (j2 > abs4) {
break;
}
}
}
if (j2 == 0) {
this.k.g().n.a("Next upload time is 0");
S().a();
T().s();
return;
} else if (!J().u()) {
this.k.g().n.a("No network");
b4 S = S();
S.a.P();
S.a.f().b();
if (!S.f1517b) {
S.a.k.f1567b.registerReceiver(S, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
S.c = S.a.J().u();
S.a.g().n.b("Registering connectivity change receiver. Network connected", Boolean.valueOf(S.c));
S.f1517b = true;
}
T().s();
return;
} else {
long a4 = this.k.o().h.a();
long max4 = Math.max(0L, p.r.a(null).longValue());
if (!N().N(a4, max4)) {
j2 = Math.max(j2, a4 + max4);
}
S().a();
Objects.requireNonNull((c) this.k.o);
long currentTimeMillis2 = j2 - System.currentTimeMillis();
if (currentTimeMillis2 <= 0) {
currentTimeMillis2 = Math.max(0L, p.w.a(null).longValue());
h4 h4Var = this.k.o().f;
Objects.requireNonNull((c) this.k.o);
h4Var.b(System.currentTimeMillis());
}
this.k.g().n.b("Upload scheduled in approximately ms", Long.valueOf(currentTimeMillis2));
h9 T = T();
T.n();
Context context = T.a.f1567b;
if (!n4.a(context)) {
T.g().m.a("Receiver not registered/enabled");
}
if (!t9.U(context)) {
T.g().m.a("Service not registered/enabled");
}
T.s();
T.g().n.b("Scheduling upload, millis", Long.valueOf(currentTimeMillis2));
Objects.requireNonNull((c) T.a.o);
long elapsedRealtime = SystemClock.elapsedRealtime() + currentTimeMillis2;
if (currentTimeMillis2 < Math.max(0L, p.f1560x.a(null).longValue())) {
if (!(T.e.d != 0)) {
T.e.b(currentTimeMillis2);
}
}
if (Build.VERSION.SDK_INT >= 24) {
Context context2 = T.a.f1567b;
ComponentName componentName = new ComponentName(context2, "com.google.android.gms.measurement.AppMeasurementJobService");
int t = T.t();
PersistableBundle persistableBundle = new PersistableBundle();
persistableBundle.putString("action", "com.google.android.gms.measurement.UPLOAD");
JobInfo build = new JobInfo.Builder(t, componentName).setMinimumLatency(currentTimeMillis2).setOverrideDeadline(currentTimeMillis2 << 1).setExtras(persistableBundle).build();
Method method2 = a4.a;
JobScheduler jobScheduler = (JobScheduler) context2.getSystemService("jobscheduler");
if (a4.a == null || context2.checkSelfPermission("android.permission.UPDATE_DEVICE_STATS") != 0) {
jobScheduler.schedule(build);
return;
}
Method method3 = a4.f1432b;
if (method3 != null) {
try {
i = ((Integer) method3.invoke(null, new Object[0])).intValue();
} catch (IllegalAccessException | InvocationTargetException e) {
if (Log.isLoggable("JobSchedulerCompat", 6)) {
Log.e("JobSchedulerCompat", "myUserId invocation illegal", e);
}
}
method = a4.a;
if (method != null) {
try {
((Integer) method.invoke(jobScheduler, build, "com.google.android.gms", Integer.valueOf(i), "UploadAlarm")).intValue();
return;
} catch (IllegalAccessException | InvocationTargetException e2) {
Log.e("UploadAlarm", "error calling scheduleAsPackage", e2);
}
}
jobScheduler.schedule(build);
return;
}
i = 0;
method = a4.a;
if (method != null) {
}
jobScheduler.schedule(build);
return;
}
T.d.setInexactRepeating(2, elapsedRealtime, Math.max(p.f1559s.a(null).longValue(), currentTimeMillis2), T.u());
return;
}
}
j2 = 0;
if (j2 == 0) {
}
}
}
z2 = true;
if (!z2) {
}
long a22 = this.k.o().f.a();
long a32 = this.k.o().g.a();
max = Math.max(K().w("select max(bundle_end_timestamp) from queue", null, 0L), K().w("select max(timestamp) from raw_events", null, 0L));
if (max != 0) {
}
j2 = 0;
if (j2 == 0) {
}
}
@WorkerThread
public final void x() {
U();
if (this.r || this.f1540s || this.t) {
this.k.g().n.d("Not stopping services. fetch, network, upload", Boolean.valueOf(this.r), Boolean.valueOf(this.f1540s), Boolean.valueOf(this.t));
return;
}
this.k.g().n.a("Stopping uploading service(s)");
List<Runnable> list = this.o;
if (list != null) {
for (Runnable runnable : list) {
runnable.run();
}
this.o.clear();
}
}
@WorkerThread
public final zzn y(String str) {
a4 T = K().T(str);
if (T == null || TextUtils.isEmpty(T.M())) {
this.k.g().m.b("No app data available; dropping", str);
return null;
}
Boolean z2 = z(T);
if (z2 == null || z2.booleanValue()) {
return new zzn(str, T.v(), T.M(), T.N(), T.O(), T.P(), T.Q(), (String) null, T.T(), false, T.H(), T.g(), 0L, 0, T.h(), T.i(), false, T.y(), T.j(), T.S(), T.k(), (!da.b() || !this.k.h.u(str, p.f1558j0)) ? null : T.B(), (!t8.b() || !this.k.h.o(p.J0)) ? "" : a(str).d());
}
this.k.g().f.b("App version does not match; dropping. appId", q3.s(str));
return null;
}
@WorkerThread
public final Boolean z(a4 a4Var) {
try {
if (a4Var.N() != -2147483648L) {
if (a4Var.N() == b.a(this.k.f1567b).b(a4Var.o(), 0).versionCode) {
return Boolean.TRUE;
}
} else {
String str = b.a(this.k.f1567b).b(a4Var.o(), 0).versionName;
if (a4Var.M() != null && a4Var.M().equals(str)) {
return Boolean.TRUE;
}
}
return Boolean.FALSE;
} catch (PackageManager.NameNotFoundException unused) {
return null;
}
}
}