- 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
64 lines
3.2 KiB
Java
64 lines
3.2 KiB
Java
package androidx.lifecycle;
|
|
|
|
import android.app.Application;
|
|
import androidx.annotation.RestrictTo;
|
|
import java.lang.reflect.Constructor;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import kotlin.collections.ArraysKt___ArraysKt;
|
|
import kotlin.collections.CollectionsKt__CollectionsJVMKt;
|
|
import kotlin.collections.CollectionsKt__CollectionsKt;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
/* loaded from: classes.dex */
|
|
public final class SavedStateViewModelFactoryKt {
|
|
private static final List<Class<?>> ANDROID_VIEWMODEL_SIGNATURE;
|
|
private static final List<Class<?>> VIEWMODEL_SIGNATURE;
|
|
|
|
public static final <T extends ViewModel> T newInstance(Class<T> modelClass, Constructor<T> constructor, Object... params) {
|
|
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
|
|
Intrinsics.checkNotNullParameter(constructor, "constructor");
|
|
Intrinsics.checkNotNullParameter(params, "params");
|
|
try {
|
|
return constructor.newInstance(Arrays.copyOf(params, params.length));
|
|
} catch (IllegalAccessException e) {
|
|
throw new RuntimeException("Failed to access " + modelClass, e);
|
|
} catch (InstantiationException e2) {
|
|
throw new RuntimeException("A " + modelClass + " cannot be instantiated.", e2);
|
|
} catch (InvocationTargetException e3) {
|
|
throw new RuntimeException("An exception happened in constructor of " + modelClass, e3.getCause());
|
|
}
|
|
}
|
|
|
|
static {
|
|
List<Class<?>> listOf;
|
|
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new Class[]{Application.class, SavedStateHandle.class});
|
|
ANDROID_VIEWMODEL_SIGNATURE = listOf;
|
|
VIEWMODEL_SIGNATURE = CollectionsKt__CollectionsJVMKt.listOf(SavedStateHandle.class);
|
|
}
|
|
|
|
public static final <T> Constructor<T> findMatchingConstructor(Class<T> modelClass, List<? extends Class<?>> signature) {
|
|
List list;
|
|
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
|
|
Intrinsics.checkNotNullParameter(signature, "signature");
|
|
Object[] constructors = modelClass.getConstructors();
|
|
Intrinsics.checkNotNullExpressionValue(constructors, "modelClass.constructors");
|
|
for (Object obj : constructors) {
|
|
Constructor<T> constructor = (Constructor<T>) obj;
|
|
Class<?>[] parameterTypes = constructor.getParameterTypes();
|
|
Intrinsics.checkNotNullExpressionValue(parameterTypes, "constructor.parameterTypes");
|
|
list = ArraysKt___ArraysKt.toList(parameterTypes);
|
|
if (Intrinsics.areEqual(signature, list)) {
|
|
Intrinsics.checkNotNull(constructor, "null cannot be cast to non-null type java.lang.reflect.Constructor<T of androidx.lifecycle.SavedStateViewModelFactoryKt.findMatchingConstructor>");
|
|
return constructor;
|
|
}
|
|
if (signature.size() == list.size() && list.containsAll(signature)) {
|
|
throw new UnsupportedOperationException("Class " + modelClass.getSimpleName() + " must have parameters in the proper order: " + signature);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|