Initial commit
This commit is contained in:
243
sources/com/google/firebase/components/Component.java
Normal file
243
sources/com/google/firebase/components/Component.java
Normal file
@@ -0,0 +1,243 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
public final class Component<T> {
|
||||
private final Set<Class<? super T>> a;
|
||||
private final Set<Dependency> b;
|
||||
private final int c;
|
||||
private final ComponentFactory<T> d;
|
||||
private final Set<Class<?>> e;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* renamed from: com.google.firebase.components.Component$1, reason: invalid class name */
|
||||
public static /* synthetic */ class AnonymousClass1<T> {
|
||||
private final T a;
|
||||
private final zze<T> b;
|
||||
|
||||
private AnonymousClass1(T t, zze<T> zzeVar) {
|
||||
this.a = t;
|
||||
this.b = zzeVar;
|
||||
}
|
||||
|
||||
public static AnonymousClass1<Context> a(Context context) {
|
||||
return new AnonymousClass1<>(context, new zzd((byte) 0));
|
||||
}
|
||||
|
||||
private static List<ComponentRegistrar> b(List<String> list) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (String str : list) {
|
||||
try {
|
||||
Class<?> cls = Class.forName(str);
|
||||
if (ComponentRegistrar.class.isAssignableFrom(cls)) {
|
||||
arrayList.add((ComponentRegistrar) cls.getDeclaredConstructor(new Class[0]).newInstance(new Object[0]));
|
||||
} else {
|
||||
Log.w("ComponentDiscovery", String.format("Class %s is not an instance of %s", str, "com.google.firebase.components.ComponentRegistrar"));
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
Log.w("ComponentDiscovery", String.format("Class %s is not an found.", str), e);
|
||||
} catch (IllegalAccessException e2) {
|
||||
Log.w("ComponentDiscovery", String.format("Could not instantiate %s.", str), e2);
|
||||
} catch (InstantiationException e3) {
|
||||
Log.w("ComponentDiscovery", String.format("Could not instantiate %s.", str), e3);
|
||||
} catch (NoSuchMethodException e4) {
|
||||
Log.w("ComponentDiscovery", String.format("Could not instantiate %s", str), e4);
|
||||
} catch (InvocationTargetException e5) {
|
||||
Log.w("ComponentDiscovery", String.format("Could not instantiate %s", str), e5);
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public List<ComponentRegistrar> a() {
|
||||
return b(this.b.a(this.a));
|
||||
}
|
||||
|
||||
static List<Component<?>> a(List<Component<?>> list) {
|
||||
zzg zzgVar;
|
||||
HashMap hashMap = new HashMap(list.size());
|
||||
for (Component<?> component : list) {
|
||||
zzg zzgVar2 = new zzg(component);
|
||||
for (Class<? super Object> cls : component.a()) {
|
||||
if (hashMap.put(cls, zzgVar2) != null) {
|
||||
throw new IllegalArgumentException(String.format("Multiple components provide %s.", cls));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (zzg zzgVar3 : hashMap.values()) {
|
||||
for (Dependency dependency : zzgVar3.b().b()) {
|
||||
if (dependency.c() && (zzgVar = (zzg) hashMap.get(dependency.a())) != null) {
|
||||
zzgVar3.a(zzgVar);
|
||||
zzgVar.b(zzgVar3);
|
||||
}
|
||||
}
|
||||
}
|
||||
HashSet<zzg> hashSet = new HashSet(hashMap.values());
|
||||
Set<zzg> a = a(hashSet);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
while (!a.isEmpty()) {
|
||||
zzg next = a.iterator().next();
|
||||
a.remove(next);
|
||||
arrayList.add(next.b());
|
||||
for (zzg zzgVar4 : next.a()) {
|
||||
zzgVar4.c(next);
|
||||
if (zzgVar4.c()) {
|
||||
a.add(zzgVar4);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (arrayList.size() == list.size()) {
|
||||
Collections.reverse(arrayList);
|
||||
return arrayList;
|
||||
}
|
||||
ArrayList arrayList2 = new ArrayList();
|
||||
for (zzg zzgVar5 : hashSet) {
|
||||
if (!zzgVar5.c() && !zzgVar5.d()) {
|
||||
arrayList2.add(zzgVar5.b());
|
||||
}
|
||||
}
|
||||
throw new DependencyCycleException(arrayList2);
|
||||
}
|
||||
|
||||
private static Set<zzg> a(Set<zzg> set) {
|
||||
HashSet hashSet = new HashSet();
|
||||
for (zzg zzgVar : set) {
|
||||
if (zzgVar.c()) {
|
||||
hashSet.add(zzgVar);
|
||||
}
|
||||
}
|
||||
return hashSet;
|
||||
}
|
||||
}
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
public static class Builder<T> {
|
||||
private final Set<Class<? super T>> a;
|
||||
private final Set<Dependency> b;
|
||||
private int c;
|
||||
private ComponentFactory<T> d;
|
||||
private Set<Class<?>> e;
|
||||
|
||||
/* synthetic */ Builder(Class cls, Class[] clsArr, byte b) {
|
||||
this(cls, clsArr);
|
||||
}
|
||||
|
||||
public Builder<T> a(Dependency dependency) {
|
||||
Preconditions.a(dependency, "Null dependency");
|
||||
Preconditions.a(!this.a.contains(dependency.a()), "Components are not allowed to depend on interfaces they themselves provide.");
|
||||
this.b.add(dependency);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Component<T> b() {
|
||||
Preconditions.b(this.d != null, "Missing required property: factory.");
|
||||
return new Component<>(new HashSet(this.a), new HashSet(this.b), this.c, this.d, this.e, (byte) 0);
|
||||
}
|
||||
|
||||
public Builder<T> c() {
|
||||
a(2);
|
||||
return this;
|
||||
}
|
||||
|
||||
private Builder(Class<T> cls, Class<? super T>... clsArr) {
|
||||
this.a = new HashSet();
|
||||
this.b = new HashSet();
|
||||
this.c = 0;
|
||||
this.e = new HashSet();
|
||||
Preconditions.a(cls, "Null interface");
|
||||
this.a.add(cls);
|
||||
for (Class<? super T> cls2 : clsArr) {
|
||||
Preconditions.a(cls2, "Null interface");
|
||||
}
|
||||
Collections.addAll(this.a, clsArr);
|
||||
}
|
||||
|
||||
public Builder<T> a() {
|
||||
a(1);
|
||||
return this;
|
||||
}
|
||||
|
||||
private Builder<T> a(int i) {
|
||||
Preconditions.b(this.c == 0, "Instantiation type has already been set.");
|
||||
this.c = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder<T> a(ComponentFactory<T> componentFactory) {
|
||||
Preconditions.a(componentFactory, "Null factory");
|
||||
this.d = componentFactory;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/* synthetic */ Component(Set set, Set set2, int i, ComponentFactory componentFactory, Set set3, byte b) {
|
||||
this(set, set2, i, componentFactory, set3);
|
||||
}
|
||||
|
||||
static /* synthetic */ Object a(Object obj) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
public final Set<Class<? super T>> a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public final Set<Dependency> b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public final ComponentFactory<T> c() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public final Set<Class<?>> d() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public final boolean e() {
|
||||
return this.c == 1;
|
||||
}
|
||||
|
||||
public final boolean f() {
|
||||
return this.c == 2;
|
||||
}
|
||||
|
||||
public final String toString() {
|
||||
return "Component<" + Arrays.toString(this.a.toArray()) + ">{" + this.c + ", deps=" + Arrays.toString(this.b.toArray()) + "}";
|
||||
}
|
||||
|
||||
private Component(Set<Class<? super T>> set, Set<Dependency> set2, int i, ComponentFactory<T> componentFactory, Set<Class<?>> set3) {
|
||||
this.a = Collections.unmodifiableSet(set);
|
||||
this.b = Collections.unmodifiableSet(set2);
|
||||
this.c = i;
|
||||
this.d = componentFactory;
|
||||
this.e = Collections.unmodifiableSet(set3);
|
||||
}
|
||||
|
||||
public static <T> Builder<T> a(Class<T> cls) {
|
||||
return new Builder<>(cls, new Class[0], (byte) 0);
|
||||
}
|
||||
|
||||
public static <T> Builder<T> a(Class<T> cls, Class<? super T>... clsArr) {
|
||||
return new Builder<>(cls, clsArr, (byte) 0);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public static <T> Component<T> a(T t, Class<T> cls, Class<? super T>... clsArr) {
|
||||
Builder a = a(cls, clsArr);
|
||||
a.a(zzc.a(t));
|
||||
return a.b();
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import com.google.firebase.inject.Provider;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
public interface ComponentContainer {
|
||||
<T> T a(Class<T> cls);
|
||||
|
||||
<T> Provider<T> b(Class<T> cls);
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
public class ComponentDiscoveryService extends Service {
|
||||
@Override // android.app.Service
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
public interface ComponentFactory<T> {
|
||||
T a(ComponentContainer componentContainer);
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
public interface ComponentRegistrar {
|
||||
List<Component<?>> getComponents();
|
||||
}
|
59
sources/com/google/firebase/components/Dependency.java
Normal file
59
sources/com/google/firebase/components/Dependency.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
public final class Dependency {
|
||||
private final Class<?> a;
|
||||
private final int b;
|
||||
private final int c;
|
||||
|
||||
private Dependency(Class<?> cls, int i, int i2) {
|
||||
Preconditions.a(cls, "Null dependency anInterface.");
|
||||
this.a = cls;
|
||||
this.b = i;
|
||||
this.c = i2;
|
||||
}
|
||||
|
||||
public static Dependency a(Class<?> cls) {
|
||||
return new Dependency(cls, 1, 0);
|
||||
}
|
||||
|
||||
public final boolean b() {
|
||||
return this.b == 1;
|
||||
}
|
||||
|
||||
public final boolean c() {
|
||||
return this.c == 0;
|
||||
}
|
||||
|
||||
public final boolean equals(Object obj) {
|
||||
if (obj instanceof Dependency) {
|
||||
Dependency dependency = (Dependency) obj;
|
||||
if (this.a == dependency.a && this.b == dependency.b && this.c == dependency.c) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public final int hashCode() {
|
||||
return ((((this.a.hashCode() ^ 1000003) * 1000003) ^ this.b) * 1000003) ^ this.c;
|
||||
}
|
||||
|
||||
public final String toString() {
|
||||
StringBuilder sb = new StringBuilder("Dependency{anInterface=");
|
||||
sb.append(this.a);
|
||||
sb.append(", required=");
|
||||
sb.append(this.b == 1);
|
||||
sb.append(", direct=");
|
||||
sb.append(this.c == 0);
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public final Class<?> a() {
|
||||
return this.a;
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
public class DependencyCycleException extends DependencyException {
|
||||
private final List<Component<?>> zza;
|
||||
|
||||
public DependencyCycleException(List<Component<?>> list) {
|
||||
super("Dependency cycle detected: " + Arrays.toString(list.toArray()));
|
||||
this.zza = list;
|
||||
}
|
||||
|
||||
public List<Component<?>> getComponentsInCycle() {
|
||||
return this.zza;
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
public class DependencyException extends RuntimeException {
|
||||
public DependencyException(String str) {
|
||||
super(str);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
public class MissingDependencyException extends DependencyException {
|
||||
public MissingDependencyException(String str) {
|
||||
super(str);
|
||||
}
|
||||
}
|
20
sources/com/google/firebase/components/zza.java
Normal file
20
sources/com/google/firebase/components/zza.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import com.google.firebase.inject.Provider;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class zza implements ComponentContainer {
|
||||
zza() {
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.components.ComponentContainer
|
||||
public <T> T a(Class<T> cls) {
|
||||
Provider<T> b = b(cls);
|
||||
if (b == null) {
|
||||
return null;
|
||||
}
|
||||
return b.get();
|
||||
}
|
||||
}
|
22
sources/com/google/firebase/components/zzc.java
Normal file
22
sources/com/google/firebase/components/zzc.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
final /* synthetic */ class zzc implements ComponentFactory {
|
||||
private final Object a;
|
||||
|
||||
private zzc(Object obj) {
|
||||
this.a = obj;
|
||||
}
|
||||
|
||||
public static ComponentFactory a(Object obj) {
|
||||
return new zzc(obj);
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.components.ComponentFactory
|
||||
public final Object a(ComponentContainer componentContainer) {
|
||||
Object obj = this.a;
|
||||
Component.a(obj);
|
||||
return obj;
|
||||
}
|
||||
}
|
59
sources/com/google/firebase/components/zzd.java
Normal file
59
sources/com/google/firebase/components/zzd.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
final class zzd implements zze<Context> {
|
||||
private zzd() {
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.components.zze
|
||||
public final /* synthetic */ List a(Context context) {
|
||||
Bundle a2 = a2(context);
|
||||
if (a2 == null) {
|
||||
Log.w("ComponentDiscovery", "Could not retrieve metadata, returning empty list of registrars.");
|
||||
return Collections.emptyList();
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (String str : a2.keySet()) {
|
||||
if ("com.google.firebase.components.ComponentRegistrar".equals(a2.get(str)) && str.startsWith("com.google.firebase.components:")) {
|
||||
arrayList.add(str.substring(31));
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
/* synthetic */ zzd(byte b) {
|
||||
this();
|
||||
}
|
||||
|
||||
/* renamed from: a, reason: avoid collision after fix types in other method */
|
||||
private static Bundle a2(Context context) {
|
||||
try {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
if (packageManager == null) {
|
||||
Log.w("ComponentDiscovery", "Context has no PackageManager.");
|
||||
return null;
|
||||
}
|
||||
ServiceInfo serviceInfo = packageManager.getServiceInfo(new ComponentName(context, (Class<?>) ComponentDiscoveryService.class), PeripheralType.SERVO);
|
||||
if (serviceInfo == null) {
|
||||
Log.w("ComponentDiscovery", "ComponentDiscoveryService has no service info.");
|
||||
return null;
|
||||
}
|
||||
return serviceInfo.metaData;
|
||||
} catch (PackageManager.NameNotFoundException unused) {
|
||||
Log.w("ComponentDiscovery", "Application info not found.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
9
sources/com/google/firebase/components/zze.java
Normal file
9
sources/com/google/firebase/components/zze.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
interface zze<T> {
|
||||
List<String> a(T t);
|
||||
}
|
72
sources/com/google/firebase/components/zzf.java
Normal file
72
sources/com/google/firebase/components/zzf.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.firebase.components.Component;
|
||||
import com.google.firebase.events.Publisher;
|
||||
import com.google.firebase.events.Subscriber;
|
||||
import com.google.firebase.inject.Provider;
|
||||
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.Executor;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
public final class zzf extends zza {
|
||||
private final List<Component<?>> a;
|
||||
private final Map<Class<?>, zzj<?>> b = new HashMap();
|
||||
private final zzh c;
|
||||
|
||||
public zzf(Executor executor, Iterable<ComponentRegistrar> iterable, Component<?>... componentArr) {
|
||||
this.c = new zzh(executor);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
arrayList.add(Component.a(this.c, zzh.class, Subscriber.class, Publisher.class));
|
||||
Iterator<ComponentRegistrar> it = iterable.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.addAll(it.next().getComponents());
|
||||
}
|
||||
Collections.addAll(arrayList, componentArr);
|
||||
this.a = Collections.unmodifiableList(Component.AnonymousClass1.a(arrayList));
|
||||
Iterator<Component<?>> it2 = this.a.iterator();
|
||||
while (it2.hasNext()) {
|
||||
a(it2.next());
|
||||
}
|
||||
a();
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.components.ComponentContainer
|
||||
public final <T> Provider<T> b(Class<T> cls) {
|
||||
Preconditions.a(cls, "Null interface requested.");
|
||||
return this.b.get(cls);
|
||||
}
|
||||
|
||||
public final void a(boolean z) {
|
||||
for (Component<?> component : this.a) {
|
||||
if (component.e() || (component.f() && z)) {
|
||||
a(component.a().iterator().next());
|
||||
}
|
||||
}
|
||||
this.c.a();
|
||||
}
|
||||
|
||||
private <T> void a(Component<T> component) {
|
||||
zzj<?> zzjVar = new zzj<>(component.c(), new zzl(component, this));
|
||||
Iterator<Class<? super T>> it = component.a().iterator();
|
||||
while (it.hasNext()) {
|
||||
this.b.put(it.next(), zzjVar);
|
||||
}
|
||||
}
|
||||
|
||||
private void a() {
|
||||
for (Component<?> component : this.a) {
|
||||
for (Dependency dependency : component.b()) {
|
||||
if (dependency.b() && !this.b.containsKey(dependency.a())) {
|
||||
throw new MissingDependencyException(String.format("Unsatisfied dependency for component %s: %s", component, dependency.a()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
44
sources/com/google/firebase/components/zzg.java
Normal file
44
sources/com/google/firebase/components/zzg.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
final class zzg {
|
||||
private final Component<?> a;
|
||||
private final Set<zzg> b = new HashSet();
|
||||
private final Set<zzg> c = new HashSet();
|
||||
|
||||
zzg(Component<?> component) {
|
||||
this.a = component;
|
||||
}
|
||||
|
||||
final void a(zzg zzgVar) {
|
||||
this.b.add(zzgVar);
|
||||
}
|
||||
|
||||
final void b(zzg zzgVar) {
|
||||
this.c.add(zzgVar);
|
||||
}
|
||||
|
||||
final void c(zzg zzgVar) {
|
||||
this.c.remove(zzgVar);
|
||||
}
|
||||
|
||||
final boolean d() {
|
||||
return this.b.isEmpty();
|
||||
}
|
||||
|
||||
final Set<zzg> a() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
final Component<?> b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
final boolean c() {
|
||||
return this.c.isEmpty();
|
||||
}
|
||||
}
|
83
sources/com/google/firebase/components/zzh.java
Normal file
83
sources/com/google/firebase/components/zzh.java
Normal file
@@ -0,0 +1,83 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.firebase.events.Event;
|
||||
import com.google.firebase.events.EventHandler;
|
||||
import com.google.firebase.events.Publisher;
|
||||
import com.google.firebase.events.Subscriber;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
class zzh implements Publisher, Subscriber {
|
||||
private final Map<Class<?>, ConcurrentHashMap<EventHandler<Object>, Executor>> a = new HashMap();
|
||||
private Queue<Event<?>> b = new ArrayDeque();
|
||||
private final Executor c;
|
||||
|
||||
zzh(Executor executor) {
|
||||
this.c = executor;
|
||||
}
|
||||
|
||||
private synchronized Set<Map.Entry<EventHandler<Object>, Executor>> b(Event<?> event) {
|
||||
ConcurrentHashMap<EventHandler<Object>, Executor> concurrentHashMap = this.a.get(event.b());
|
||||
if (concurrentHashMap == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return concurrentHashMap.entrySet();
|
||||
}
|
||||
|
||||
public void a(Event<?> event) {
|
||||
Preconditions.a(event);
|
||||
synchronized (this) {
|
||||
if (this.b != null) {
|
||||
this.b.add(event);
|
||||
return;
|
||||
}
|
||||
for (Map.Entry<EventHandler<Object>, Executor> entry : b(event)) {
|
||||
entry.getValue().execute(zzi.a(entry, event));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.events.Subscriber
|
||||
public synchronized <T> void a(Class<T> cls, Executor executor, EventHandler<? super T> eventHandler) {
|
||||
Preconditions.a(cls);
|
||||
Preconditions.a(eventHandler);
|
||||
Preconditions.a(executor);
|
||||
if (!this.a.containsKey(cls)) {
|
||||
this.a.put(cls, new ConcurrentHashMap<>());
|
||||
}
|
||||
this.a.get(cls).put(eventHandler, executor);
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.events.Subscriber
|
||||
public <T> void a(Class<T> cls, EventHandler<? super T> eventHandler) {
|
||||
a(cls, this.c, eventHandler);
|
||||
}
|
||||
|
||||
final void a() {
|
||||
Queue<Event<?>> queue;
|
||||
synchronized (this) {
|
||||
if (this.b != null) {
|
||||
queue = this.b;
|
||||
this.b = null;
|
||||
} else {
|
||||
queue = null;
|
||||
}
|
||||
}
|
||||
if (queue != null) {
|
||||
Iterator<Event<?>> it = queue.iterator();
|
||||
while (it.hasNext()) {
|
||||
a(it.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
26
sources/com/google/firebase/components/zzi.java
Normal file
26
sources/com/google/firebase/components/zzi.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import com.google.firebase.events.Event;
|
||||
import com.google.firebase.events.EventHandler;
|
||||
import java.util.Map;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
final /* synthetic */ class zzi implements Runnable {
|
||||
private final Map.Entry a;
|
||||
private final Event b;
|
||||
|
||||
private zzi(Map.Entry entry, Event event) {
|
||||
this.a = entry;
|
||||
this.b = event;
|
||||
}
|
||||
|
||||
public static Runnable a(Map.Entry entry, Event event) {
|
||||
return new zzi(entry, event);
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
((EventHandler) this.a.getKey()).a(this.b);
|
||||
}
|
||||
}
|
31
sources/com/google/firebase/components/zzj.java
Normal file
31
sources/com/google/firebase/components/zzj.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import com.google.firebase.inject.Provider;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
final class zzj<T> implements Provider<T> {
|
||||
private static final Object c = new Object();
|
||||
private volatile Object a = c;
|
||||
private volatile Provider<T> b;
|
||||
|
||||
zzj(ComponentFactory<T> componentFactory, ComponentContainer componentContainer) {
|
||||
this.b = zzk.a(componentFactory, componentContainer);
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.inject.Provider
|
||||
public final T get() {
|
||||
T t = (T) this.a;
|
||||
if (t == c) {
|
||||
synchronized (this) {
|
||||
t = (T) this.a;
|
||||
if (t == c) {
|
||||
t = this.b.get();
|
||||
this.a = t;
|
||||
this.b = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
}
|
26
sources/com/google/firebase/components/zzk.java
Normal file
26
sources/com/google/firebase/components/zzk.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import com.google.firebase.inject.Provider;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
final /* synthetic */ class zzk implements Provider {
|
||||
private final ComponentFactory a;
|
||||
private final ComponentContainer b;
|
||||
|
||||
private zzk(ComponentFactory componentFactory, ComponentContainer componentContainer) {
|
||||
this.a = componentFactory;
|
||||
this.b = componentContainer;
|
||||
}
|
||||
|
||||
public static Provider a(ComponentFactory componentFactory, ComponentContainer componentContainer) {
|
||||
return new zzk(componentFactory, componentContainer);
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.inject.Provider
|
||||
public final Object get() {
|
||||
Object a;
|
||||
a = this.a.a(this.b);
|
||||
return a;
|
||||
}
|
||||
}
|
58
sources/com/google/firebase/components/zzl.java
Normal file
58
sources/com/google/firebase/components/zzl.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package com.google.firebase.components;
|
||||
|
||||
import com.google.firebase.events.Publisher;
|
||||
import com.google.firebase.inject.Provider;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
/* loaded from: classes.dex */
|
||||
final class zzl extends com.google.firebase.components.zza {
|
||||
private final Set<Class<?>> a;
|
||||
private final Set<Class<?>> b;
|
||||
private final Set<Class<?>> c;
|
||||
private final ComponentContainer d;
|
||||
|
||||
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
||||
static class zza implements Publisher {
|
||||
public zza(Set<Class<?>> set, Publisher publisher) {
|
||||
}
|
||||
}
|
||||
|
||||
zzl(Component<?> component, ComponentContainer componentContainer) {
|
||||
HashSet hashSet = new HashSet();
|
||||
HashSet hashSet2 = new HashSet();
|
||||
for (Dependency dependency : component.b()) {
|
||||
if (dependency.c()) {
|
||||
hashSet.add(dependency.a());
|
||||
} else {
|
||||
hashSet2.add(dependency.a());
|
||||
}
|
||||
}
|
||||
if (!component.d().isEmpty()) {
|
||||
hashSet.add(Publisher.class);
|
||||
}
|
||||
this.a = Collections.unmodifiableSet(hashSet);
|
||||
this.b = Collections.unmodifiableSet(hashSet2);
|
||||
this.c = component.d();
|
||||
this.d = componentContainer;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.components.zza, com.google.firebase.components.ComponentContainer
|
||||
public final <T> T a(Class<T> cls) {
|
||||
if (!this.a.contains(cls)) {
|
||||
throw new IllegalArgumentException(String.format("Requesting %s is not allowed.", cls));
|
||||
}
|
||||
T t = (T) this.d.a(cls);
|
||||
return !cls.equals(Publisher.class) ? t : (T) new zza(this.c, (Publisher) t);
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.components.ComponentContainer
|
||||
public final <T> Provider<T> b(Class<T> cls) {
|
||||
if (this.b.contains(cls)) {
|
||||
return this.d.b(cls);
|
||||
}
|
||||
throw new IllegalArgumentException(String.format("Requesting Provider<%s> is not allowed.", cls));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user