300 lines
11 KiB
Java
300 lines
11 KiB
Java
package c.i.a.f.h.l;
|
|
|
|
import android.app.Activity;
|
|
import android.app.Application;
|
|
import android.content.Context;
|
|
import android.content.SharedPreferences;
|
|
import android.content.pm.ApplicationInfo;
|
|
import android.content.pm.PackageManager;
|
|
import android.os.Bundle;
|
|
import android.os.RemoteException;
|
|
import android.os.SystemClock;
|
|
import android.util.Log;
|
|
import android.util.Pair;
|
|
import androidx.annotation.GuardedBy;
|
|
import c.c.a.a0.d;
|
|
import c.i.a.f.e.o.f;
|
|
import c.i.a.f.i.b.z5;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
import java.util.concurrent.TimeUnit;
|
|
/* compiled from: com.google.android.gms:play-services-measurement-sdk-api@@18.0.0 */
|
|
public class g {
|
|
public static volatile g a;
|
|
public static Boolean b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final String f1133c;
|
|
public final c.i.a.f.e.o.b d;
|
|
public final ExecutorService e;
|
|
public final c.i.a.f.i.a.a f;
|
|
@GuardedBy("listenerList")
|
|
public final List<Pair<z5, c>> g;
|
|
public int h;
|
|
public boolean i;
|
|
public volatile ec j;
|
|
|
|
/* compiled from: com.google.android.gms:play-services-measurement-sdk-api@@18.0.0 */
|
|
public abstract class a implements Runnable {
|
|
public final long i = System.currentTimeMillis();
|
|
public final long j;
|
|
public final boolean k;
|
|
|
|
public a(boolean z2) {
|
|
Objects.requireNonNull((c.i.a.f.e.o.c) g.this.d);
|
|
Objects.requireNonNull((c.i.a.f.e.o.c) g.this.d);
|
|
this.j = SystemClock.elapsedRealtime();
|
|
this.k = z2;
|
|
}
|
|
|
|
public abstract void a() throws RemoteException;
|
|
|
|
public void b() {
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (g.this.i) {
|
|
b();
|
|
return;
|
|
}
|
|
try {
|
|
a();
|
|
} catch (Exception e) {
|
|
g.this.b(e, false, this.k);
|
|
b();
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: com.google.android.gms:play-services-measurement-sdk-api@@18.0.0 */
|
|
public class b implements Application.ActivityLifecycleCallbacks {
|
|
public b() {
|
|
}
|
|
|
|
@Override // android.app.Application.ActivityLifecycleCallbacks
|
|
public final void onActivityCreated(Activity activity, Bundle bundle) {
|
|
g gVar = g.this;
|
|
gVar.e.execute(new e0(this, bundle, activity));
|
|
}
|
|
|
|
@Override // android.app.Application.ActivityLifecycleCallbacks
|
|
public final void onActivityDestroyed(Activity activity) {
|
|
g gVar = g.this;
|
|
gVar.e.execute(new j0(this, activity));
|
|
}
|
|
|
|
@Override // android.app.Application.ActivityLifecycleCallbacks
|
|
public final void onActivityPaused(Activity activity) {
|
|
g gVar = g.this;
|
|
gVar.e.execute(new f0(this, activity));
|
|
}
|
|
|
|
@Override // android.app.Application.ActivityLifecycleCallbacks
|
|
public final void onActivityResumed(Activity activity) {
|
|
g gVar = g.this;
|
|
gVar.e.execute(new g0(this, activity));
|
|
}
|
|
|
|
@Override // android.app.Application.ActivityLifecycleCallbacks
|
|
public final void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
|
|
cc ccVar = new cc();
|
|
g gVar = g.this;
|
|
gVar.e.execute(new h0(this, activity, ccVar));
|
|
Bundle x0 = ccVar.x0(50);
|
|
if (x0 != null) {
|
|
bundle.putAll(x0);
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Application.ActivityLifecycleCallbacks
|
|
public final void onActivityStarted(Activity activity) {
|
|
g gVar = g.this;
|
|
gVar.e.execute(new d0(this, activity));
|
|
}
|
|
|
|
@Override // android.app.Application.ActivityLifecycleCallbacks
|
|
public final void onActivityStopped(Activity activity) {
|
|
g gVar = g.this;
|
|
gVar.e.execute(new i0(this, activity));
|
|
}
|
|
}
|
|
|
|
/* compiled from: com.google.android.gms:play-services-measurement-sdk-api@@18.0.0 */
|
|
public static class c extends b {
|
|
public final z5 a;
|
|
|
|
public c(z5 z5Var) {
|
|
this.a = z5Var;
|
|
}
|
|
|
|
@Override // c.i.a.f.h.l.c
|
|
public final void Z(String str, String str2, Bundle bundle, long j) {
|
|
this.a.a(str, str2, bundle, j);
|
|
}
|
|
|
|
@Override // c.i.a.f.h.l.c
|
|
public final int a() {
|
|
return System.identityHashCode(this.a);
|
|
}
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:14:0x0053 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:24:0x0063 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:26:0x006d */
|
|
public g(Context context, String str, String str2, String str3, Bundle bundle) {
|
|
boolean z2;
|
|
boolean z3;
|
|
boolean z4;
|
|
if (str == null || !e(str2, str3)) {
|
|
this.f1133c = "FA";
|
|
} else {
|
|
this.f1133c = str;
|
|
}
|
|
this.d = c.i.a.f.e.o.c.a;
|
|
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, new LinkedBlockingQueue(), new o());
|
|
boolean z5 = true;
|
|
threadPoolExecutor.allowCoreThreadTimeOut(true);
|
|
this.e = Executors.unconfigurableExecutorService(threadPoolExecutor);
|
|
this.f = new c.i.a.f.i.a.a(this);
|
|
this.g = new ArrayList();
|
|
try {
|
|
if (f.D1(context, "google_app_id") != null) {
|
|
z2 = true;
|
|
if (z2) {
|
|
try {
|
|
Class.forName("com.google.firebase.analytics.FirebaseAnalytics");
|
|
z4 = true;
|
|
} catch (ClassNotFoundException unused) {
|
|
z4 = false;
|
|
}
|
|
if (!z4) {
|
|
z3 = false;
|
|
if (!z3) {
|
|
this.i = true;
|
|
Log.w(this.f1133c, "Disabling data collection. Found google_app_id in strings.xml but Google Analytics for Firebase is missing. Remove this value or add Google Analytics for Firebase to resume data collection.");
|
|
return;
|
|
}
|
|
if (!e(str2, str3)) {
|
|
if (str2 == null || str3 == null) {
|
|
if ((str2 == null) ^ (str3 != null ? false : z5)) {
|
|
Log.w(this.f1133c, "Specified origin or custom app id is null. Both parameters will be ignored.");
|
|
}
|
|
} else {
|
|
Log.v(this.f1133c, "Deferring to Google Analytics for Firebase for event data collection. https://goo.gl/J1sWQy");
|
|
}
|
|
}
|
|
this.e.execute(new j(this, str2, str3, context, bundle));
|
|
Application application = (Application) context.getApplicationContext();
|
|
if (application == null) {
|
|
Log.w(this.f1133c, "Unable to register lifecycle notifications. Application null.");
|
|
return;
|
|
} else {
|
|
application.registerActivityLifecycleCallbacks(new b());
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
z3 = true;
|
|
if (!z3) {
|
|
}
|
|
}
|
|
} catch (IllegalStateException unused2) {
|
|
}
|
|
z2 = false;
|
|
if (z2) {
|
|
}
|
|
z3 = true;
|
|
if (!z3) {
|
|
}
|
|
}
|
|
|
|
public static g a(Context context, String str, String str2, String str3, Bundle bundle) {
|
|
Objects.requireNonNull(context, "null reference");
|
|
if (a == null) {
|
|
synchronized (g.class) {
|
|
if (a == null) {
|
|
a = new g(context, null, null, null, bundle);
|
|
}
|
|
}
|
|
}
|
|
return a;
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:18:0x002c */
|
|
/* JADX WARNING: Removed duplicated region for block: B:20:0x0032 */
|
|
public static void d(Context context) {
|
|
boolean z2;
|
|
synchronized (g.class) {
|
|
try {
|
|
if (b == null) {
|
|
d.w("app_measurement_internal_disable_startup_flags");
|
|
try {
|
|
ApplicationInfo a2 = c.i.a.f.e.p.b.a(context).a(context.getPackageName(), 128);
|
|
if (a2 != null) {
|
|
Bundle bundle = a2.metaData;
|
|
if (bundle != null) {
|
|
z2 = bundle.getBoolean("app_measurement_internal_disable_startup_flags");
|
|
if (!z2) {
|
|
b = Boolean.TRUE;
|
|
return;
|
|
}
|
|
SharedPreferences sharedPreferences = context.getSharedPreferences("com.google.android.gms.measurement.prefs", 0);
|
|
b = Boolean.valueOf(sharedPreferences.getBoolean("allow_remote_dynamite", true));
|
|
SharedPreferences.Editor edit = sharedPreferences.edit();
|
|
edit.remove("allow_remote_dynamite");
|
|
edit.apply();
|
|
return;
|
|
}
|
|
}
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
}
|
|
z2 = false;
|
|
if (!z2) {
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
Log.e("FA", "Exception reading flag from SharedPreferences.", e);
|
|
b = Boolean.TRUE;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static boolean e(String str, String str2) {
|
|
boolean z2;
|
|
if (!(str2 == null || str == null)) {
|
|
try {
|
|
Class.forName("com.google.firebase.analytics.FirebaseAnalytics");
|
|
z2 = true;
|
|
} catch (ClassNotFoundException unused) {
|
|
z2 = false;
|
|
}
|
|
if (!z2) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final void b(Exception exc, boolean z2, boolean z3) {
|
|
this.i |= z2;
|
|
if (z2) {
|
|
Log.w(this.f1133c, "Data collection startup failed. No data will be collected.", exc);
|
|
return;
|
|
}
|
|
if (z3) {
|
|
this.e.execute(new y(this, "Error with data collection. Data lost.", exc));
|
|
}
|
|
Log.w(this.f1133c, "Error with data collection. Data lost.", exc);
|
|
}
|
|
|
|
public final void c(String str, String str2, Bundle bundle, boolean z2, boolean z3, Long l) {
|
|
this.e.execute(new c0(this, null, str, str2, bundle, z2, z3));
|
|
}
|
|
}
|