- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
323 lines
14 KiB
Java
323 lines
14 KiB
Java
package com.google.firebase.components;
|
|
|
|
import android.util.Log;
|
|
import androidx.lifecycle.LifecycleKt$$ExternalSyntheticBackportWithForwarding0;
|
|
import com.google.firebase.components.ComponentRuntime;
|
|
import com.google.firebase.dynamicloading.ComponentLoader;
|
|
import com.google.firebase.events.Publisher;
|
|
import com.google.firebase.events.Subscriber;
|
|
import com.google.firebase.inject.Deferred;
|
|
import com.google.firebase.inject.Provider;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.concurrent.Executor;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class ComponentRuntime implements ComponentContainer, ComponentLoader {
|
|
public static final Provider EMPTY_PROVIDER = new Provider() { // from class: com.google.firebase.components.ComponentRuntime$$ExternalSyntheticLambda1
|
|
@Override // com.google.firebase.inject.Provider
|
|
public final Object get() {
|
|
return Collections.emptySet();
|
|
}
|
|
};
|
|
public final ComponentRegistrarProcessor componentRegistrarProcessor;
|
|
public final Map components;
|
|
public final AtomicReference eagerComponentsInitializedWith;
|
|
public final EventBus eventBus;
|
|
public final Map lazyInstanceMap;
|
|
public final Map lazySetMap;
|
|
public Set processedCoroutineDispatcherInterfaces;
|
|
public final List unprocessedRegistrarProviders;
|
|
|
|
public static Builder builder(Executor executor) {
|
|
return new Builder(executor);
|
|
}
|
|
|
|
public ComponentRuntime(Executor executor, Iterable iterable, Collection collection, ComponentRegistrarProcessor componentRegistrarProcessor) {
|
|
this.components = new HashMap();
|
|
this.lazyInstanceMap = new HashMap();
|
|
this.lazySetMap = new HashMap();
|
|
this.processedCoroutineDispatcherInterfaces = new HashSet();
|
|
this.eagerComponentsInitializedWith = new AtomicReference();
|
|
EventBus eventBus = new EventBus(executor);
|
|
this.eventBus = eventBus;
|
|
this.componentRegistrarProcessor = componentRegistrarProcessor;
|
|
ArrayList arrayList = new ArrayList();
|
|
arrayList.add(Component.of(eventBus, EventBus.class, Subscriber.class, Publisher.class));
|
|
arrayList.add(Component.of(this, ComponentLoader.class, new Class[0]));
|
|
Iterator it = collection.iterator();
|
|
while (it.hasNext()) {
|
|
Component component = (Component) it.next();
|
|
if (component != null) {
|
|
arrayList.add(component);
|
|
}
|
|
}
|
|
this.unprocessedRegistrarProviders = iterableToList(iterable);
|
|
discoverComponents(arrayList);
|
|
}
|
|
|
|
public final void discoverComponents(List list) {
|
|
ArrayList arrayList = new ArrayList();
|
|
synchronized (this) {
|
|
Iterator it = this.unprocessedRegistrarProviders.iterator();
|
|
while (it.hasNext()) {
|
|
try {
|
|
ComponentRegistrar componentRegistrar = (ComponentRegistrar) ((Provider) it.next()).get();
|
|
if (componentRegistrar != null) {
|
|
list.addAll(this.componentRegistrarProcessor.processRegistrar(componentRegistrar));
|
|
it.remove();
|
|
}
|
|
} catch (InvalidRegistrarException e) {
|
|
it.remove();
|
|
Log.w("ComponentDiscovery", "Invalid component registrar.", e);
|
|
}
|
|
}
|
|
Iterator it2 = list.iterator();
|
|
while (it2.hasNext()) {
|
|
Object[] array = ((Component) it2.next()).getProvidedInterfaces().toArray();
|
|
int length = array.length;
|
|
int i = 0;
|
|
while (true) {
|
|
if (i < length) {
|
|
Object obj = array[i];
|
|
if (obj.toString().contains("kotlinx.coroutines.CoroutineDispatcher")) {
|
|
if (this.processedCoroutineDispatcherInterfaces.contains(obj.toString())) {
|
|
it2.remove();
|
|
break;
|
|
}
|
|
this.processedCoroutineDispatcherInterfaces.add(obj.toString());
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
if (this.components.isEmpty()) {
|
|
CycleDetector.detect(list);
|
|
} else {
|
|
ArrayList arrayList2 = new ArrayList(this.components.keySet());
|
|
arrayList2.addAll(list);
|
|
CycleDetector.detect(arrayList2);
|
|
}
|
|
Iterator it3 = list.iterator();
|
|
while (it3.hasNext()) {
|
|
final Component component = (Component) it3.next();
|
|
this.components.put(component, new Lazy(new Provider() { // from class: com.google.firebase.components.ComponentRuntime$$ExternalSyntheticLambda0
|
|
@Override // com.google.firebase.inject.Provider
|
|
public final Object get() {
|
|
Object lambda$discoverComponents$0;
|
|
lambda$discoverComponents$0 = ComponentRuntime.this.lambda$discoverComponents$0(component);
|
|
return lambda$discoverComponents$0;
|
|
}
|
|
}));
|
|
}
|
|
arrayList.addAll(processInstanceComponents(list));
|
|
arrayList.addAll(processSetComponents());
|
|
processDependencies();
|
|
}
|
|
Iterator it4 = arrayList.iterator();
|
|
while (it4.hasNext()) {
|
|
((Runnable) it4.next()).run();
|
|
}
|
|
maybeInitializeEagerComponents();
|
|
}
|
|
|
|
public final /* synthetic */ Object lambda$discoverComponents$0(Component component) {
|
|
return component.getFactory().create(new RestrictedComponentContainer(component, this));
|
|
}
|
|
|
|
public final void maybeInitializeEagerComponents() {
|
|
Boolean bool = (Boolean) this.eagerComponentsInitializedWith.get();
|
|
if (bool != null) {
|
|
doInitializeEagerComponents(this.components, bool.booleanValue());
|
|
}
|
|
}
|
|
|
|
public static List iterableToList(Iterable iterable) {
|
|
ArrayList arrayList = new ArrayList();
|
|
Iterator it = iterable.iterator();
|
|
while (it.hasNext()) {
|
|
arrayList.add(it.next());
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public final List processInstanceComponents(List list) {
|
|
ArrayList arrayList = new ArrayList();
|
|
Iterator it = list.iterator();
|
|
while (it.hasNext()) {
|
|
Component component = (Component) it.next();
|
|
if (component.isValue()) {
|
|
final Provider provider = (Provider) this.components.get(component);
|
|
for (Qualified qualified : component.getProvidedInterfaces()) {
|
|
if (!this.lazyInstanceMap.containsKey(qualified)) {
|
|
this.lazyInstanceMap.put(qualified, provider);
|
|
} else {
|
|
final OptionalProvider optionalProvider = (OptionalProvider) ((Provider) this.lazyInstanceMap.get(qualified));
|
|
arrayList.add(new Runnable() { // from class: com.google.firebase.components.ComponentRuntime$$ExternalSyntheticLambda2
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
OptionalProvider.this.set(provider);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public final List processSetComponents() {
|
|
ArrayList arrayList = new ArrayList();
|
|
HashMap hashMap = new HashMap();
|
|
for (Map.Entry entry : this.components.entrySet()) {
|
|
Component component = (Component) entry.getKey();
|
|
if (!component.isValue()) {
|
|
Provider provider = (Provider) entry.getValue();
|
|
for (Qualified qualified : component.getProvidedInterfaces()) {
|
|
if (!hashMap.containsKey(qualified)) {
|
|
hashMap.put(qualified, new HashSet());
|
|
}
|
|
((Set) hashMap.get(qualified)).add(provider);
|
|
}
|
|
}
|
|
}
|
|
for (Map.Entry entry2 : hashMap.entrySet()) {
|
|
if (!this.lazySetMap.containsKey(entry2.getKey())) {
|
|
this.lazySetMap.put((Qualified) entry2.getKey(), LazySet.fromCollection((Collection) entry2.getValue()));
|
|
} else {
|
|
final LazySet lazySet = (LazySet) this.lazySetMap.get(entry2.getKey());
|
|
for (final Provider provider2 : (Set) entry2.getValue()) {
|
|
arrayList.add(new Runnable() { // from class: com.google.firebase.components.ComponentRuntime$$ExternalSyntheticLambda3
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
LazySet.this.add(provider2);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
@Override // com.google.firebase.components.ComponentContainer
|
|
public synchronized Provider getProvider(Qualified qualified) {
|
|
Preconditions.checkNotNull(qualified, "Null interface requested.");
|
|
return (Provider) this.lazyInstanceMap.get(qualified);
|
|
}
|
|
|
|
@Override // com.google.firebase.components.ComponentContainer
|
|
public Deferred getDeferred(Qualified qualified) {
|
|
Provider provider = getProvider(qualified);
|
|
if (provider == null) {
|
|
return OptionalProvider.empty();
|
|
}
|
|
if (provider instanceof OptionalProvider) {
|
|
return (OptionalProvider) provider;
|
|
}
|
|
return OptionalProvider.of(provider);
|
|
}
|
|
|
|
@Override // com.google.firebase.components.ComponentContainer
|
|
public synchronized Provider setOfProvider(Qualified qualified) {
|
|
LazySet lazySet = (LazySet) this.lazySetMap.get(qualified);
|
|
if (lazySet != null) {
|
|
return lazySet;
|
|
}
|
|
return EMPTY_PROVIDER;
|
|
}
|
|
|
|
public void initializeEagerComponents(boolean z) {
|
|
HashMap hashMap;
|
|
if (LifecycleKt$$ExternalSyntheticBackportWithForwarding0.m(this.eagerComponentsInitializedWith, null, Boolean.valueOf(z))) {
|
|
synchronized (this) {
|
|
hashMap = new HashMap(this.components);
|
|
}
|
|
doInitializeEagerComponents(hashMap, z);
|
|
}
|
|
}
|
|
|
|
public final void doInitializeEagerComponents(Map map, boolean z) {
|
|
for (Map.Entry entry : map.entrySet()) {
|
|
Component component = (Component) entry.getKey();
|
|
Provider provider = (Provider) entry.getValue();
|
|
if (component.isAlwaysEager() || (component.isEagerInDefaultApp() && z)) {
|
|
provider.get();
|
|
}
|
|
}
|
|
this.eventBus.enablePublishingAndFlushPending();
|
|
}
|
|
|
|
public final void processDependencies() {
|
|
for (Component component : this.components.keySet()) {
|
|
for (Dependency dependency : component.getDependencies()) {
|
|
if (dependency.isSet() && !this.lazySetMap.containsKey(dependency.getInterface())) {
|
|
this.lazySetMap.put(dependency.getInterface(), LazySet.fromCollection(Collections.emptySet()));
|
|
} else if (this.lazyInstanceMap.containsKey(dependency.getInterface())) {
|
|
continue;
|
|
} else {
|
|
if (dependency.isRequired()) {
|
|
throw new MissingDependencyException(String.format("Unsatisfied dependency for component %s: %s", component, dependency.getInterface()));
|
|
}
|
|
if (!dependency.isSet()) {
|
|
this.lazyInstanceMap.put(dependency.getInterface(), OptionalProvider.empty());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public static final class Builder {
|
|
public final Executor defaultExecutor;
|
|
public final List lazyRegistrars = new ArrayList();
|
|
public final List additionalComponents = new ArrayList();
|
|
public ComponentRegistrarProcessor componentRegistrarProcessor = ComponentRegistrarProcessor.NOOP;
|
|
|
|
public static /* synthetic */ ComponentRegistrar lambda$addComponentRegistrar$0(ComponentRegistrar componentRegistrar) {
|
|
return componentRegistrar;
|
|
}
|
|
|
|
public Builder setProcessor(ComponentRegistrarProcessor componentRegistrarProcessor) {
|
|
this.componentRegistrarProcessor = componentRegistrarProcessor;
|
|
return this;
|
|
}
|
|
|
|
public Builder(Executor executor) {
|
|
this.defaultExecutor = executor;
|
|
}
|
|
|
|
public Builder addLazyComponentRegistrars(Collection collection) {
|
|
this.lazyRegistrars.addAll(collection);
|
|
return this;
|
|
}
|
|
|
|
public Builder addComponentRegistrar(final ComponentRegistrar componentRegistrar) {
|
|
this.lazyRegistrars.add(new Provider() { // from class: com.google.firebase.components.ComponentRuntime$Builder$$ExternalSyntheticLambda0
|
|
@Override // com.google.firebase.inject.Provider
|
|
public final Object get() {
|
|
ComponentRegistrar lambda$addComponentRegistrar$0;
|
|
lambda$addComponentRegistrar$0 = ComponentRuntime.Builder.lambda$addComponentRegistrar$0(ComponentRegistrar.this);
|
|
return lambda$addComponentRegistrar$0;
|
|
}
|
|
});
|
|
return this;
|
|
}
|
|
|
|
public Builder addComponent(Component component) {
|
|
this.additionalComponents.add(component);
|
|
return this;
|
|
}
|
|
|
|
public ComponentRuntime build() {
|
|
return new ComponentRuntime(this.defaultExecutor, this.lazyRegistrars, this.additionalComponents, this.componentRegistrarProcessor);
|
|
}
|
|
}
|
|
}
|