168 lines
5.0 KiB
Java
168 lines
5.0 KiB
Java
package com.google.android.gms.internal.measurement;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.content.ContentResolver;
|
|
import android.content.Context;
|
|
import android.net.Uri;
|
|
import android.util.Log;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class zzsi<T> {
|
|
|
|
@SuppressLint({"StaticFieldLeak"})
|
|
private static Context g;
|
|
private final zzso a;
|
|
private final String b;
|
|
private final T c;
|
|
private volatile int d;
|
|
private volatile T e;
|
|
private static final Object f = new Object();
|
|
private static final AtomicInteger h = new AtomicInteger();
|
|
|
|
private zzsi(zzso zzsoVar, String str, T t) {
|
|
Uri uri;
|
|
this.d = -1;
|
|
uri = zzsoVar.a;
|
|
if (uri == null) {
|
|
throw new IllegalArgumentException("Must pass a valid SharedPreferences file name or ContentProvider URI");
|
|
}
|
|
this.a = zzsoVar;
|
|
this.b = str;
|
|
this.c = t;
|
|
}
|
|
|
|
public static void a(Context context) {
|
|
synchronized (f) {
|
|
Context applicationContext = context.getApplicationContext();
|
|
if (applicationContext != null) {
|
|
context = applicationContext;
|
|
}
|
|
if (g != context) {
|
|
synchronized (zzrx.class) {
|
|
zzrx.f.clear();
|
|
}
|
|
synchronized (zzsp.class) {
|
|
zzsp.f.clear();
|
|
}
|
|
synchronized (zzse.class) {
|
|
zzse.b = null;
|
|
}
|
|
h.incrementAndGet();
|
|
g = context;
|
|
}
|
|
}
|
|
}
|
|
|
|
static void d() {
|
|
h.incrementAndGet();
|
|
}
|
|
|
|
private final T e() {
|
|
Uri uri;
|
|
zzsb a;
|
|
Object a2;
|
|
Uri uri2;
|
|
String str = (String) zzse.a(g).a("gms:phenotype:phenotype_flag:debug_bypass_phenotype");
|
|
if (str != null && zzru.c.matcher(str).matches()) {
|
|
String valueOf = String.valueOf(c());
|
|
Log.w("PhenotypeFlag", valueOf.length() != 0 ? "Bypass reading Phenotype values for flag: ".concat(valueOf) : new String("Bypass reading Phenotype values for flag: "));
|
|
} else {
|
|
uri = this.a.a;
|
|
if (uri != null) {
|
|
ContentResolver contentResolver = g.getContentResolver();
|
|
uri2 = this.a.a;
|
|
a = zzrx.a(contentResolver, uri2);
|
|
} else {
|
|
a = zzsp.a(g, (String) null);
|
|
}
|
|
if (a != null && (a2 = a.a(c())) != null) {
|
|
return a(a2);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private final T f() {
|
|
String str;
|
|
zzse a = zzse.a(g);
|
|
str = this.a.b;
|
|
Object a2 = a.a(a(str));
|
|
if (a2 != null) {
|
|
return a(a2);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
abstract T a(Object obj);
|
|
|
|
public final T b() {
|
|
return this.c;
|
|
}
|
|
|
|
public final String c() {
|
|
String str;
|
|
str = this.a.c;
|
|
return a(str);
|
|
}
|
|
|
|
/* synthetic */ zzsi(zzso zzsoVar, String str, Object obj, zzsj zzsjVar) {
|
|
this(zzsoVar, str, obj);
|
|
}
|
|
|
|
private final String a(String str) {
|
|
if (str != null && str.isEmpty()) {
|
|
return this.b;
|
|
}
|
|
String valueOf = String.valueOf(str);
|
|
String valueOf2 = String.valueOf(this.b);
|
|
return valueOf2.length() != 0 ? valueOf.concat(valueOf2) : new String(valueOf);
|
|
}
|
|
|
|
public final T a() {
|
|
int i = h.get();
|
|
if (this.d < i) {
|
|
synchronized (this) {
|
|
if (this.d < i) {
|
|
if (g != null) {
|
|
T e = e();
|
|
if (e == null && (e = f()) == null) {
|
|
e = this.c;
|
|
}
|
|
this.e = e;
|
|
this.d = i;
|
|
} else {
|
|
throw new IllegalStateException("Must call PhenotypeFlag.init() first");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return this.e;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static zzsi<Long> a(zzso zzsoVar, String str, long j) {
|
|
return new zzsj(zzsoVar, str, Long.valueOf(j));
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static zzsi<Integer> a(zzso zzsoVar, String str, int i) {
|
|
return new zzsk(zzsoVar, str, Integer.valueOf(i));
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static zzsi<Boolean> a(zzso zzsoVar, String str, boolean z) {
|
|
return new zzsl(zzsoVar, str, Boolean.valueOf(z));
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static zzsi<Double> a(zzso zzsoVar, String str, double d) {
|
|
return new zzsm(zzsoVar, str, Double.valueOf(d));
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static zzsi<String> a(zzso zzsoVar, String str, String str2) {
|
|
return new zzsn(zzsoVar, str, str2);
|
|
}
|
|
}
|