jimu-decompiled/sources/com/google/android/gms/internal/measurement/zzsp.java
2025-05-13 19:24:51 +02:00

91 lines
2.9 KiB
Java

package com.google.android.gms.internal.measurement;
import android.content.Context;
import android.content.SharedPreferences;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public final class zzsp implements zzsb {
static final Map<String, zzsp> f = new HashMap();
private final SharedPreferences a;
private volatile Map<String, ?> d;
private final SharedPreferences.OnSharedPreferenceChangeListener b = new SharedPreferences.OnSharedPreferenceChangeListener(this) { // from class: com.google.android.gms.internal.measurement.zzsq
private final zzsp a;
{
this.a = this;
}
@Override // android.content.SharedPreferences.OnSharedPreferenceChangeListener
public final void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String str) {
this.a.a(sharedPreferences, str);
}
};
private final Object c = new Object();
private final List<zzsa> e = new ArrayList();
private zzsp(SharedPreferences sharedPreferences) {
this.a = sharedPreferences;
this.a.registerOnSharedPreferenceChangeListener(this.b);
}
static zzsp a(Context context, String str) {
zzsp zzspVar;
SharedPreferences sharedPreferences;
if (!((!zzrw.a() || str.startsWith("direct_boot:")) ? true : zzrw.a(context))) {
return null;
}
synchronized (zzsp.class) {
zzspVar = f.get(str);
if (zzspVar == null) {
if (str.startsWith("direct_boot:")) {
if (zzrw.a()) {
context = context.createDeviceProtectedStorageContext();
}
sharedPreferences = context.getSharedPreferences(str.substring(12), 0);
} else {
sharedPreferences = context.getSharedPreferences(str, 0);
}
zzspVar = new zzsp(sharedPreferences);
f.put(str, zzspVar);
}
}
return zzspVar;
}
@Override // com.google.android.gms.internal.measurement.zzsb
public final Object a(String str) {
Map<String, ?> map = this.d;
if (map == null) {
synchronized (this.c) {
map = this.d;
if (map == null) {
map = this.a.getAll();
this.d = map;
}
}
}
if (map != null) {
return map.get(str);
}
return null;
}
final /* synthetic */ void a(SharedPreferences sharedPreferences, String str) {
synchronized (this.c) {
this.d = null;
zzsi.d();
}
synchronized (this) {
Iterator<zzsa> it = this.e.iterator();
while (it.hasNext()) {
it.next().a();
}
}
}
}