181 lines
6.7 KiB
Java
181 lines
6.7 KiB
Java
package c.i.a.f.i.b;
|
|
|
|
import android.database.Cursor;
|
|
import android.database.sqlite.SQLiteException;
|
|
import android.text.TextUtils;
|
|
import android.util.Pair;
|
|
import c.i.a.f.h.l.a1;
|
|
import c.i.a.f.h.l.c1;
|
|
import c.i.a.f.h.l.u4;
|
|
import java.io.IOException;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
/* compiled from: com.google.android.gms:play-services-measurement@@18.0.0 */
|
|
public final class ca {
|
|
public a1 a;
|
|
public Long b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public long f1141c;
|
|
public final /* synthetic */ ba d;
|
|
|
|
public ca(ba baVar, aa aaVar) {
|
|
this.d = baVar;
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:43:0x00f2 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:46:0x00f8 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:73:0x01c0 */
|
|
public final a1 a(String str, a1 a1Var) {
|
|
Cursor cursor;
|
|
Throwable th;
|
|
Pair pair;
|
|
Object obj;
|
|
Cursor cursor2;
|
|
SQLiteException e;
|
|
String F = a1Var.F();
|
|
List<c1> v = a1Var.v();
|
|
this.d.m();
|
|
Long l = (Long) q9.R(a1Var, "_eid");
|
|
boolean z2 = l != null;
|
|
if (z2 && F.equals("_ep")) {
|
|
this.d.m();
|
|
String str2 = (String) q9.R(a1Var, "_en");
|
|
if (TextUtils.isEmpty(str2)) {
|
|
this.d.g().g.b("Extra parameter without an event name. eventId", l);
|
|
return null;
|
|
}
|
|
if (this.a == null || this.b == null || l.longValue() != this.b.longValue()) {
|
|
g q = this.d.q();
|
|
q.b();
|
|
q.n();
|
|
try {
|
|
cursor2 = q.t().rawQuery("select main_event, children_to_process from main_event_params where app_id=? and event_id=?", new String[]{str, String.valueOf(l)});
|
|
try {
|
|
if (!cursor2.moveToFirst()) {
|
|
q.g().n.a("Main event not found");
|
|
cursor2.close();
|
|
pair = null;
|
|
} else {
|
|
try {
|
|
pair = Pair.create((a1) ((u4) ((a1.a) q9.x(a1.M(), cursor2.getBlob(0))).p()), Long.valueOf(cursor2.getLong(1)));
|
|
cursor2.close();
|
|
} catch (IOException e2) {
|
|
q.g().f.d("Failed to merge main event. appId, eventId", q3.s(str), l, e2);
|
|
cursor2.close();
|
|
pair = null;
|
|
if (pair != null) {
|
|
}
|
|
this.d.g().g.c("Extra parameter without existing main event. eventName, eventId", str2, l);
|
|
return null;
|
|
}
|
|
}
|
|
} catch (SQLiteException e3) {
|
|
e = e3;
|
|
try {
|
|
q.g().f.b("Error selecting main event", e);
|
|
if (cursor2 != null) {
|
|
}
|
|
pair = null;
|
|
if (pair != null) {
|
|
}
|
|
this.d.g().g.c("Extra parameter without existing main event. eventName, eventId", str2, l);
|
|
return null;
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
cursor = cursor2;
|
|
if (cursor != null) {
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
} catch (SQLiteException e4) {
|
|
e = e4;
|
|
cursor2 = null;
|
|
q.g().f.b("Error selecting main event", e);
|
|
if (cursor2 != null) {
|
|
cursor2.close();
|
|
}
|
|
pair = null;
|
|
if (pair != null) {
|
|
}
|
|
this.d.g().g.c("Extra parameter without existing main event. eventName, eventId", str2, l);
|
|
return null;
|
|
} catch (Throwable th3) {
|
|
th = th3;
|
|
cursor = null;
|
|
if (cursor != null) {
|
|
cursor.close();
|
|
}
|
|
throw th;
|
|
}
|
|
if (pair != null || (obj = pair.first) == null) {
|
|
this.d.g().g.c("Extra parameter without existing main event. eventName, eventId", str2, l);
|
|
return null;
|
|
}
|
|
this.a = (a1) obj;
|
|
this.f1141c = ((Long) pair.second).longValue();
|
|
this.d.m();
|
|
this.b = (Long) q9.R(this.a, "_eid");
|
|
}
|
|
long j = this.f1141c - 1;
|
|
this.f1141c = j;
|
|
if (j <= 0) {
|
|
g q2 = this.d.q();
|
|
q2.b();
|
|
q2.g().n.b("Clearing complex main event info. appId", str);
|
|
try {
|
|
q2.t().execSQL("delete from main_event_params where app_id=?", new String[]{str});
|
|
} catch (SQLiteException e5) {
|
|
q2.g().f.b("Error clearing complex main event", e5);
|
|
}
|
|
} else {
|
|
this.d.q().Q(str, l, this.f1141c, this.a);
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
for (c1 c1Var : this.a.v()) {
|
|
this.d.m();
|
|
if (q9.w(a1Var, c1Var.B()) == null) {
|
|
arrayList.add(c1Var);
|
|
}
|
|
}
|
|
if (!arrayList.isEmpty()) {
|
|
arrayList.addAll(v);
|
|
v = arrayList;
|
|
} else {
|
|
this.d.g().g.b("No unique parameters in main event. eventName", str2);
|
|
}
|
|
F = str2;
|
|
} else if (z2) {
|
|
this.b = l;
|
|
this.a = a1Var;
|
|
this.d.m();
|
|
long j2 = 0L;
|
|
Object R = q9.R(a1Var, "_epc");
|
|
if (R != null) {
|
|
j2 = R;
|
|
}
|
|
long longValue = ((Long) j2).longValue();
|
|
this.f1141c = longValue;
|
|
if (longValue <= 0) {
|
|
this.d.g().g.b("Complex event with zero extra param count. eventName", F);
|
|
} else {
|
|
this.d.q().Q(str, l, this.f1141c, a1Var);
|
|
}
|
|
}
|
|
a1.a t = a1Var.t();
|
|
t.t(F);
|
|
if (t.k) {
|
|
t.n();
|
|
t.k = false;
|
|
}
|
|
a1.w((a1) t.j);
|
|
if (t.k) {
|
|
t.n();
|
|
t.k = false;
|
|
}
|
|
a1.B((a1) t.j, v);
|
|
return (a1) ((u4) t.p());
|
|
}
|
|
}
|