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

229 lines
7.2 KiB
Java

package c.i.a.f.i.b;
import android.app.Activity;
import android.os.Bundle;
import android.os.SystemClock;
import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import androidx.annotation.WorkerThread;
import c.i.a.f.e.o.d;
import c.i.a.f.h.l.s9;
import c.i.a.f.h.l.v9;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
/* compiled from: com.google.android.gms:play-services-measurement-impl@@18.0.0 */
public final class h7 extends a5 {
/* renamed from: c reason: collision with root package name */
public volatile i7 f1154c;
public i7 d;
public i7 e;
public final Map<Activity, i7> f = new ConcurrentHashMap();
public Activity g;
public volatile boolean h;
public volatile i7 i;
public i7 j;
public boolean k;
public final Object l = new Object();
public String m;
public h7(u4 u4Var) {
super(u4Var);
}
public static void A(i7 i7Var, Bundle bundle, boolean z2) {
if (i7Var != null && (!bundle.containsKey("_sc") || z2)) {
String str = i7Var.a;
if (str != null) {
bundle.putString("_sn", str);
} else {
bundle.remove("_sn");
}
String str2 = i7Var.b;
if (str2 != null) {
bundle.putString("_sc", str2);
} else {
bundle.remove("_sc");
}
bundle.putLong("_si", i7Var.f1157c);
} else if (i7Var == null && z2) {
bundle.remove("_sn");
bundle.remove("_sc");
bundle.remove("_si");
}
}
public static String x(String str) {
String[] split = str.split("\\.");
String str2 = split.length > 0 ? split[split.length - 1] : "";
return str2.length() > 100 ? str2.substring(0, 100) : str2;
}
/* JADX WARNING: Removed duplicated region for block: B:60:0x010d */
/* JADX WARNING: Removed duplicated region for block: B:67:0x0131 */
@WorkerThread
public final void B(i7 i7Var, i7 i7Var2, long j, boolean z2, Bundle bundle) {
boolean z3;
String str;
long j2;
long j3;
i7 i7Var3;
b();
boolean z4 = false;
if (this.a.h.o(p.T)) {
z3 = z2 && this.e != null;
if (z3) {
C(this.e, true, j);
}
} else {
if (z2 && (i7Var3 = this.e) != null) {
C(i7Var3, true, j);
}
z3 = false;
}
if (i7Var2 == null || i7Var2.f1157c != i7Var.f1157c || !t9.q0(i7Var2.b, i7Var.b) || !t9.q0(i7Var2.a, i7Var.a)) {
z4 = true;
}
if (z4) {
Bundle bundle2 = new Bundle();
if (this.a.h.o(p.v0)) {
bundle2 = bundle != null ? new Bundle(bundle) : new Bundle();
}
A(i7Var, bundle2, true);
if (i7Var2 != null) {
String str2 = i7Var2.a;
if (str2 != null) {
bundle2.putString("_pn", str2);
}
String str3 = i7Var2.b;
if (str3 != null) {
bundle2.putString("_pc", str3);
}
bundle2.putLong("_pi", i7Var2.f1157c);
}
if (this.a.h.o(p.T) && z3) {
if (!((v9) s9.i.a()).a() || !this.a.h.o(p.V)) {
j3 = s().e.b();
} else {
d9 d9Var = s().e;
j3 = j - d9Var.b;
d9Var.b = j;
}
if (j3 > 0) {
e().G(bundle2, j3);
}
}
if (this.a.h.o(p.v0)) {
if (!this.a.h.z().booleanValue()) {
bundle2.putLong("_mst", 1);
}
if (i7Var.e) {
str = "app";
if (!this.a.h.o(p.v0)) {
Objects.requireNonNull((d) this.a.o);
long currentTimeMillis = System.currentTimeMillis();
if (i7Var.e) {
long j4 = i7Var.f;
if (j4 != 0) {
j2 = j4;
n().E(str, "_vs", j2, bundle2);
}
}
j2 = currentTimeMillis;
n().E(str, "_vs", j2, bundle2);
} else {
c6 n = n();
n.b();
Objects.requireNonNull((d) n.a.o);
n.E(str, "_vs", System.currentTimeMillis(), bundle2);
}
}
}
str = "auto";
if (!this.a.h.o(p.v0)) {
}
}
this.e = i7Var;
if (this.a.h.o(p.v0) && i7Var.e) {
this.j = i7Var;
}
q7 p = p();
p.b();
p.t();
p.z(new w7(p, i7Var));
}
@WorkerThread
public final void C(i7 i7Var, boolean z2, long j) {
a m = m();
Objects.requireNonNull((d) this.a.o);
m.t(SystemClock.elapsedRealtime());
if (s().w(i7Var != null && i7Var.d, z2, j) && i7Var != null) {
i7Var.d = false;
}
}
@WorkerThread
public final void D(String str, i7 i7Var) {
b();
synchronized (this) {
String str2 = this.m;
if (str2 == null || str2.equals(str)) {
this.m = str;
}
}
}
@MainThread
public final i7 E(@NonNull Activity activity) {
Objects.requireNonNull(activity, "null reference");
i7 i7Var = this.f.get(activity);
if (i7Var == null) {
i7 i7Var2 = new i7(null, x(activity.getClass().getCanonicalName()), e().t0());
this.f.put(activity, i7Var2);
i7Var = i7Var2;
}
return (this.a.h.o(p.v0) && this.i != null) ? this.i : i7Var;
}
@Override // c.i.a.f.i.b.a5
public final boolean v() {
return false;
}
@WorkerThread
public final i7 w(boolean z2) {
t();
b();
if (!this.a.h.o(p.v0) || !z2) {
return this.e;
}
i7 i7Var = this.e;
return i7Var != null ? i7Var : this.j;
}
@MainThread
public final void y(Activity activity, Bundle bundle) {
Bundle bundle2;
if (this.a.h.z().booleanValue() && bundle != null && (bundle2 = bundle.getBundle("com.google.app_measurement.screen_service")) != null) {
this.f.put(activity, new i7(bundle2.getString("name"), bundle2.getString("referrer_name"), bundle2.getLong("id")));
}
}
@MainThread
public final void z(Activity activity, i7 i7Var, boolean z2) {
i7 i7Var2;
i7 i7Var3 = this.f1154c == null ? this.d : this.f1154c;
if (i7Var.b == null) {
i7Var2 = new i7(i7Var.a, activity != null ? x(activity.getClass().getCanonicalName()) : null, i7Var.f1157c, i7Var.e, i7Var.f);
} else {
i7Var2 = i7Var;
}
this.d = this.f1154c;
this.f1154c = i7Var2;
Objects.requireNonNull((d) this.a.o);
f().v(new j7(this, i7Var2, i7Var3, SystemClock.elapsedRealtime(), z2));
}
}