83 lines
2.4 KiB
Java
83 lines
2.4 KiB
Java
package o;
|
|
|
|
import android.content.Context;
|
|
import androidx.startup.StartupException;
|
|
import java.util.HashMap;
|
|
import java.util.HashSet;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
|
|
/* renamed from: o.cPD, reason: case insensitive filesystem */
|
|
/* loaded from: classes.dex */
|
|
public final class C6313cPD {
|
|
private static volatile C6313cPD a;
|
|
private static final Object c = new Object();
|
|
final Context b;
|
|
public final Set<Class<? extends qYK<?>>> e = new HashSet();
|
|
final Map<Class<?>, Object> d = new HashMap();
|
|
|
|
private C6313cPD(Context context) {
|
|
this.b = context.getApplicationContext();
|
|
}
|
|
|
|
public static C6313cPD c(Context context) {
|
|
if (a == null) {
|
|
synchronized (c) {
|
|
if (a == null) {
|
|
a = new C6313cPD(context);
|
|
}
|
|
}
|
|
}
|
|
return a;
|
|
}
|
|
|
|
public final <T> T a(Class<? extends qYK<?>> cls) {
|
|
T t;
|
|
synchronized (c) {
|
|
t = (T) this.d.get(cls);
|
|
if (t == null) {
|
|
t = (T) c(cls, new HashSet());
|
|
}
|
|
}
|
|
return t;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public final <T> T c(Class<? extends qYK<?>> cls, Set<Class<?>> set) {
|
|
T t;
|
|
if (C6212cMN.c()) {
|
|
try {
|
|
C1776aOB.a(cls.getSimpleName());
|
|
} finally {
|
|
C1776aOB.c();
|
|
}
|
|
}
|
|
if (set.contains(cls)) {
|
|
throw new IllegalStateException(String.format("Cannot initialize %s. Cycle detected.", cls.getName()));
|
|
}
|
|
if (!this.d.containsKey(cls)) {
|
|
set.add(cls);
|
|
try {
|
|
qYK<?> newInstance = cls.getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
|
|
List<Class<? extends qYK<?>>> e = newInstance.e();
|
|
if (!e.isEmpty()) {
|
|
for (Class<? extends qYK<?>> cls2 : e) {
|
|
if (!this.d.containsKey(cls2)) {
|
|
c(cls2, set);
|
|
}
|
|
}
|
|
}
|
|
t = (T) newInstance.c(this.b);
|
|
set.remove(cls);
|
|
this.d.put(cls, t);
|
|
} catch (Throwable th) {
|
|
throw new StartupException(th);
|
|
}
|
|
} else {
|
|
t = (T) this.d.get(cls);
|
|
}
|
|
return t;
|
|
}
|
|
}
|