package com.google.android.gms.internal.clearcut; import android.content.ContentResolver; import android.database.ContentObserver; import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.net.Uri; import android.util.Log; import com.google.android.gms.measurement.api.AppMeasurementSdk; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /* loaded from: classes2.dex */ public final class zzab { private static final ConcurrentHashMap zzde = new ConcurrentHashMap<>(); private static final String[] zzdl = {"key", AppMeasurementSdk.ConditionalUserProperty.VALUE}; private final Uri uri; private final ContentResolver zzdf; private volatile Map zzdi; private final Object zzdh = new Object(); private final Object zzdj = new Object(); private final List zzdk = new ArrayList(); private final ContentObserver zzdg = new zzac(this, null); public final void zzh() { synchronized (this.zzdh) { this.zzdi = null; } } public final Map zzg() { Map zzi = zzae.zza("gms:phenotype:phenotype_flag:debug_disable_caching", false) ? zzi() : this.zzdi; if (zzi == null) { synchronized (this.zzdh) { zzi = this.zzdi; if (zzi == null) { zzi = zzi(); this.zzdi = zzi; } } } return zzi != null ? zzi : Collections.emptyMap(); } /* JADX INFO: Access modifiers changed from: private */ public final void zzj() { synchronized (this.zzdj) { Iterator it = this.zzdk.iterator(); while (it.hasNext()) { it.next().zzk(); } } } private final Map zzi() { try { HashMap hashMap = new HashMap(); Cursor query = this.zzdf.query(this.uri, zzdl, null, null, null); if (query != null) { while (query.moveToNext()) { try { hashMap.put(query.getString(0), query.getString(1)); } catch (Throwable th) { query.close(); throw th; } } query.close(); } return hashMap; } catch (SQLiteException | SecurityException unused) { Log.e("ConfigurationContentLoader", "PhenotypeFlag unable to load ContentProvider, using default values"); return null; } } public static zzab zza(ContentResolver contentResolver, Uri uri) { ConcurrentHashMap concurrentHashMap = zzde; zzab zzabVar = concurrentHashMap.get(uri); if (zzabVar != null) { return zzabVar; } zzab zzabVar2 = new zzab(contentResolver, uri); zzab putIfAbsent = concurrentHashMap.putIfAbsent(uri, zzabVar2); if (putIfAbsent != null) { return putIfAbsent; } zzabVar2.zzdf.registerContentObserver(zzabVar2.uri, false, zzabVar2.zzdg); return zzabVar2; } private zzab(ContentResolver contentResolver, Uri uri) { this.zzdf = contentResolver; this.uri = uri; } }