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

911 lines
34 KiB
Java

package c.i.a.f.i.b;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.SystemClock;
import android.text.TextUtils;
import androidx.annotation.GuardedBy;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import c.c.a.a0.d;
import c.i.a.f.e.o.c;
import c.i.a.f.e.o.f;
import c.i.a.f.e.o.h;
import c.i.a.f.h.l.a9;
import c.i.a.f.h.l.ea;
import c.i.a.f.h.l.g9;
import c.i.a.f.h.l.j9;
import c.i.a.f.h.l.r9;
import c.i.a.f.h.l.t8;
import c.i.a.f.h.l.x7;
import com.discord.models.domain.ModelAuditLogEntry;
import com.google.android.gms.measurement.internal.AppMeasurementDynamiteService;
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 java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
/* compiled from: com.google.android.gms:play-services-measurement-impl@@18.0.0 */
public final class c6 extends a5 {
/* renamed from: c reason: collision with root package name */
public y6 f1185c;
public w5 d;
public final Set<z5> e = new CopyOnWriteArraySet();
public boolean f;
public final AtomicReference<String> g = new AtomicReference<>();
public final Object h = new Object();
@GuardedBy("consentLock")
public d i = new d(null, null);
@GuardedBy("consentLock")
public int j = 100;
public final AtomicLong k = new AtomicLong(0);
public long l = -1;
public int m = 100;
public final y9 n;
public boolean o = true;
public final v9 p = new q6(this);
public c6(u4 u4Var) {
super(u4Var);
this.n = new y9(u4Var);
}
/* JADX WARNING: Removed duplicated region for block: B:14:0x0062 */
/* JADX WARNING: Removed duplicated region for block: B:26:0x00af */
public static void C(c6 c6Var, d dVar, int i, long j, boolean z2, boolean z3) {
boolean z4;
c6Var.b();
c6Var.t();
if (j > c6Var.l || !d.e(c6Var.m, i)) {
d4 l = c6Var.l();
Objects.requireNonNull(l);
if (t8.b() && l.a.h.o(p.H0)) {
l.b();
if (l.t(i)) {
SharedPreferences.Editor edit = l.w().edit();
edit.putString("consent_settings", dVar.d());
edit.putInt("consent_source", i);
edit.apply();
z4 = true;
if (!z4) {
c6Var.l = j;
c6Var.m = i;
q7 p = c6Var.p();
Objects.requireNonNull(p);
if (t8.b() && p.a.h.o(p.H0)) {
p.b();
p.t();
if (z2) {
p.r().y();
}
if (p.E()) {
p.z(new e8(p, p.I(false)));
}
}
if (z3) {
c6Var.p().A(new AtomicReference<>());
return;
}
return;
}
c6Var.g().l.b("Lower precedence consent source ignored, proposed source", Integer.valueOf(i));
return;
}
}
z4 = false;
if (!z4) {
}
} else {
c6Var.g().l.b("Dropped out-of-date consent setting, proposed settings", dVar);
}
}
public final void A(d dVar, int i, long j) {
boolean z2;
boolean z3;
d dVar2;
boolean z4;
if (t8.b() && this.a.h.o(p.H0)) {
t();
if ((!this.a.h.o(p.I0) || i != 20) && dVar.b == null && dVar.f1187c == null) {
g().k.a("Discarding empty consent settings");
return;
}
synchronized (this.h) {
z2 = false;
if (d.e(i, this.j)) {
z4 = dVar.f(this.i);
if (dVar.k() && !this.i.k()) {
z2 = true;
}
d dVar3 = this.i;
Boolean bool = dVar.b;
if (bool == null) {
bool = dVar3.b;
}
Boolean bool2 = dVar.f1187c;
if (bool2 == null) {
bool2 = dVar3.f1187c;
}
d dVar4 = new d(bool, bool2);
this.i = dVar4;
this.j = i;
z3 = z2;
dVar2 = dVar4;
z2 = true;
} else {
dVar2 = dVar;
z3 = false;
z4 = false;
}
}
if (!z2) {
g().l.b("Ignoring lower-priority consent settings, proposed settings", dVar2);
return;
}
long andIncrement = this.k.getAndIncrement();
if (z4) {
this.g.set(null);
f().w(new x6(this, dVar2, j, i, andIncrement, z3));
} else if (!this.a.h.o(p.I0) || !(i == 40 || i == 20)) {
f().v(new z6(this, dVar2, i, andIncrement, z3));
} else {
f().w(new w6(this, dVar2, i, andIncrement, z3));
}
}
}
@WorkerThread
public final void B(w5 w5Var) {
w5 w5Var2;
b();
t();
if (!(w5Var == null || w5Var == (w5Var2 = this.d))) {
d.G(w5Var2 == null, "EventInterceptor already set.");
}
this.d = w5Var;
}
@WorkerThread
public final void D(@Nullable Boolean bool, boolean z2) {
b();
t();
g().m.b("Setting app measurement enabled (FE)", bool);
l().s(bool);
if (t8.b() && this.a.h.o(p.H0) && z2) {
d4 l = l();
Objects.requireNonNull(l);
if (t8.b() && l.a.h.o(p.H0)) {
l.b();
SharedPreferences.Editor edit = l.w().edit();
if (bool != null) {
edit.putBoolean("measurement_enabled_from_api", bool.booleanValue());
} else {
edit.remove("measurement_enabled_from_api");
}
edit.apply();
}
}
if (!t8.b() || !this.a.h.o(p.H0) || this.a.i() || !bool.booleanValue()) {
P();
}
}
@WorkerThread
public final void E(String str, String str2, long j, Bundle bundle) {
b();
F(str, str2, j, bundle, true, this.d == null || t9.r0(str2), false, null);
}
/* JADX WARNING: Removed duplicated region for block: B:66:0x0157 */
@WorkerThread
public final void F(String str, String str2, long j, Bundle bundle, boolean z2, boolean z3, boolean z4, String str3) {
ArrayList arrayList;
Bundle bundle2;
boolean z5;
boolean z6;
Bundle[] bundleArr;
boolean z7;
boolean z8;
d.w(str);
Objects.requireNonNull(bundle, "null reference");
b();
t();
if (!this.a.d()) {
g().m.a("Event not sent since app measurement is disabled");
return;
}
List<String> list = o().i;
if (list == null || list.contains(str2)) {
int i = 0;
if (!this.f) {
this.f = true;
try {
u4 u4Var = this.a;
try {
(!u4Var.f ? Class.forName("com.google.android.gms.tagmanager.TagManagerService", true, u4Var.b.getClassLoader()) : Class.forName("com.google.android.gms.tagmanager.TagManagerService")).getDeclaredMethod("initialize", Context.class).invoke(null, this.a.b);
} catch (Exception e) {
g().i.b("Failed to invoke Tag Manager's initialize() method", e);
}
} catch (ClassNotFoundException unused) {
g().l.a("Tag Manager is not found and thus will not be used");
}
}
if (this.a.h.o(p.f1224e0) && "_cmp".equals(str2) && bundle.containsKey("gclid")) {
String string = bundle.getString("gclid");
Objects.requireNonNull((c) this.a.o);
K("auto", "_lgclid", string, System.currentTimeMillis());
}
if (ea.b() && this.a.h.o(p.z0) && z2) {
String[] strArr = t9.d;
int length = strArr.length;
int i2 = 0;
while (true) {
if (i2 >= length) {
z8 = true;
break;
} else if (strArr[i2].equals(str2)) {
z8 = false;
break;
} else {
i2++;
}
}
if (z8) {
e().H(bundle, l().D.a());
}
}
if (z4 && !"_iap".equals(str2)) {
t9 t = this.a.t();
boolean z9 = x7.b() && this.a.h.o(p.L0);
int i3 = 2;
if (t.a0("event", str2)) {
if (z9) {
if (t.Z("event", 40, str2)) {
i3 = 0;
}
} else if (t.Z("event", 40, str2)) {
}
i3 = 13;
}
if (i3 != 0) {
g().h.b("Invalid public event name. Event will not be logged (FE)", d().u(str2));
this.a.t();
String E = t9.E(str2, 40, true);
if (str2 != null) {
i = str2.length();
}
this.a.t().R(this.p, i3, "_ev", E, i);
return;
}
}
i7 w = q().w(false);
if (w != null && !bundle.containsKey("_sc")) {
w.d = true;
}
h7.A(w, bundle, z2 && z4);
boolean equals = "am".equals(str);
boolean r0 = t9.r0(str2);
if (z2 && this.d != null && !r0 && !equals) {
g().m.c("Passing event to registered event handler (FE)", d().u(str2), d().s(bundle));
AppMeasurementDynamiteService.a aVar = (AppMeasurementDynamiteService.a) this.d;
Objects.requireNonNull(aVar);
try {
aVar.a.Z(str, str2, bundle, j);
} catch (RemoteException e2) {
AppMeasurementDynamiteService.this.a.g().i.b("Event interceptor threw exception", e2);
}
} else if (this.a.m()) {
int t2 = e().t(str2, x7.b() && this.a.h.o(p.L0));
if (t2 != 0) {
g().h.b("Invalid event name. Event will not be logged (FE)", d().u(str2));
e();
String E2 = t9.E(str2, 40, true);
if (str2 != null) {
i = str2.length();
}
this.a.t().S(this.p, str3, t2, "_ev", E2, i);
return;
}
String str4 = "_o";
Bundle z10 = e().z(str3, str2, bundle, Collections.unmodifiableList(Arrays.asList(str4, "_sn", "_sc", "_si")), z4);
if (z10 != null && z10.containsKey("_sc") && z10.containsKey("_si")) {
z10.getString("_sn");
z10.getString("_sc");
Long.valueOf(z10.getLong("_si")).longValue();
}
if (this.a.h.o(p.T) && q().w(false) != null && "_ae".equals(str2)) {
long b = s().e.b();
if (b > 0) {
e().G(z10, b);
}
}
if (a9.b() && this.a.h.o(p.p0)) {
if (!"auto".equals(str) && "_ssr".equals(str2)) {
t9 e3 = e();
String string2 = z10.getString("_ffr");
String trim = h.a(string2) ? null : string2.trim();
if (t9.q0(trim, e3.l().A.a())) {
e3.g().m.a("Not logging duplicate session_start_with_rollout event");
z7 = false;
} else {
e3.l().A.b(trim);
z7 = true;
}
if (!z7) {
return;
}
} else if ("_ae".equals(str2)) {
String a = e().l().A.a();
if (!TextUtils.isEmpty(a)) {
z10.putString("_ffr", a);
}
}
}
ArrayList arrayList2 = new ArrayList();
arrayList2.add(z10);
e().v0().nextLong();
if (l().v.a() <= 0 || !l().u(j) || !l().f1190x.b()) {
bundle2 = z10;
arrayList = arrayList2;
} else {
g().n.a("Current session is expired, remove the session number, ID, and engagement time");
Objects.requireNonNull((c) this.a.o);
bundle2 = z10;
arrayList = arrayList2;
K("auto", "_sid", null, System.currentTimeMillis());
Objects.requireNonNull((c) this.a.o);
K("auto", "_sno", null, System.currentTimeMillis());
Objects.requireNonNull((c) this.a.o);
K("auto", "_se", null, System.currentTimeMillis());
}
if (bundle2.getLong("extend_session", 0) == 1) {
g().n.a("EXTEND_SESSION param attached: initiate a new session or extend the current active session");
this.a.r().d.b(j, true);
}
String[] strArr2 = (String[]) bundle2.keySet().toArray(new String[bundle2.size()]);
Arrays.sort(strArr2);
for (String str5 : strArr2) {
e();
Object obj = bundle2.get(str5);
if (obj instanceof Bundle) {
bundleArr = new Bundle[]{(Bundle) obj};
} else if (obj instanceof Parcelable[]) {
Parcelable[] parcelableArr = (Parcelable[]) obj;
bundleArr = (Bundle[]) Arrays.copyOf(parcelableArr, parcelableArr.length, Bundle[].class);
} else if (obj instanceof ArrayList) {
ArrayList arrayList3 = (ArrayList) obj;
bundleArr = (Bundle[]) arrayList3.toArray(new Bundle[arrayList3.size()]);
} else {
bundleArr = null;
}
if (bundleArr != null) {
bundle2.putParcelableArray(str5, bundleArr);
}
}
int i4 = 0;
while (i4 < arrayList.size()) {
Bundle bundle3 = (Bundle) arrayList.get(i4);
String str6 = i4 != 0 ? "_ep" : str2;
bundle3.putString(str4, str);
if (z3) {
bundle3 = e().y(bundle3);
}
zzaq zzaq = new zzaq(str6, new zzap(bundle3), str, j);
q7 p = p();
Objects.requireNonNull(p);
p.b();
p.t();
m3 r = p.r();
Objects.requireNonNull(r);
Parcel obtain = Parcel.obtain();
zzaq.writeToParcel(obtain, 0);
byte[] marshall = obtain.marshall();
obtain.recycle();
if (marshall.length > 131072) {
r.g().g.a("Event is too long for local database. Sending event directly to service");
z6 = true;
z5 = false;
} else {
z5 = r.x(0, marshall);
z6 = true;
}
p.z(new d8(p, true, z5, zzaq, p.I(z6), str3));
if (!equals) {
for (z5 z5Var : this.e) {
z5Var.a(str, str2, new Bundle(bundle3), j);
}
}
i4++;
str4 = str4;
arrayList = arrayList;
}
if (q().w(false) != null && "_ae".equals(str2)) {
w8 s2 = s();
Objects.requireNonNull((c) this.a.o);
s2.w(true, true, SystemClock.elapsedRealtime());
}
}
} else {
g().m.c("Dropping non-safelisted event. event name, origin", str2, str);
}
}
public final void G(String str, String str2, long j, Object obj) {
f().v(new j6(this, str, str2, obj, j));
}
public final void H(String str, String str2, Bundle bundle) {
Objects.requireNonNull((c) this.a.o);
I(str, str2, bundle, true, true, System.currentTimeMillis());
}
public final void I(String str, String str2, Bundle bundle, boolean z2, boolean z3, long j) {
String string;
String str3;
String str4 = str == null ? "app" : str;
Bundle bundle2 = bundle == null ? new Bundle() : bundle;
if (this.a.h.o(p.v0)) {
if (t9.q0(str2, "screen_view")) {
h7 q = q();
if (!q.a.h.o(p.v0)) {
q.g().k.a("Manual screen reporting is disabled.");
return;
}
synchronized (q.l) {
if (!q.k) {
q.g().k.a("Cannot log screen view event when the app is in the background.");
return;
}
string = bundle2.getString("screen_name");
if (string == null || (string.length() > 0 && string.length() <= 100)) {
String string2 = bundle2.getString("screen_class");
if (string2 == null || (string2.length() > 0 && string2.length() <= 100)) {
if (string2 == null) {
Activity activity = q.g;
str3 = activity != null ? h7.x(activity.getClass().getCanonicalName()) : "Activity";
} else {
str3 = string2;
}
if (q.h && q.f1199c != null) {
q.h = false;
boolean q0 = t9.q0(q.f1199c.b, str3);
boolean q02 = t9.q0(q.f1199c.a, string);
if (q0 && q02) {
q.g().k.a("Ignoring call to log screen view event with duplicate parameters.");
return;
}
}
} else {
q.g().k.b("Invalid screen class length for screen view. Length", Integer.valueOf(string2.length()));
return;
}
} else {
q.g().k.b("Invalid screen name length for screen view. Length", Integer.valueOf(string.length()));
return;
}
}
q.g().n.c("Logging screen view with name, class", string == null ? "null" : string, str3 == null ? "null" : str3);
i7 i7Var = q.f1199c == null ? q.d : q.f1199c;
i7 i7Var2 = new i7(string, str3, q.e().t0(), true, j);
q.f1199c = i7Var2;
q.d = i7Var;
q.i = i7Var2;
Objects.requireNonNull((c) q.a.o);
q.f().v(new k7(q, bundle2, i7Var2, i7Var, SystemClock.elapsedRealtime()));
return;
}
}
Q(str4, str2, j, bundle2, z3, !z3 || this.d == null || t9.r0(str2), !z2, null);
}
public final void J(String str, String str2, Object obj) {
Objects.requireNonNull((c) this.a.o);
L(str, str2, obj, true, System.currentTimeMillis());
}
/* JADX WARNING: Removed duplicated region for block: B:20:0x006a */
/* JADX WARNING: Removed duplicated region for block: B:22:0x0076 */
@WorkerThread
public final void K(String str, String str2, Object obj, long j) {
Long l;
String str3;
d.w(str);
d.w(str2);
b();
t();
if ("allow_personalized_ads".equals(str2)) {
if (obj instanceof String) {
String str4 = (String) obj;
if (!TextUtils.isEmpty(str4)) {
String str5 = "false";
Long valueOf = Long.valueOf(str5.equals(str4.toLowerCase(Locale.ENGLISH)) ? 1 : 0);
j4 j4Var = l().t;
if (valueOf.longValue() == 1) {
str5 = "true";
}
j4Var.b(str5);
l = valueOf;
str3 = "_npa";
if (!this.a.d()) {
g().n.a("User property not set since app measurement is disabled");
return;
} else if (this.a.m()) {
zzku zzku = new zzku(str3, j, l, str);
q7 p = p();
p.b();
p.t();
m3 r = p.r();
Objects.requireNonNull(r);
Parcel obtain = Parcel.obtain();
boolean z2 = false;
zzku.writeToParcel(obtain, 0);
byte[] marshall = obtain.marshall();
obtain.recycle();
if (marshall.length > 131072) {
r.g().g.a("User property too long for local database. Sending directly to service");
} else {
z2 = r.x(1, marshall);
}
p.z(new r7(p, z2, zzku, p.I(true)));
return;
} else {
return;
}
}
}
if (obj == null) {
l().t.b("unset");
l = obj;
str3 = "_npa";
if (!this.a.d()) {
}
}
}
str3 = str2;
l = obj;
if (!this.a.d()) {
}
}
public final void L(String str, String str2, Object obj, boolean z2, long j) {
int i;
if (str == null) {
str = "app";
}
if (z2) {
i = e().h0(str2);
} else {
t9 e = e();
if (e.a0("user property", str2)) {
if (!e.f0("user property", x5.a, null, str2)) {
i = 15;
} else if (e.Z("user property", 24, str2)) {
i = 0;
}
}
i = 6;
}
if (i != 0) {
e();
this.a.t().R(this.p, i, "_ev", t9.E(str2, 24, true), str2 != null ? str2.length() : 0);
} else if (obj != null) {
int i02 = e().i0(str2, obj);
if (i02 != 0) {
e();
this.a.t().R(this.p, i02, "_ev", t9.E(str2, 24, true), ((obj instanceof String) || (obj instanceof CharSequence)) ? String.valueOf(obj).length() : 0);
return;
}
Object n0 = e().n0(str2, obj);
if (n0 != null) {
G(str, str2, j, n0);
}
} else {
G(str, str2, j, null);
}
}
public final void M() {
if (this.a.b.getApplicationContext() instanceof Application) {
((Application) this.a.b.getApplicationContext()).unregisterActivityLifecycleCallbacks(this.f1185c);
}
}
@WorkerThread
public final void N() {
b();
t();
if (this.a.m()) {
if (this.a.h.o(p.f1223d0)) {
Boolean w = this.a.h.w("google_analytics_deferred_deep_link_enabled");
if (w != null && w.booleanValue()) {
g().m.a("Deferred Deep Link feature enabled.");
f().v(new e6(this));
}
}
q7 p = p();
p.b();
p.t();
zzn I = p.I(true);
p.r().x(3, new byte[0]);
p.z(new x7(p, I));
this.o = false;
d4 l = l();
l.b();
String string = l.w().getString("previous_os_version", null);
l.c().o();
String str = Build.VERSION.RELEASE;
if (!TextUtils.isEmpty(str) && !str.equals(string)) {
SharedPreferences.Editor edit = l.w().edit();
edit.putString("previous_os_version", str);
edit.apply();
}
if (!TextUtils.isEmpty(string)) {
c().o();
if (!string.equals(str)) {
Bundle bundle = new Bundle();
bundle.putString("_po", string);
H("auto", "_ou", bundle);
}
}
}
}
@Nullable
public final String O() {
u4 u4Var = this.a;
String str = u4Var.f1240c;
if (str != null) {
return str;
}
try {
return f.D1(u4Var.b, "google_app_id");
} catch (IllegalStateException e) {
this.a.g().f.b("getGoogleAppId failed with exception", e);
return null;
}
}
@WorkerThread
public final void P() {
b();
String a = l().t.a();
if (a != null) {
if ("unset".equals(a)) {
Objects.requireNonNull((c) this.a.o);
K("app", "_npa", null, System.currentTimeMillis());
} else {
Long valueOf = Long.valueOf("true".equals(a) ? 1 : 0);
Objects.requireNonNull((c) this.a.o);
K("app", "_npa", valueOf, System.currentTimeMillis());
}
}
boolean z2 = true;
if (!this.a.d() || !this.o) {
g().m.a("Updating Scion state (FE)");
q7 p = p();
p.b();
p.t();
p.z(new b8(p, p.I(true)));
return;
}
g().m.a("Recording app launch after enabling measurement for the first time (FE)");
N();
if (r9.b() && this.a.h.o(p.q0)) {
s().d.a();
}
if (((j9) g9.i.a()).a() && this.a.h.o(p.t0)) {
if (this.a.f1242x.a.o().l.a() <= 0) {
z2 = false;
}
if (!z2) {
m4 m4Var = this.a.f1242x;
m4Var.a(m4Var.a.b.getPackageName());
}
}
if (this.a.h.o(p.D0)) {
f().v(new f6(this));
}
}
public final void Q(String str, String str2, long j, Bundle bundle, boolean z2, boolean z3, boolean z4, String str3) {
Bundle bundle2 = new Bundle(bundle);
for (String str4 : bundle2.keySet()) {
Object obj = bundle2.get(str4);
if (obj instanceof Bundle) {
bundle2.putBundle(str4, new Bundle((Bundle) obj));
} else {
int i = 0;
if (obj instanceof Parcelable[]) {
Parcelable[] parcelableArr = (Parcelable[]) obj;
while (i < parcelableArr.length) {
if (parcelableArr[i] instanceof Bundle) {
parcelableArr[i] = new Bundle((Bundle) parcelableArr[i]);
}
i++;
}
} else if (obj instanceof List) {
List list = (List) obj;
while (i < list.size()) {
Object obj2 = list.get(i);
if (obj2 instanceof Bundle) {
list.set(i, new Bundle((Bundle) obj2));
}
i++;
}
}
}
}
f().v(new k6(this, str, str2, j, bundle2, z2, z3, z4, null));
}
public final void R(String str, String str2, Bundle bundle) {
Objects.requireNonNull((c) this.a.o);
long currentTimeMillis = System.currentTimeMillis();
d.w(str);
Bundle bundle2 = new Bundle();
bundle2.putString(ModelAuditLogEntry.CHANGE_KEY_NAME, str);
bundle2.putLong("creation_timestamp", currentTimeMillis);
if (str2 != null) {
bundle2.putString("expired_event_name", str2);
bundle2.putBundle("expired_event_params", bundle);
}
f().v(new p6(this, bundle2));
}
@Override // c.i.a.f.i.b.a5
public final boolean v() {
return false;
}
public final void w(long j, boolean z2) {
b();
t();
g().m.a("Resetting analytics data (FE)");
w8 s2 = s();
s2.b();
d9 d9Var = s2.e;
d9Var.f1193c.c();
d9Var.a = 0;
d9Var.b = 0;
boolean d = this.a.d();
d4 l = l();
l.k.b(j);
if (!TextUtils.isEmpty(l.l().A.a())) {
l.A.b(null);
}
if (r9.b() && l.a.h.o(p.q0)) {
l.v.b(0);
}
if (!l.a.h.x()) {
l.v(!d);
}
l.B.b(null);
l.C.b(0);
l.D.b(null);
if (z2) {
q7 p = p();
p.b();
p.t();
zzn I = p.I(false);
p.r().y();
p.z(new t7(p, I));
}
if (r9.b() && this.a.h.o(p.q0)) {
s().d.a();
}
this.o = !d;
}
public final void x(Bundle bundle, int i, long j) {
if (t8.b() && this.a.h.o(p.H0)) {
t();
String string = bundle.getString("ad_storage");
if ((string == null || d.i(string) != null) && ((string = bundle.getString("analytics_storage")) == null || d.i(string) != null)) {
string = null;
}
if (string != null) {
g().k.b("Ignoring invalid consent setting", string);
g().k.a("Valid consent values are 'granted', 'denied'");
}
A(d.g(bundle), i, j);
}
}
public final void y(Bundle bundle, long j) {
Objects.requireNonNull(bundle, "null reference");
Bundle bundle2 = new Bundle(bundle);
if (!TextUtils.isEmpty(bundle2.getString("app_id"))) {
g().i.a("Package name should be null when calling setConditionalUserProperty");
}
bundle2.remove("app_id");
f.A1(bundle2, "app_id", String.class, null);
f.A1(bundle2, "origin", String.class, null);
f.A1(bundle2, ModelAuditLogEntry.CHANGE_KEY_NAME, String.class, null);
f.A1(bundle2, "value", Object.class, null);
f.A1(bundle2, "trigger_event_name", String.class, null);
f.A1(bundle2, "trigger_timeout", Long.class, 0L);
f.A1(bundle2, "timed_out_event_name", String.class, null);
f.A1(bundle2, "timed_out_event_params", Bundle.class, null);
f.A1(bundle2, "triggered_event_name", String.class, null);
f.A1(bundle2, "triggered_event_params", Bundle.class, null);
f.A1(bundle2, "time_to_live", Long.class, 0L);
f.A1(bundle2, "expired_event_name", String.class, null);
f.A1(bundle2, "expired_event_params", Bundle.class, null);
d.w(bundle2.getString(ModelAuditLogEntry.CHANGE_KEY_NAME));
d.w(bundle2.getString("origin"));
Objects.requireNonNull(bundle2.get("value"), "null reference");
bundle2.putLong("creation_timestamp", j);
String string = bundle2.getString(ModelAuditLogEntry.CHANGE_KEY_NAME);
Object obj = bundle2.get("value");
if (e().h0(string) != 0) {
g().f.b("Invalid conditional user property name", d().y(string));
} else if (e().i0(string, obj) != 0) {
g().f.c("Invalid conditional user property value", d().y(string), obj);
} else {
Object n0 = e().n0(string, obj);
if (n0 == null) {
g().f.c("Unable to normalize conditional user property value", d().y(string), obj);
return;
}
f.L1(bundle2, n0);
long j2 = bundle2.getLong("trigger_timeout");
if (TextUtils.isEmpty(bundle2.getString("trigger_event_name")) || (j2 <= 15552000000L && j2 >= 1)) {
long j3 = bundle2.getLong("time_to_live");
if (j3 > 15552000000L || j3 < 1) {
g().f.c("Invalid conditional user property time to live", d().y(string), Long.valueOf(j3));
} else {
f().v(new n6(this, bundle2));
}
} else {
g().f.c("Invalid conditional user property timeout", d().y(string), Long.valueOf(j2));
}
}
}
@WorkerThread
public final void z(d dVar) {
Boolean bool;
b();
boolean z2 = (dVar.k() && dVar.j()) || p().E();
if (z2 != this.a.i()) {
u4 u4Var = this.a;
u4Var.f().b();
u4Var.E = z2;
d4 l = l();
Objects.requireNonNull(l);
if (t8.b() && l.a.h.o(p.H0)) {
l.b();
if (l.w().contains("measurement_enabled_from_api")) {
bool = Boolean.valueOf(l.w().getBoolean("measurement_enabled_from_api", true));
if (z2 || bool == null || bool.booleanValue()) {
D(Boolean.valueOf(z2), false);
}
return;
}
}
bool = null;
if (z2) {
}
D(Boolean.valueOf(z2), false);
}
}
}