package defpackage;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

/* JADX INFO: renamed from: ˇˁᵫᵽ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C0950 {

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public static final C0950 f4131 = new C0950();

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final HashMap f4133 = new HashMap();

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final HashMap f4132 = new HashMap();

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public static void m3205(HashMap map, C0711 c0711, EnumC1653 enumC1653, Class cls) {
        EnumC1653 enumC16532 = (EnumC1653) map.get(c0711);
        if (enumC16532 == null || enumC1653 == enumC16532) {
            if (enumC16532 == null) {
                map.put(c0711, enumC1653);
            }
        } else {
            String name = c0711.f3247.getName();
            String name2 = cls.getName();
            ᵕᵩʽᵲ.ᵮᵣᵗˈ(AbstractC0793.m2864(AbstractC3653.m8226("Method ", name, " in ", name2, " already declared with different @OnLifecycleEvent value: previous value "), String.valueOf(enumC16532), ", new value ", String.valueOf(enumC1653)));
        }
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final C4644 m3206(Class cls, Method[] methodArr) {
        int i;
        Class superclass = cls.getSuperclass();
        HashMap map = new HashMap();
        HashMap map2 = this.f4133;
        if (superclass != null) {
            C4644 c4644M3206 = (C4644) map2.get(superclass);
            if (c4644M3206 == null) {
                c4644M3206 = m3206(superclass, null);
            }
            map.putAll(c4644M3206.f17652);
        }
        for (Class<?> cls2 : cls.getInterfaces()) {
            C4644 c4644M32062 = (C4644) map2.get(cls2);
            if (c4644M32062 == null) {
                c4644M32062 = m3206(cls2, null);
            }
            for (Map.Entry entry : c4644M32062.f17652.entrySet()) {
                m3205(map, (C0711) entry.getKey(), (EnumC1653) entry.getValue(), cls);
            }
        }
        if (methodArr == null) {
            try {
                methodArr = cls.getDeclaredMethods();
            } catch (NoClassDefFoundError e) {
                throw new IllegalArgumentException("The observer class has some methods that use newer APIs which are not available in the current OS version. Lifecycles cannot access even other methods so you should make sure that your observer classes only access framework classes that are available in your min API level OR use lifecycle:compiler annotation processor.", e);
            }
        }
        boolean z = false;
        for (Method method : methodArr) {
            InterfaceC3323 interfaceC3323 = (InterfaceC3323) method.getAnnotation(InterfaceC3323.class);
            if (interfaceC3323 != null) {
                Class<?>[] parameterTypes = method.getParameterTypes();
                if (parameterTypes.length <= 0) {
                    i = 0;
                } else {
                    if (!InterfaceC1569.class.isAssignableFrom(parameterTypes[0])) {
                        ᵕᵩʽᵲ.ᵮᵣᵗˈ("invalid parameter type. Must be one and instanceof LifecycleOwner");
                        return null;
                    }
                    i = 1;
                }
                EnumC1653 enumC1653Value = interfaceC3323.value();
                if (parameterTypes.length > 1) {
                    if (!EnumC1653.class.isAssignableFrom(parameterTypes[1])) {
                        ᵕᵩʽᵲ.ᵮᵣᵗˈ("invalid parameter type. second arg must be an event");
                        return null;
                    }
                    if (enumC1653Value != EnumC1653.ON_ANY) {
                        ᵕᵩʽᵲ.ᵮᵣᵗˈ("Second arg is supported only for ON_ANY value");
                        return null;
                    }
                    i = 2;
                }
                if (parameterTypes.length > 2) {
                    ᵕᵩʽᵲ.ᵮᵣᵗˈ("cannot have more than 2 params");
                    return null;
                }
                m3205(map, new C0711(i, method), enumC1653Value, cls);
                z = true;
            }
        }
        C4644 c4644 = new C4644(map);
        map2.put(cls, c4644);
        this.f4132.put(cls, Boolean.valueOf(z));
        return c4644;
    }
}
