package com.google.android.gms.internal.measurement; import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.base.Preconditions; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; /* loaded from: classes3.dex */ public abstract class zzgw { private static final Object zza = new Object(); private static volatile zzhh zzb; private static volatile boolean zzc; private static zzhl zzd; private static final AtomicInteger zze; private final zzhe zzf; private final String zzg; private Object zzh; private volatile int zzi; private volatile T zzj; private final boolean zzk; private volatile boolean zzl; public static /* synthetic */ boolean zzd() { return true; } private final T zze() { return (T) this.zzh; } public abstract T zza(Object obj); public static /* synthetic */ zzgw zza(zzhe zzheVar, String str, Boolean bool, boolean z) { return new zzhd(zzheVar, str, bool, true); } public static /* synthetic */ zzgw zza(zzhe zzheVar, String str, Double d, boolean z) { return new zzhc(zzheVar, str, d, true); } public static /* synthetic */ zzgw zza(zzhe zzheVar, String str, Long l, boolean z) { return new zzha(zzheVar, str, l, true); } public static /* synthetic */ zzgw zza(zzhe zzheVar, String str, String str2, boolean z) { return new zzhf(zzheVar, str, str2, true); } public final T zza() { T zzb2; if (!this.zzk) { Preconditions.checkState(zzd.zza(this.zzg), "Attempt to access PhenotypeFlag not via codegen. All new PhenotypeFlags must be accessed through codegen APIs. If you believe you are seeing this error by mistake, you can add your flag to the exemption list located at //java/com/google/android/libraries/phenotype/client/lockdown/flags.textproto. Send the addition CL to ph-reviews@. See go/phenotype-android-codegen for information about generated code. See go/ph-lockdown for more information about this error."); } int i = zze.get(); if (this.zzi < i) { synchronized (this) { try { if (this.zzi < i) { zzhh zzhhVar = zzb; Optional absent = Optional.absent(); String str = null; if (zzhhVar != null) { absent = (Optional) zzhhVar.zzb().get(); if (absent.isPresent()) { zzgu zzguVar = (zzgu) absent.get(); zzhe zzheVar = this.zzf; str = zzguVar.zza(zzheVar.zzb, zzheVar.zza, zzheVar.zzd, this.zzg); } } Preconditions.checkState(zzhhVar != null, "Must call PhenotypeFlagInitializer.maybeInit() first"); if (!this.zzf.zzf ? (zzb2 = zzb(zzhhVar)) == null && (zzb2 = zza(zzhhVar)) == null : (zzb2 = zza(zzhhVar)) == null && (zzb2 = zzb(zzhhVar)) == null) { zzb2 = zze(); } if (absent.isPresent()) { zzb2 = str == null ? zze() : zza((Object) str); } this.zzj = zzb2; this.zzi = i; } } finally { } } } return this.zzj; } private final T zza(zzhh zzhhVar) { Function function; zzhe zzheVar = this.zzf; if (!zzheVar.zze && ((function = zzheVar.zzh) == null || ((Boolean) function.apply(zzhhVar.zza())).booleanValue())) { zzgp zza2 = zzgp.zza(zzhhVar.zza()); zzhe zzheVar2 = this.zzf; Object zza3 = zza2.zza(zzheVar2.zze ? null : zza(zzheVar2.zzc)); if (zza3 != null) { return zza(zza3); } } return null; } private final T zzb(zzhh zzhhVar) { zzgo zza2; Object zza3; if (this.zzf.zzb != null) { if (!zzgv.zza(zzhhVar.zza(), this.zzf.zzb)) { zza2 = null; } else if (this.zzf.zzg) { zza2 = zzgh.zza(zzhhVar.zza().getContentResolver(), zzgx.zza(zzgx.zza(zzhhVar.zza(), this.zzf.zzb.getLastPathSegment())), new Runnable() { // from class: com.google.android.gms.internal.measurement.zzgz @Override // java.lang.Runnable public final void run() { zzgw.zzc(); } }); } else { zza2 = zzgh.zza(zzhhVar.zza().getContentResolver(), this.zzf.zzb, new Runnable() { // from class: com.google.android.gms.internal.measurement.zzgz @Override // java.lang.Runnable public final void run() { zzgw.zzc(); } }); } } else { zza2 = zzhj.zza(zzhhVar.zza(), this.zzf.zza, new Runnable() { // from class: com.google.android.gms.internal.measurement.zzgz @Override // java.lang.Runnable public final void run() { zzgw.zzc(); } }); } if (zza2 == null || (zza3 = zza2.zza(zzb())) == null) { return null; } return zza(zza3); } public final String zzb() { return zza(this.zzf.zzd); } private final String zza(String str) { if (str != null && str.isEmpty()) { return this.zzg; } return str + this.zzg; } static { new AtomicReference(); zzd = new zzhl(new zzhk() { // from class: com.google.android.gms.internal.measurement.zzhb @Override // com.google.android.gms.internal.measurement.zzhk public final boolean zza() { return zzgw.zzd(); } }); zze = new AtomicInteger(); } private zzgw(zzhe zzheVar, String str, T t, boolean z) { this.zzi = -1; String str2 = zzheVar.zza; if (str2 == null && zzheVar.zzb == null) { throw new IllegalArgumentException("Must pass a valid SharedPreferences file name or ContentProvider URI"); } if (str2 != null && zzheVar.zzb != null) { throw new IllegalArgumentException("Must pass one of SharedPreferences file name or ContentProvider URI"); } this.zzf = zzheVar; this.zzg = str; this.zzh = t; this.zzk = z; this.zzl = false; } public static void zzc() { zze.incrementAndGet(); } /* JADX WARN: Code restructure failed: missing block: B:32:0x0048, code lost: r3 = move-exception; */ /* JADX WARN: Code restructure failed: missing block: B:35:0x004d, code lost: throw r3; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public static void zzb(final android.content.Context r3) { /* com.google.android.gms.internal.measurement.zzhh r0 = com.google.android.gms.internal.measurement.zzgw.zzb if (r0 != 0) goto L4e if (r3 != 0) goto L7 goto L4e L7: java.lang.Object r0 = com.google.android.gms.internal.measurement.zzgw.zza monitor-enter(r0) com.google.android.gms.internal.measurement.zzhh r1 = com.google.android.gms.internal.measurement.zzgw.zzb // Catch: java.lang.Throwable -> L48 if (r1 != 0) goto L4a monitor-enter(r0) // Catch: java.lang.Throwable -> L48 com.google.android.gms.internal.measurement.zzhh r1 = com.google.android.gms.internal.measurement.zzgw.zzb // Catch: java.lang.Throwable -> L22 android.content.Context r2 = r3.getApplicationContext() // Catch: java.lang.Throwable -> L22 if (r2 != 0) goto L18 goto L19 L18: r3 = r2 L19: if (r1 == 0) goto L24 android.content.Context r2 = r1.zza() // Catch: java.lang.Throwable -> L22 if (r2 == r3) goto L44 goto L24 L22: r3 = move-exception goto L46 L24: if (r1 == 0) goto L2f com.google.android.gms.internal.measurement.zzgh.zzc() // Catch: java.lang.Throwable -> L22 com.google.android.gms.internal.measurement.zzhj.zza() // Catch: java.lang.Throwable -> L22 com.google.android.gms.internal.measurement.zzgp.zza() // Catch: java.lang.Throwable -> L22 L2f: com.google.android.gms.internal.measurement.zzgy r1 = new com.google.android.gms.internal.measurement.zzgy // Catch: java.lang.Throwable -> L22 r1.() // Catch: java.lang.Throwable -> L22 com.google.common.base.Supplier r1 = com.google.common.base.Suppliers.memoize(r1) // Catch: java.lang.Throwable -> L22 com.google.android.gms.internal.measurement.zzgi r2 = new com.google.android.gms.internal.measurement.zzgi // Catch: java.lang.Throwable -> L22 r2.(r3, r1) // Catch: java.lang.Throwable -> L22 com.google.android.gms.internal.measurement.zzgw.zzb = r2 // Catch: java.lang.Throwable -> L22 java.util.concurrent.atomic.AtomicInteger r3 = com.google.android.gms.internal.measurement.zzgw.zze // Catch: java.lang.Throwable -> L22 r3.incrementAndGet() // Catch: java.lang.Throwable -> L22 L44: monitor-exit(r0) // Catch: java.lang.Throwable -> L22 goto L4a L46: monitor-exit(r0) // Catch: java.lang.Throwable -> L22 throw r3 // Catch: java.lang.Throwable -> L48 L48: r3 = move-exception goto L4c L4a: monitor-exit(r0) // Catch: java.lang.Throwable -> L48 return L4c: monitor-exit(r0) // Catch: java.lang.Throwable -> L48 throw r3 L4e: return */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.measurement.zzgw.zzb(android.content.Context):void"); } }