260 lines
8.6 KiB
Java
260 lines
8.6 KiB
Java
package com.google.android.gms.internal.clearcut;
|
|
|
|
import android.content.ContentResolver;
|
|
import android.content.Context;
|
|
import android.content.SharedPreferences;
|
|
import android.net.Uri;
|
|
import android.os.Binder;
|
|
import android.os.UserManager;
|
|
import android.util.Log;
|
|
import o.C17730zKa;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public abstract class zzae<T> {
|
|
private static final Object zzdn = new Object();
|
|
private static boolean zzdo = false;
|
|
private static volatile Boolean zzdp;
|
|
private static volatile Boolean zzdq;
|
|
private static Context zzh;
|
|
private final zzao zzdr;
|
|
final String zzds;
|
|
private final String zzdt;
|
|
private final T zzdu;
|
|
private T zzdv;
|
|
private volatile zzab zzdw;
|
|
private volatile SharedPreferences zzdx;
|
|
|
|
protected abstract T zza(SharedPreferences sharedPreferences);
|
|
|
|
public abstract T zzb(String str);
|
|
|
|
public final /* synthetic */ String zzo() {
|
|
return zzy.zza(zzh.getContentResolver(), this.zzdt, (String) null);
|
|
}
|
|
|
|
public final T get() {
|
|
boolean z;
|
|
if (zzh == null) {
|
|
throw new IllegalStateException("Must call PhenotypeFlag.init() first");
|
|
}
|
|
z = this.zzdr.zzek;
|
|
if (z) {
|
|
T zzm = zzm();
|
|
if (zzm != null) {
|
|
return zzm;
|
|
}
|
|
T zzl = zzl();
|
|
if (zzl != null) {
|
|
return zzl;
|
|
}
|
|
} else {
|
|
T zzl2 = zzl();
|
|
if (zzl2 != null) {
|
|
return zzl2;
|
|
}
|
|
T zzm2 = zzm();
|
|
if (zzm2 != null) {
|
|
return zzm2;
|
|
}
|
|
}
|
|
return this.zzdu;
|
|
}
|
|
|
|
private static boolean zzn() {
|
|
if (zzdp == null) {
|
|
Context context = zzh;
|
|
if (context == null) {
|
|
return false;
|
|
}
|
|
zzdp = Boolean.valueOf(C17730zKa.d(context, "com.google.android.providers.gsf.permission.READ_GSERVICES") == 0);
|
|
}
|
|
return zzdp.booleanValue();
|
|
}
|
|
|
|
private final T zzm() {
|
|
boolean z;
|
|
String str;
|
|
z = this.zzdr.zzej;
|
|
if (z || !zzn() || (str = (String) zza(new zzam(this) { // from class: com.google.android.gms.internal.clearcut.zzag
|
|
private final zzae zzdy;
|
|
|
|
@Override // com.google.android.gms.internal.clearcut.zzam
|
|
public final Object zzp() {
|
|
return this.zzdy.zzo();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
this.zzdy = this;
|
|
}
|
|
})) == null) {
|
|
return null;
|
|
}
|
|
return zzb(str);
|
|
}
|
|
|
|
private final T zzl() {
|
|
Uri uri;
|
|
String str;
|
|
String str2;
|
|
Uri uri2;
|
|
if (zza("gms:phenotype:phenotype_flag:debug_bypass_phenotype", false)) {
|
|
String valueOf = String.valueOf(this.zzds);
|
|
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.zzdr.zzeg;
|
|
if (uri != null) {
|
|
if (this.zzdw == null) {
|
|
ContentResolver contentResolver = zzh.getContentResolver();
|
|
uri2 = this.zzdr.zzeg;
|
|
this.zzdw = zzab.zza(contentResolver, uri2);
|
|
}
|
|
String str3 = (String) zza(new zzam(this, this.zzdw) { // from class: com.google.android.gms.internal.clearcut.zzaf
|
|
private final zzae zzdy;
|
|
private final zzab zzdz;
|
|
|
|
@Override // com.google.android.gms.internal.clearcut.zzam
|
|
public final Object zzp() {
|
|
return this.zzdz.zzg().get(this.zzdy.zzds);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
this.zzdy = this;
|
|
this.zzdz = r2;
|
|
}
|
|
});
|
|
if (str3 != null) {
|
|
return zzb(str3);
|
|
}
|
|
} else {
|
|
str = this.zzdr.zzef;
|
|
if (str != null) {
|
|
if (!zzh.isDeviceProtectedStorage()) {
|
|
if (zzdq == null || !zzdq.booleanValue()) {
|
|
zzdq = Boolean.valueOf(((UserManager) zzh.getSystemService(UserManager.class)).isUserUnlocked());
|
|
}
|
|
if (!zzdq.booleanValue()) {
|
|
return null;
|
|
}
|
|
}
|
|
if (this.zzdx == null) {
|
|
Context context = zzh;
|
|
str2 = this.zzdr.zzef;
|
|
this.zzdx = context.getSharedPreferences(str2, 0);
|
|
}
|
|
SharedPreferences sharedPreferences = this.zzdx;
|
|
if (sharedPreferences.contains(this.zzds)) {
|
|
return zza(sharedPreferences);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static boolean zza(String str, boolean z) {
|
|
boolean z2 = false;
|
|
if (zzn()) {
|
|
return ((Boolean) zza(new zzam(str, z2) { // from class: com.google.android.gms.internal.clearcut.zzah
|
|
private final String zzea;
|
|
private final boolean zzeb = false;
|
|
|
|
@Override // com.google.android.gms.internal.clearcut.zzam
|
|
public final Object zzp() {
|
|
Boolean valueOf;
|
|
valueOf = Boolean.valueOf(zzy.zza(zzae.zzh.getContentResolver(), this.zzea, this.zzeb));
|
|
return valueOf;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
this.zzea = str;
|
|
}
|
|
})).booleanValue();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private static <V> V zza(zzam<V> zzamVar) {
|
|
try {
|
|
return zzamVar.zzp();
|
|
} catch (SecurityException unused) {
|
|
long clearCallingIdentity = Binder.clearCallingIdentity();
|
|
try {
|
|
return zzamVar.zzp();
|
|
} finally {
|
|
Binder.restoreCallingIdentity(clearCallingIdentity);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static zzae<Boolean> zza(zzao zzaoVar, String str, boolean z) {
|
|
return new zzaj(zzaoVar, str, Boolean.valueOf(z));
|
|
}
|
|
|
|
public static zzae<String> zza(zzao zzaoVar, String str, String str2) {
|
|
return new zzak(zzaoVar, str, str2);
|
|
}
|
|
|
|
public static <T> zzae<T> zza(zzao zzaoVar, String str, T t, zzan<T> zzanVar) {
|
|
return new zzal(zzaoVar, str, t, zzanVar);
|
|
}
|
|
|
|
public static void maybeInit(Context context) {
|
|
Context applicationContext;
|
|
if (zzh == null) {
|
|
synchronized (zzdn) {
|
|
if (!context.isDeviceProtectedStorage() && (applicationContext = context.getApplicationContext()) != null) {
|
|
context = applicationContext;
|
|
}
|
|
if (zzh != context) {
|
|
zzdp = null;
|
|
}
|
|
zzh = context;
|
|
}
|
|
zzdo = false;
|
|
}
|
|
}
|
|
|
|
public /* synthetic */ zzae(zzao zzaoVar, String str, Object obj, zzai zzaiVar) {
|
|
this(zzaoVar, str, obj);
|
|
}
|
|
|
|
private zzae(zzao zzaoVar, String str, T t) {
|
|
String str2;
|
|
String str3;
|
|
String str4;
|
|
String str5;
|
|
Uri uri;
|
|
Uri uri2;
|
|
this.zzdv = null;
|
|
this.zzdw = null;
|
|
this.zzdx = null;
|
|
str2 = zzaoVar.zzef;
|
|
if (str2 == null) {
|
|
uri2 = zzaoVar.zzeg;
|
|
if (uri2 == null) {
|
|
throw new IllegalArgumentException("Must pass a valid SharedPreferences file name or ContentProvider URI");
|
|
}
|
|
}
|
|
str3 = zzaoVar.zzef;
|
|
if (str3 != null) {
|
|
uri = zzaoVar.zzeg;
|
|
if (uri != null) {
|
|
throw new IllegalArgumentException("Must pass one of SharedPreferences file name or ContentProvider URI");
|
|
}
|
|
}
|
|
this.zzdr = zzaoVar;
|
|
str4 = zzaoVar.zzeh;
|
|
String valueOf = String.valueOf(str4);
|
|
String valueOf2 = String.valueOf(str);
|
|
this.zzdt = valueOf2.length() != 0 ? valueOf.concat(valueOf2) : new String(valueOf);
|
|
str5 = zzaoVar.zzei;
|
|
String valueOf3 = String.valueOf(str5);
|
|
String valueOf4 = String.valueOf(str);
|
|
this.zzds = valueOf4.length() != 0 ? valueOf3.concat(valueOf4) : new String(valueOf3);
|
|
this.zzdu = t;
|
|
}
|
|
}
|