Files
rr3-apk/decompiled/sources/com/google/firebase/components/RestrictedComponentContainer.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

122 lines
5.3 KiB
Java

package com.google.firebase.components;
import com.google.firebase.events.Publisher;
import com.google.firebase.inject.Deferred;
import com.google.firebase.inject.Provider;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/* loaded from: classes3.dex */
public final class RestrictedComponentContainer implements ComponentContainer {
public final Set allowedDeferredInterfaces;
public final Set allowedDirectInterfaces;
public final Set allowedProviderInterfaces;
public final Set allowedPublishedEvents;
public final Set allowedSetDirectInterfaces;
public final Set allowedSetProviderInterfaces;
public final ComponentContainer delegateContainer;
public RestrictedComponentContainer(Component component, ComponentContainer componentContainer) {
HashSet hashSet = new HashSet();
HashSet hashSet2 = new HashSet();
HashSet hashSet3 = new HashSet();
HashSet hashSet4 = new HashSet();
HashSet hashSet5 = new HashSet();
for (Dependency dependency : component.getDependencies()) {
if (dependency.isDirectInjection()) {
if (dependency.isSet()) {
hashSet4.add(dependency.getInterface());
} else {
hashSet.add(dependency.getInterface());
}
} else if (dependency.isDeferred()) {
hashSet3.add(dependency.getInterface());
} else if (dependency.isSet()) {
hashSet5.add(dependency.getInterface());
} else {
hashSet2.add(dependency.getInterface());
}
}
if (!component.getPublishedEvents().isEmpty()) {
hashSet.add(Qualified.unqualified(Publisher.class));
}
this.allowedDirectInterfaces = Collections.unmodifiableSet(hashSet);
this.allowedProviderInterfaces = Collections.unmodifiableSet(hashSet2);
this.allowedDeferredInterfaces = Collections.unmodifiableSet(hashSet3);
this.allowedSetDirectInterfaces = Collections.unmodifiableSet(hashSet4);
this.allowedSetProviderInterfaces = Collections.unmodifiableSet(hashSet5);
this.allowedPublishedEvents = component.getPublishedEvents();
this.delegateContainer = componentContainer;
}
@Override // com.google.firebase.components.ComponentContainer
public Object get(Class cls) {
if (!this.allowedDirectInterfaces.contains(Qualified.unqualified(cls))) {
throw new DependencyException(String.format("Attempting to request an undeclared dependency %s.", cls));
}
Object obj = this.delegateContainer.get(cls);
return !cls.equals(Publisher.class) ? obj : new RestrictedPublisher(this.allowedPublishedEvents, (Publisher) obj);
}
@Override // com.google.firebase.components.ComponentContainer
public Object get(Qualified qualified) {
if (!this.allowedDirectInterfaces.contains(qualified)) {
throw new DependencyException(String.format("Attempting to request an undeclared dependency %s.", qualified));
}
return this.delegateContainer.get(qualified);
}
@Override // com.google.firebase.components.ComponentContainer
public Provider getProvider(Class cls) {
return getProvider(Qualified.unqualified(cls));
}
@Override // com.google.firebase.components.ComponentContainer
public Deferred getDeferred(Class cls) {
return getDeferred(Qualified.unqualified(cls));
}
@Override // com.google.firebase.components.ComponentContainer
public Provider getProvider(Qualified qualified) {
if (!this.allowedProviderInterfaces.contains(qualified)) {
throw new DependencyException(String.format("Attempting to request an undeclared dependency Provider<%s>.", qualified));
}
return this.delegateContainer.getProvider(qualified);
}
@Override // com.google.firebase.components.ComponentContainer
public Deferred getDeferred(Qualified qualified) {
if (!this.allowedDeferredInterfaces.contains(qualified)) {
throw new DependencyException(String.format("Attempting to request an undeclared dependency Deferred<%s>.", qualified));
}
return this.delegateContainer.getDeferred(qualified);
}
@Override // com.google.firebase.components.ComponentContainer
public Provider setOfProvider(Qualified qualified) {
if (!this.allowedSetProviderInterfaces.contains(qualified)) {
throw new DependencyException(String.format("Attempting to request an undeclared dependency Provider<Set<%s>>.", qualified));
}
return this.delegateContainer.setOfProvider(qualified);
}
@Override // com.google.firebase.components.ComponentContainer
public Set setOf(Qualified qualified) {
if (!this.allowedSetDirectInterfaces.contains(qualified)) {
throw new DependencyException(String.format("Attempting to request an undeclared dependency Set<%s>.", qualified));
}
return this.delegateContainer.setOf(qualified);
}
public static class RestrictedPublisher implements Publisher {
public final Set allowedPublishedEvents;
public final Publisher delegate;
public RestrictedPublisher(Set set, Publisher publisher) {
this.allowedPublishedEvents = set;
this.delegate = publisher;
}
}
}