123 lines
3.7 KiB
Java
123 lines
3.7 KiB
Java
package com.google.android.gms.internal.measurement;
|
|
|
|
import android.content.ContentResolver;
|
|
import android.database.Cursor;
|
|
import android.database.sqlite.SQLiteException;
|
|
import android.net.Uri;
|
|
import android.util.Log;
|
|
import androidx.collection.ArrayMap;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class zzrx implements zzsb {
|
|
static final Map<Uri, zzrx> f = new ArrayMap();
|
|
private static final String[] g = {"key", "value"};
|
|
private final ContentResolver a;
|
|
private final Uri b;
|
|
private volatile Map<String, String> d;
|
|
private final Object c = new Object();
|
|
private final List<zzsa> e = new ArrayList();
|
|
|
|
private zzrx(ContentResolver contentResolver, Uri uri) {
|
|
this.a = contentResolver;
|
|
this.b = uri;
|
|
this.a.registerContentObserver(uri, false, new zzrz(this, null));
|
|
}
|
|
|
|
public static zzrx a(ContentResolver contentResolver, Uri uri) {
|
|
zzrx zzrxVar;
|
|
synchronized (zzrx.class) {
|
|
zzrxVar = f.get(uri);
|
|
if (zzrxVar == null) {
|
|
try {
|
|
zzrx zzrxVar2 = new zzrx(contentResolver, uri);
|
|
try {
|
|
f.put(uri, zzrxVar2);
|
|
} catch (SecurityException unused) {
|
|
}
|
|
zzrxVar = zzrxVar2;
|
|
} catch (SecurityException unused2) {
|
|
}
|
|
}
|
|
}
|
|
return zzrxVar;
|
|
}
|
|
|
|
private final Map<String, String> d() {
|
|
try {
|
|
return (Map) zzsc.a(new zzsd(this) { // from class: com.google.android.gms.internal.measurement.zzry
|
|
private final zzrx a;
|
|
|
|
{
|
|
this.a = this;
|
|
}
|
|
|
|
@Override // com.google.android.gms.internal.measurement.zzsd
|
|
public final Object a() {
|
|
return this.a.c();
|
|
}
|
|
});
|
|
} catch (SQLiteException | SecurityException unused) {
|
|
Log.e("ConfigurationContentLoader", "PhenotypeFlag unable to load ContentProvider, using default values");
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public final void b() {
|
|
synchronized (this.c) {
|
|
this.d = null;
|
|
zzsi.d();
|
|
}
|
|
synchronized (this) {
|
|
Iterator<zzsa> it = this.e.iterator();
|
|
while (it.hasNext()) {
|
|
it.next().a();
|
|
}
|
|
}
|
|
}
|
|
|
|
final /* synthetic */ Map c() {
|
|
Cursor query = this.a.query(this.b, g, null, null, null);
|
|
if (query == null) {
|
|
return Collections.emptyMap();
|
|
}
|
|
try {
|
|
int count = query.getCount();
|
|
if (count == 0) {
|
|
return Collections.emptyMap();
|
|
}
|
|
Map arrayMap = count <= 256 ? new ArrayMap(count) : new HashMap(count, 1.0f);
|
|
while (query.moveToNext()) {
|
|
arrayMap.put(query.getString(0), query.getString(1));
|
|
}
|
|
return arrayMap;
|
|
} finally {
|
|
query.close();
|
|
}
|
|
}
|
|
|
|
public final Map<String, String> a() {
|
|
Map<String, String> map = this.d;
|
|
if (map == null) {
|
|
synchronized (this.c) {
|
|
map = this.d;
|
|
if (map == null) {
|
|
map = d();
|
|
this.d = map;
|
|
}
|
|
}
|
|
}
|
|
return map != null ? map : Collections.emptyMap();
|
|
}
|
|
|
|
@Override // com.google.android.gms.internal.measurement.zzsb
|
|
public final /* synthetic */ Object a(String str) {
|
|
return a().get(str);
|
|
}
|
|
}
|