529 lines
18 KiB
Java
529 lines
18 KiB
Java
package c.i.a.f.i.b;
|
|
|
|
import android.content.ContentValues;
|
|
import android.database.Cursor;
|
|
import android.database.sqlite.SQLiteDatabase;
|
|
import android.database.sqlite.SQLiteException;
|
|
import android.text.TextUtils;
|
|
import androidx.annotation.WorkerThread;
|
|
import androidx.collection.ArrayMap;
|
|
import c.c.a.a0.d;
|
|
import c.i.a.f.e.o.f;
|
|
import c.i.a.f.h.l.k0;
|
|
import c.i.a.f.h.l.l0;
|
|
import c.i.a.f.h.l.m0;
|
|
import c.i.a.f.h.l.o0;
|
|
import c.i.a.f.h.l.t0;
|
|
import c.i.a.f.h.l.u0;
|
|
import c.i.a.f.h.l.u4;
|
|
import c.i.a.f.h.l.v0;
|
|
import c.i.a.f.h.l.x7;
|
|
import com.google.android.gms.internal.measurement.zzij;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
/* compiled from: com.google.android.gms:play-services-measurement@@18.0.0 */
|
|
public final class p4 extends i9 implements e {
|
|
public final Map<String, Map<String, String>> d = new ArrayMap();
|
|
public final Map<String, Map<String, Boolean>> e = new ArrayMap();
|
|
public final Map<String, Map<String, Boolean>> f = new ArrayMap();
|
|
public final Map<String, u0> g = new ArrayMap();
|
|
public final Map<String, Map<String, Integer>> h = new ArrayMap();
|
|
public final Map<String, String> i = new ArrayMap();
|
|
|
|
public p4(k9 k9Var) {
|
|
super(k9Var);
|
|
}
|
|
|
|
public static Map<String, String> u(u0 u0Var) {
|
|
ArrayMap arrayMap = new ArrayMap();
|
|
for (v0 v0Var : u0Var.B()) {
|
|
arrayMap.put(v0Var.u(), v0Var.v());
|
|
}
|
|
return arrayMap;
|
|
}
|
|
|
|
@WorkerThread
|
|
public final boolean A(String str) {
|
|
b();
|
|
u0 s2 = s(str);
|
|
if (s2 == null) {
|
|
return false;
|
|
}
|
|
return s2.E();
|
|
}
|
|
|
|
@WorkerThread
|
|
public final long B(String str) {
|
|
String i = i(str, "measurement.account.time_zone_offset_minutes");
|
|
if (TextUtils.isEmpty(i)) {
|
|
return 0;
|
|
}
|
|
try {
|
|
return Long.parseLong(i);
|
|
} catch (NumberFormatException e) {
|
|
g().i.c("Unable to parse timezone offset. appId", q3.s(str), e);
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
public final boolean C(String str) {
|
|
return "1".equals(i(str, "measurement.upload.blacklist_internal"));
|
|
}
|
|
|
|
public final boolean D(String str) {
|
|
return "1".equals(i(str, "measurement.upload.blacklist_public"));
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:20:0x007c */
|
|
/* JADX WARNING: Removed duplicated region for block: B:23:0x0082 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:25:0x00a1 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:29:0x00d6 */
|
|
@WorkerThread
|
|
public final void E(String str) {
|
|
Throwable th;
|
|
byte[] bArr;
|
|
SQLiteException e;
|
|
Cursor cursor;
|
|
n();
|
|
b();
|
|
d.w(str);
|
|
if (this.g.get(str) == null) {
|
|
g q = q();
|
|
Objects.requireNonNull(q);
|
|
d.w(str);
|
|
q.b();
|
|
q.n();
|
|
Cursor cursor2 = null;
|
|
try {
|
|
cursor = q.t().query("apps", new String[]{"remote_config"}, "app_id=?", new String[]{str}, null, null, null);
|
|
try {
|
|
if (!cursor.moveToFirst()) {
|
|
cursor.close();
|
|
bArr = null;
|
|
if (bArr != null) {
|
|
this.d.put(str, null);
|
|
this.e.put(str, null);
|
|
this.f.put(str, null);
|
|
this.g.put(str, null);
|
|
this.i.put(str, null);
|
|
this.h.put(str, null);
|
|
return;
|
|
}
|
|
u0.a t = t(str, bArr).t();
|
|
v(str, t);
|
|
this.d.put(str, u((u0) ((u4) t.p())));
|
|
this.g.put(str, (u0) ((u4) t.p()));
|
|
this.i.put(str, null);
|
|
return;
|
|
}
|
|
bArr = cursor.getBlob(0);
|
|
if (cursor.moveToNext()) {
|
|
q.g().f.b("Got multiple records for app config, expected one. appId", q3.s(str));
|
|
}
|
|
cursor.close();
|
|
if (bArr != null) {
|
|
}
|
|
} catch (SQLiteException e2) {
|
|
e = e2;
|
|
try {
|
|
q.g().f.c("Error querying remote config. appId", q3.s(str), e);
|
|
if (cursor != null) {
|
|
}
|
|
bArr = null;
|
|
if (bArr != null) {
|
|
}
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
cursor2 = cursor;
|
|
if (cursor2 != null) {
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
} catch (SQLiteException e3) {
|
|
e = e3;
|
|
cursor = null;
|
|
q.g().f.c("Error querying remote config. appId", q3.s(str), e);
|
|
if (cursor != null) {
|
|
cursor.close();
|
|
}
|
|
bArr = null;
|
|
if (bArr != null) {
|
|
}
|
|
} catch (Throwable th3) {
|
|
th = th3;
|
|
if (cursor2 != null) {
|
|
cursor2.close();
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // c.i.a.f.i.b.e
|
|
@WorkerThread
|
|
public final String i(String str, String str2) {
|
|
b();
|
|
E(str);
|
|
Map<String, String> map = this.d.get(str);
|
|
if (map != null) {
|
|
return map.get(str2);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // c.i.a.f.i.b.i9
|
|
public final boolean p() {
|
|
return false;
|
|
}
|
|
|
|
@WorkerThread
|
|
public final u0 s(String str) {
|
|
n();
|
|
b();
|
|
d.w(str);
|
|
E(str);
|
|
return this.g.get(str);
|
|
}
|
|
|
|
@WorkerThread
|
|
public final u0 t(String str, byte[] bArr) {
|
|
if (bArr == null) {
|
|
return u0.G();
|
|
}
|
|
try {
|
|
u0 u0Var = (u0) ((u4) ((u0.a) q9.x(u0.F(), bArr)).p());
|
|
s3 s3Var = g().n;
|
|
String str2 = null;
|
|
Long valueOf = u0Var.x() ? Long.valueOf(u0Var.y()) : null;
|
|
if (u0Var.z()) {
|
|
str2 = u0Var.A();
|
|
}
|
|
s3Var.c("Parsed config. version, gmp_app_id", valueOf, str2);
|
|
return u0Var;
|
|
} catch (zzij e) {
|
|
g().i.c("Unable to merge remote config. appId", q3.s(str), e);
|
|
return u0.G();
|
|
} catch (RuntimeException e2) {
|
|
g().i.c("Unable to merge remote config. appId", q3.s(str), e2);
|
|
return u0.G();
|
|
}
|
|
}
|
|
|
|
public final void v(String str, u0.a aVar) {
|
|
ArrayMap arrayMap = new ArrayMap();
|
|
ArrayMap arrayMap2 = new ArrayMap();
|
|
ArrayMap arrayMap3 = new ArrayMap();
|
|
for (int i = 0; i < ((u0) aVar.j).C(); i++) {
|
|
t0.a t = ((u0) aVar.j).u(i).t();
|
|
if (TextUtils.isEmpty(t.q())) {
|
|
g().i.a("EventConfig contained null event name");
|
|
} else {
|
|
String q = t.q();
|
|
String G1 = f.G1(t.q(), v5.a, v5.f1247c);
|
|
if (!TextUtils.isEmpty(G1)) {
|
|
if (t.k) {
|
|
t.n();
|
|
t.k = false;
|
|
}
|
|
t0.v((t0) t.j, G1);
|
|
if (aVar.k) {
|
|
aVar.n();
|
|
aVar.k = false;
|
|
}
|
|
u0.w((u0) aVar.j, i, (t0) ((u4) t.p()));
|
|
}
|
|
if (!x7.b() || !this.a.h.o(p.N0)) {
|
|
arrayMap.put(t.q(), Boolean.valueOf(((t0) t.j).w()));
|
|
} else {
|
|
arrayMap.put(q, Boolean.valueOf(((t0) t.j).w()));
|
|
}
|
|
arrayMap2.put(t.q(), Boolean.valueOf(((t0) t.j).x()));
|
|
if (((t0) t.j).y()) {
|
|
if (t.r() < 2 || t.r() > 65535) {
|
|
g().i.c("Invalid sampling rate. Event name, sample rate", t.q(), Integer.valueOf(t.r()));
|
|
} else {
|
|
arrayMap3.put(t.q(), Integer.valueOf(t.r()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.e.put(str, arrayMap);
|
|
this.f.put(str, arrayMap2);
|
|
this.h.put(str, arrayMap3);
|
|
}
|
|
|
|
@WorkerThread
|
|
public final boolean w(String str, byte[] bArr, String str2) {
|
|
byte[] bArr2;
|
|
boolean z2;
|
|
String str3;
|
|
boolean z3;
|
|
boolean z4;
|
|
n();
|
|
b();
|
|
d.w(str);
|
|
u0.a t = t(str, bArr).t();
|
|
v(str, t);
|
|
this.g.put(str, (u0) ((u4) t.p()));
|
|
this.i.put(str, str2);
|
|
this.d.put(str, u((u0) ((u4) t.p())));
|
|
g q = q();
|
|
ArrayList arrayList = new ArrayList(Collections.unmodifiableList(((u0) t.j).D()));
|
|
Objects.requireNonNull(q);
|
|
String str4 = "app_id=? and audience_id=?";
|
|
String str5 = "null reference";
|
|
int i = 0;
|
|
while (i < arrayList.size()) {
|
|
k0.a t2 = ((k0) arrayList.get(i)).t();
|
|
if (((k0) t2.j).D() != 0) {
|
|
int i2 = 0;
|
|
while (i2 < ((k0) t2.j).D()) {
|
|
l0.a t3 = ((k0) t2.j).z(i2).t();
|
|
l0.a aVar = (l0.a) ((u4.b) t3.clone());
|
|
String G1 = f.G1(((l0) t3.j).z(), v5.a, v5.f1247c);
|
|
if (G1 != null) {
|
|
if (aVar.k) {
|
|
aVar.n();
|
|
aVar.k = false;
|
|
}
|
|
l0.w((l0) aVar.j, G1);
|
|
z4 = true;
|
|
} else {
|
|
z4 = false;
|
|
}
|
|
int i3 = 0;
|
|
while (i3 < ((l0) t3.j).B()) {
|
|
m0 u = ((l0) t3.j).u(i3);
|
|
String G12 = f.G1(u.C(), u5.a, u5.b);
|
|
if (G12 != null) {
|
|
m0.a t4 = u.t();
|
|
if (t4.k) {
|
|
t4.n();
|
|
t4.k = false;
|
|
}
|
|
m0.u((m0) t4.j, G12);
|
|
m0 m0Var = (m0) ((u4) t4.p());
|
|
if (aVar.k) {
|
|
aVar.n();
|
|
aVar.k = false;
|
|
}
|
|
l0.v((l0) aVar.j, i3, m0Var);
|
|
z4 = true;
|
|
}
|
|
i3++;
|
|
t3 = t3;
|
|
str4 = str4;
|
|
str5 = str5;
|
|
}
|
|
if (z4) {
|
|
if (t2.k) {
|
|
t2.n();
|
|
t2.k = false;
|
|
}
|
|
k0.v((k0) t2.j, i2, (l0) ((u4) aVar.p()));
|
|
arrayList.set(i, (k0) ((u4) t2.p()));
|
|
}
|
|
i2++;
|
|
t = t;
|
|
str4 = str4;
|
|
str5 = str5;
|
|
}
|
|
}
|
|
if (((k0) t2.j).B() != 0) {
|
|
for (int i4 = 0; i4 < ((k0) t2.j).B(); i4++) {
|
|
o0 u2 = ((k0) t2.j).u(i4);
|
|
String G13 = f.G1(u2.x(), x5.a, x5.b);
|
|
if (G13 != null) {
|
|
o0.a t5 = u2.t();
|
|
if (t5.k) {
|
|
t5.n();
|
|
z3 = false;
|
|
t5.k = false;
|
|
} else {
|
|
z3 = false;
|
|
}
|
|
o0.u((o0) t5.j, G13);
|
|
if (t2.k) {
|
|
t2.n();
|
|
t2.k = z3;
|
|
}
|
|
k0.w((k0) t2.j, i4, (o0) ((u4) t5.p()));
|
|
arrayList.set(i, (k0) ((u4) t2.p()));
|
|
}
|
|
}
|
|
}
|
|
i++;
|
|
t = t;
|
|
str4 = str4;
|
|
str5 = str5;
|
|
}
|
|
String str6 = str4;
|
|
String str7 = str5;
|
|
q.n();
|
|
q.b();
|
|
d.w(str);
|
|
SQLiteDatabase t6 = q.t();
|
|
t6.beginTransaction();
|
|
try {
|
|
q.n();
|
|
q.b();
|
|
d.w(str);
|
|
SQLiteDatabase t7 = q.t();
|
|
t7.delete("property_filters", "app_id=?", new String[]{str});
|
|
t7.delete("event_filters", "app_id=?", new String[]{str});
|
|
Iterator it = arrayList.iterator();
|
|
while (it.hasNext()) {
|
|
k0 k0Var = (k0) it.next();
|
|
q.n();
|
|
q.b();
|
|
d.w(str);
|
|
Objects.requireNonNull(k0Var, str7);
|
|
if (!k0Var.x()) {
|
|
q.g().i.b("Audience with no ID. appId", q3.s(str));
|
|
} else {
|
|
int y2 = k0Var.y();
|
|
Iterator<l0> it2 = k0Var.C().iterator();
|
|
while (true) {
|
|
if (it2.hasNext()) {
|
|
if (!it2.next().x()) {
|
|
q.g().i.c("Event filter with no ID. Audience definition ignored. appId, audienceId", q3.s(str), Integer.valueOf(y2));
|
|
break;
|
|
}
|
|
} else {
|
|
for (o0 o0Var : k0Var.A()) {
|
|
if (!o0Var.v()) {
|
|
q.g().i.c("Property filter with no ID. Audience definition ignored. appId, audienceId", q3.s(str), Integer.valueOf(y2));
|
|
}
|
|
}
|
|
Iterator<l0> it3 = k0Var.C().iterator();
|
|
while (true) {
|
|
if (it3.hasNext()) {
|
|
if (!q.O(str, y2, it3.next())) {
|
|
z2 = false;
|
|
break;
|
|
}
|
|
} else {
|
|
z2 = true;
|
|
break;
|
|
}
|
|
}
|
|
if (z2) {
|
|
Iterator<o0> it4 = k0Var.A().iterator();
|
|
while (true) {
|
|
if (it4.hasNext()) {
|
|
if (!q.P(str, y2, it4.next())) {
|
|
z2 = false;
|
|
break;
|
|
}
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (!z2) {
|
|
q.n();
|
|
q.b();
|
|
d.w(str);
|
|
SQLiteDatabase t8 = q.t();
|
|
str3 = str6;
|
|
t8.delete("property_filters", str3, new String[]{str, String.valueOf(y2)});
|
|
t8.delete("event_filters", str3, new String[]{str, String.valueOf(y2)});
|
|
} else {
|
|
str3 = str6;
|
|
}
|
|
str7 = str7;
|
|
str6 = str3;
|
|
}
|
|
}
|
|
}
|
|
str7 = str7;
|
|
}
|
|
ArrayList arrayList2 = new ArrayList();
|
|
Iterator it5 = arrayList.iterator();
|
|
while (it5.hasNext()) {
|
|
k0 k0Var2 = (k0) it5.next();
|
|
arrayList2.add(k0Var2.x() ? Integer.valueOf(k0Var2.y()) : null);
|
|
}
|
|
q.W(str, arrayList2);
|
|
t6.setTransactionSuccessful();
|
|
try {
|
|
if (t.k) {
|
|
t.n();
|
|
t.k = false;
|
|
}
|
|
u0.v((u0) t.j);
|
|
bArr2 = ((u0) ((u4) t.p())).d();
|
|
} catch (RuntimeException e) {
|
|
g().i.c("Unable to serialize reduced-size config. Storing full config instead. appId", q3.s(str), e);
|
|
bArr2 = bArr;
|
|
}
|
|
g q2 = q();
|
|
d.w(str);
|
|
q2.b();
|
|
q2.n();
|
|
ContentValues contentValues = new ContentValues();
|
|
contentValues.put("remote_config", bArr2);
|
|
try {
|
|
if (((long) q2.t().update("apps", contentValues, "app_id = ?", new String[]{str})) == 0) {
|
|
q2.g().f.b("Failed to update remote config (got 0). appId", q3.s(str));
|
|
}
|
|
} catch (SQLiteException e2) {
|
|
q2.g().f.c("Error storing remote config. appId", q3.s(str), e2);
|
|
}
|
|
this.g.put(str, (u0) ((u4) t.p()));
|
|
return true;
|
|
} finally {
|
|
t6.endTransaction();
|
|
}
|
|
}
|
|
|
|
@WorkerThread
|
|
public final boolean x(String str, String str2) {
|
|
Boolean bool;
|
|
b();
|
|
E(str);
|
|
if ("1".equals(i(str, "measurement.upload.blacklist_internal")) && t9.r0(str2)) {
|
|
return true;
|
|
}
|
|
if ("1".equals(i(str, "measurement.upload.blacklist_public")) && t9.X(str2)) {
|
|
return true;
|
|
}
|
|
Map<String, Boolean> map = this.e.get(str);
|
|
if (map == null || (bool = map.get(str2)) == null) {
|
|
return false;
|
|
}
|
|
return bool.booleanValue();
|
|
}
|
|
|
|
@WorkerThread
|
|
public final boolean y(String str, String str2) {
|
|
Boolean bool;
|
|
b();
|
|
E(str);
|
|
if ("ecommerce_purchase".equals(str2) || "purchase".equals(str2) || "refund".equals(str2)) {
|
|
return true;
|
|
}
|
|
Map<String, Boolean> map = this.f.get(str);
|
|
if (map == null || (bool = map.get(str2)) == null) {
|
|
return false;
|
|
}
|
|
return bool.booleanValue();
|
|
}
|
|
|
|
@WorkerThread
|
|
public final int z(String str, String str2) {
|
|
Integer num;
|
|
b();
|
|
E(str);
|
|
Map<String, Integer> map = this.h.get(str);
|
|
if (map == null || (num = map.get(str2)) == null) {
|
|
return 1;
|
|
}
|
|
return num.intValue();
|
|
}
|
|
}
|