Initial import of ADIF API reverse-engineering toolkit

This commit is contained in:
2025-12-16 08:37:56 +01:00
commit 60388529c1
11486 changed files with 1086536 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
package dagger.hilt.android;
import android.content.ComponentCallbacks2;
import android.content.Context;
import dagger.hilt.EntryPoints;
import dagger.hilt.android.internal.Contexts;
import dagger.hilt.internal.GeneratedComponentManager;
import dagger.hilt.internal.GeneratedComponentManagerHolder;
import dagger.hilt.internal.Preconditions;
import dagger.hilt.internal.TestSingletonComponentManager;
import java.lang.annotation.Annotation;
/* loaded from: classes3.dex */
public final class EarlyEntryPoints {
private EarlyEntryPoints() {
}
public static <T> T get(Context context, Class<T> cls) {
ComponentCallbacks2 application = Contexts.getApplication(context);
Preconditions.checkState(application instanceof GeneratedComponentManagerHolder, "Expected application to implement GeneratedComponentManagerHolder. Check that you're passing in an application context that uses Hilt. Application class found: %s", application.getClass());
GeneratedComponentManager<?> componentManager = ((GeneratedComponentManagerHolder) application).componentManager();
if (!(componentManager instanceof TestSingletonComponentManager)) {
return (T) EntryPoints.get(application, cls);
}
Preconditions.checkState(hasAnnotationReflection(cls, EarlyEntryPoint.class), "%s should be called with EntryPoints.get() rather than EarlyEntryPoints.get()", cls.getCanonicalName());
return cls.cast(((TestSingletonComponentManager) componentManager).earlySingletonComponent());
}
private static boolean hasAnnotationReflection(Class<?> cls, Class<? extends Annotation> cls2) {
for (Annotation annotation : cls.getAnnotations()) {
if (annotation.annotationType().equals(cls2)) {
return true;
}
}
return false;
}
}