511 lines
15 KiB
Java
511 lines
15 KiB
Java
package com.google.android.gms.measurement.internal;
|
|
|
|
import android.app.Application;
|
|
import android.content.Context;
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import com.google.android.gms.common.api.internal.GoogleServices;
|
|
import com.google.android.gms.common.internal.Preconditions;
|
|
import com.google.android.gms.common.util.Clock;
|
|
import com.google.android.gms.common.util.DefaultClock;
|
|
import com.google.android.gms.common.wrappers.Wrappers;
|
|
import com.google.android.gms.internal.measurement.zzsi;
|
|
import com.google.android.gms.measurement.AppMeasurement;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class zzbw implements zzct {
|
|
private static volatile zzbw G;
|
|
private volatile Boolean A;
|
|
private Boolean B;
|
|
private Boolean C;
|
|
private int D;
|
|
private final long F;
|
|
private final Context a;
|
|
private final String b;
|
|
private final String c;
|
|
private final String d;
|
|
private final boolean e;
|
|
private final zzn f;
|
|
private final zzq g;
|
|
private final zzbd h;
|
|
private final zzas i;
|
|
private final zzbr j;
|
|
private final zzfd k;
|
|
private final AppMeasurement l;
|
|
private final zzfy m;
|
|
private final zzaq n;
|
|
private final Clock o;
|
|
private final zzdy p;
|
|
private final zzda q;
|
|
private final zza r;
|
|
private zzao s;
|
|
private zzeb t;
|
|
private zzaa u;
|
|
private zzam v;
|
|
private zzbj w;
|
|
private Boolean y;
|
|
private long z;
|
|
private boolean x = false;
|
|
private AtomicInteger E = new AtomicInteger(0);
|
|
|
|
private zzbw(zzcz zzczVar) {
|
|
Bundle bundle;
|
|
Preconditions.a(zzczVar);
|
|
this.f = new zzn(zzczVar.a);
|
|
zzai.a(this.f);
|
|
this.a = zzczVar.a;
|
|
this.b = zzczVar.b;
|
|
this.c = zzczVar.c;
|
|
this.d = zzczVar.d;
|
|
this.e = zzczVar.e;
|
|
this.A = zzczVar.f;
|
|
zzan zzanVar = zzczVar.g;
|
|
if (zzanVar != null && (bundle = zzanVar.g) != null) {
|
|
Object obj = bundle.get("measurementEnabled");
|
|
if (obj instanceof Boolean) {
|
|
this.B = (Boolean) obj;
|
|
}
|
|
Object obj2 = zzanVar.g.get("measurementDeactivated");
|
|
if (obj2 instanceof Boolean) {
|
|
this.C = (Boolean) obj2;
|
|
}
|
|
}
|
|
zzsi.a(this.a);
|
|
this.o = DefaultClock.d();
|
|
this.F = this.o.a();
|
|
this.g = new zzq(this);
|
|
zzbd zzbdVar = new zzbd(this);
|
|
zzbdVar.s();
|
|
this.h = zzbdVar;
|
|
zzas zzasVar = new zzas(this);
|
|
zzasVar.s();
|
|
this.i = zzasVar;
|
|
zzfy zzfyVar = new zzfy(this);
|
|
zzfyVar.s();
|
|
this.m = zzfyVar;
|
|
zzaq zzaqVar = new zzaq(this);
|
|
zzaqVar.s();
|
|
this.n = zzaqVar;
|
|
this.r = new zza(this);
|
|
zzdy zzdyVar = new zzdy(this);
|
|
zzdyVar.A();
|
|
this.p = zzdyVar;
|
|
zzda zzdaVar = new zzda(this);
|
|
zzdaVar.A();
|
|
this.q = zzdaVar;
|
|
this.l = new AppMeasurement(this);
|
|
zzfd zzfdVar = new zzfd(this);
|
|
zzfdVar.A();
|
|
this.k = zzfdVar;
|
|
zzbr zzbrVar = new zzbr(this);
|
|
zzbrVar.s();
|
|
this.j = zzbrVar;
|
|
if (this.a.getApplicationContext() instanceof Application) {
|
|
zzda k = k();
|
|
if (k.b().getApplicationContext() instanceof Application) {
|
|
Application application = (Application) k.b().getApplicationContext();
|
|
if (k.c == null) {
|
|
k.c = new zzdu(k, null);
|
|
}
|
|
application.unregisterActivityLifecycleCallbacks(k.c);
|
|
application.registerActivityLifecycleCallbacks(k.c);
|
|
k.e().B().a("Registered activity lifecycle callback");
|
|
}
|
|
} else {
|
|
e().w().a("Application context is not an Application");
|
|
}
|
|
this.j.a(new zzbx(this, zzczVar));
|
|
}
|
|
|
|
private final void I() {
|
|
if (!this.x) {
|
|
throw new IllegalStateException("AppMeasurement is not initialized");
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final void a(zzcz zzczVar) {
|
|
zzau z;
|
|
String concat;
|
|
a().f();
|
|
zzq.t();
|
|
zzaa zzaaVar = new zzaa(this);
|
|
zzaaVar.s();
|
|
this.u = zzaaVar;
|
|
zzam zzamVar = new zzam(this);
|
|
zzamVar.A();
|
|
this.v = zzamVar;
|
|
zzao zzaoVar = new zzao(this);
|
|
zzaoVar.A();
|
|
this.s = zzaoVar;
|
|
zzeb zzebVar = new zzeb(this);
|
|
zzebVar.A();
|
|
this.t = zzebVar;
|
|
this.m.p();
|
|
this.h.p();
|
|
this.w = new zzbj(this);
|
|
this.v.x();
|
|
e().z().a("App measurement is starting up, version", Long.valueOf(this.g.o()));
|
|
e().z().a("To enable debug logging run: adb shell setprop log.tag.FA VERBOSE");
|
|
String C = zzamVar.C();
|
|
if (TextUtils.isEmpty(this.b)) {
|
|
if (s().c(C)) {
|
|
z = e().z();
|
|
concat = "Faster debug mode event logging enabled. To disable, run:\n adb shell setprop debug.firebase.analytics.app .none.";
|
|
} else {
|
|
z = e().z();
|
|
String valueOf = String.valueOf(C);
|
|
concat = valueOf.length() != 0 ? "To enable faster debug mode event logging run:\n adb shell setprop debug.firebase.analytics.app ".concat(valueOf) : new String("To enable faster debug mode event logging run:\n adb shell setprop debug.firebase.analytics.app ");
|
|
}
|
|
z.a(concat);
|
|
}
|
|
e().A().a("Debug-level message logging enabled");
|
|
if (this.D != this.E.get()) {
|
|
e().t().a("Not all components initialized", Integer.valueOf(this.D), Integer.valueOf(this.E.get()));
|
|
}
|
|
this.x = true;
|
|
}
|
|
|
|
public final String A() {
|
|
return this.b;
|
|
}
|
|
|
|
public final String B() {
|
|
return this.c;
|
|
}
|
|
|
|
public final String C() {
|
|
return this.d;
|
|
}
|
|
|
|
public final boolean D() {
|
|
return this.e;
|
|
}
|
|
|
|
public final boolean E() {
|
|
return this.A != null && this.A.booleanValue();
|
|
}
|
|
|
|
final long F() {
|
|
Long valueOf = Long.valueOf(t().j.a());
|
|
return valueOf.longValue() == 0 ? this.F : Math.min(this.F, valueOf.longValue());
|
|
}
|
|
|
|
final void G() {
|
|
this.E.incrementAndGet();
|
|
}
|
|
|
|
protected final boolean H() {
|
|
I();
|
|
a().f();
|
|
Boolean bool = this.y;
|
|
if (bool == null || this.z == 0 || (bool != null && !bool.booleanValue() && Math.abs(this.o.b() - this.z) > 1000)) {
|
|
this.z = this.o.b();
|
|
boolean z = true;
|
|
this.y = Boolean.valueOf(s().d("android.permission.INTERNET") && s().d("android.permission.ACCESS_NETWORK_STATE") && (Wrappers.a(this.a).a() || this.g.s() || (zzbm.a(this.a) && zzfy.a(this.a, false))));
|
|
if (this.y.booleanValue()) {
|
|
if (!s().c(l().B(), l().D()) && TextUtils.isEmpty(l().D())) {
|
|
z = false;
|
|
}
|
|
this.y = Boolean.valueOf(z);
|
|
}
|
|
}
|
|
return this.y.booleanValue();
|
|
}
|
|
|
|
@Override // com.google.android.gms.measurement.internal.zzct
|
|
public final Context b() {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // com.google.android.gms.measurement.internal.zzct
|
|
public final zzn c() {
|
|
return this.f;
|
|
}
|
|
|
|
@Override // com.google.android.gms.measurement.internal.zzct
|
|
public final Clock d() {
|
|
return this.o;
|
|
}
|
|
|
|
@Override // com.google.android.gms.measurement.internal.zzct
|
|
public final zzas e() {
|
|
b(this.i);
|
|
return this.i;
|
|
}
|
|
|
|
public final boolean f() {
|
|
boolean z;
|
|
a().f();
|
|
I();
|
|
if (!this.g.a(zzai.m0)) {
|
|
if (this.g.p()) {
|
|
return false;
|
|
}
|
|
Boolean q = this.g.q();
|
|
if (q != null) {
|
|
z = q.booleanValue();
|
|
} else {
|
|
z = !GoogleServices.b();
|
|
if (z && this.A != null && zzai.j0.a().booleanValue()) {
|
|
z = this.A.booleanValue();
|
|
}
|
|
}
|
|
return t().c(z);
|
|
}
|
|
if (this.g.p()) {
|
|
return false;
|
|
}
|
|
Boolean bool = this.C;
|
|
if (bool != null && bool.booleanValue()) {
|
|
return false;
|
|
}
|
|
Boolean x = t().x();
|
|
if (x != null) {
|
|
return x.booleanValue();
|
|
}
|
|
Boolean q2 = this.g.q();
|
|
if (q2 != null) {
|
|
return q2.booleanValue();
|
|
}
|
|
Boolean bool2 = this.B;
|
|
if (bool2 != null) {
|
|
return bool2.booleanValue();
|
|
}
|
|
if (GoogleServices.b()) {
|
|
return false;
|
|
}
|
|
if (!this.g.a(zzai.j0) || this.A == null) {
|
|
return true;
|
|
}
|
|
return this.A.booleanValue();
|
|
}
|
|
|
|
protected final void g() {
|
|
a().f();
|
|
if (t().e.a() == 0) {
|
|
t().e.a(this.o.a());
|
|
}
|
|
if (Long.valueOf(t().j.a()).longValue() == 0) {
|
|
e().B().a("Persisting first open", Long.valueOf(this.F));
|
|
t().j.a(this.F);
|
|
}
|
|
if (!H()) {
|
|
if (f()) {
|
|
if (!s().d("android.permission.INTERNET")) {
|
|
e().t().a("App is missing INTERNET permission");
|
|
}
|
|
if (!s().d("android.permission.ACCESS_NETWORK_STATE")) {
|
|
e().t().a("App is missing ACCESS_NETWORK_STATE permission");
|
|
}
|
|
if (!Wrappers.a(this.a).a() && !this.g.s()) {
|
|
if (!zzbm.a(this.a)) {
|
|
e().t().a("AppMeasurementReceiver not registered/enabled");
|
|
}
|
|
if (!zzfy.a(this.a, false)) {
|
|
e().t().a("AppMeasurementService not registered/enabled");
|
|
}
|
|
}
|
|
e().t().a("Uploading is not possible. App measurement disabled");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
if (!TextUtils.isEmpty(l().B()) || !TextUtils.isEmpty(l().D())) {
|
|
s();
|
|
if (zzfy.a(l().B(), t().t(), l().D(), t().u())) {
|
|
e().z().a("Rechecking which service to use due to a GMP App Id change");
|
|
t().w();
|
|
o().B();
|
|
this.t.B();
|
|
this.t.D();
|
|
t().j.a(this.F);
|
|
t().l.a(null);
|
|
}
|
|
t().c(l().B());
|
|
t().d(l().D());
|
|
if (this.g.q(l().C())) {
|
|
this.k.a(this.F);
|
|
}
|
|
}
|
|
k().a(t().l.a());
|
|
if (TextUtils.isEmpty(l().B()) && TextUtils.isEmpty(l().D())) {
|
|
return;
|
|
}
|
|
boolean f = f();
|
|
if (!t().A() && !this.g.p()) {
|
|
t().d(!f);
|
|
}
|
|
if (!this.g.i(l().C()) || f) {
|
|
k().F();
|
|
}
|
|
m().a(new AtomicReference<>());
|
|
}
|
|
|
|
final void h() {
|
|
throw new IllegalStateException("Unexpected call on client side");
|
|
}
|
|
|
|
final void i() {
|
|
}
|
|
|
|
public final zza j() {
|
|
zza zzaVar = this.r;
|
|
if (zzaVar != null) {
|
|
return zzaVar;
|
|
}
|
|
throw new IllegalStateException("Component not created");
|
|
}
|
|
|
|
public final zzda k() {
|
|
b(this.q);
|
|
return this.q;
|
|
}
|
|
|
|
public final zzam l() {
|
|
b(this.v);
|
|
return this.v;
|
|
}
|
|
|
|
public final zzeb m() {
|
|
b(this.t);
|
|
return this.t;
|
|
}
|
|
|
|
public final zzdy n() {
|
|
b(this.p);
|
|
return this.p;
|
|
}
|
|
|
|
public final zzao o() {
|
|
b(this.s);
|
|
return this.s;
|
|
}
|
|
|
|
public final zzfd p() {
|
|
b(this.k);
|
|
return this.k;
|
|
}
|
|
|
|
public final zzaa q() {
|
|
b(this.u);
|
|
return this.u;
|
|
}
|
|
|
|
public final zzaq r() {
|
|
a((zzcr) this.n);
|
|
return this.n;
|
|
}
|
|
|
|
public final zzfy s() {
|
|
a((zzcr) this.m);
|
|
return this.m;
|
|
}
|
|
|
|
public final zzbd t() {
|
|
a((zzcr) this.h);
|
|
return this.h;
|
|
}
|
|
|
|
public final zzq u() {
|
|
return this.g;
|
|
}
|
|
|
|
public final zzas v() {
|
|
zzas zzasVar = this.i;
|
|
if (zzasVar == null || !zzasVar.n()) {
|
|
return null;
|
|
}
|
|
return this.i;
|
|
}
|
|
|
|
public final zzbj w() {
|
|
return this.w;
|
|
}
|
|
|
|
final zzbr x() {
|
|
return this.j;
|
|
}
|
|
|
|
public final AppMeasurement y() {
|
|
return this.l;
|
|
}
|
|
|
|
public final boolean z() {
|
|
return TextUtils.isEmpty(this.b);
|
|
}
|
|
|
|
private static void b(zzcs zzcsVar) {
|
|
if (zzcsVar == null) {
|
|
throw new IllegalStateException("Component not created");
|
|
}
|
|
if (zzcsVar.n()) {
|
|
return;
|
|
}
|
|
String valueOf = String.valueOf(zzcsVar.getClass());
|
|
StringBuilder sb = new StringBuilder(String.valueOf(valueOf).length() + 27);
|
|
sb.append("Component not initialized: ");
|
|
sb.append(valueOf);
|
|
throw new IllegalStateException(sb.toString());
|
|
}
|
|
|
|
private static void b(zzf zzfVar) {
|
|
if (zzfVar != null) {
|
|
if (zzfVar.v()) {
|
|
return;
|
|
}
|
|
String valueOf = String.valueOf(zzfVar.getClass());
|
|
StringBuilder sb = new StringBuilder(String.valueOf(valueOf).length() + 27);
|
|
sb.append("Component not initialized: ");
|
|
sb.append(valueOf);
|
|
throw new IllegalStateException(sb.toString());
|
|
}
|
|
throw new IllegalStateException("Component not created");
|
|
}
|
|
|
|
@Override // com.google.android.gms.measurement.internal.zzct
|
|
public final zzbr a() {
|
|
b(this.j);
|
|
return this.j;
|
|
}
|
|
|
|
public static zzbw a(Context context, zzan zzanVar) {
|
|
Bundle bundle;
|
|
if (zzanVar != null && (zzanVar.e == null || zzanVar.f == null)) {
|
|
zzanVar = new zzan(zzanVar.a, zzanVar.b, zzanVar.c, zzanVar.d, null, null, zzanVar.g);
|
|
}
|
|
Preconditions.a(context);
|
|
Preconditions.a(context.getApplicationContext());
|
|
if (G == null) {
|
|
synchronized (zzbw.class) {
|
|
if (G == null) {
|
|
G = new zzbw(new zzcz(context, zzanVar));
|
|
}
|
|
}
|
|
} else if (zzanVar != null && (bundle = zzanVar.g) != null && bundle.containsKey("dataCollectionDefaultEnabled")) {
|
|
G.a(zzanVar.g.getBoolean("dataCollectionDefaultEnabled"));
|
|
}
|
|
return G;
|
|
}
|
|
|
|
private static void a(zzcr zzcrVar) {
|
|
if (zzcrVar == null) {
|
|
throw new IllegalStateException("Component not created");
|
|
}
|
|
}
|
|
|
|
final void a(boolean z) {
|
|
this.A = Boolean.valueOf(z);
|
|
}
|
|
|
|
final void a(zzcs zzcsVar) {
|
|
this.D++;
|
|
}
|
|
|
|
final void a(zzf zzfVar) {
|
|
this.D++;
|
|
}
|
|
}
|