package defpackage;

import android.os.Parcel;
import android.os.Parcelable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/* renamed from: ᵻˀˋ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public abstract class AbstractC5181 {

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final C1200 f19355;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final C1200 f19356;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final C1200 f19357;

    public AbstractC5181(C1200 c1200, C1200 c12002, C1200 c12003) {
        this.f19356 = c1200;
        this.f19357 = c12002;
        this.f19355 = c12003;
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public abstract boolean mo10731(int i);

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final Parcelable m10732(Parcelable parcelable, int i) {
        if (!mo10731(i)) {
            return parcelable;
        }
        return ((C5185) this).f19361.readParcelable(C5185.class.getClassLoader());
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final int m10733(int i, int i2) {
        return !mo10731(i2) ? i : ((C5185) this).f19361.readInt();
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final Method m10734(String str) throws NoSuchMethodException, SecurityException {
        C1200 c1200 = this.f19356;
        Method method = (Method) c1200.get(str);
        if (method != null) {
            return method;
        }
        System.currentTimeMillis();
        Method declaredMethod = Class.forName(str, true, AbstractC5181.class.getClassLoader()).getDeclaredMethod("read", AbstractC5181.class);
        c1200.put(str, declaredMethod);
        return declaredMethod;
    }

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public abstract void mo10735(int i);

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public abstract C5185 mo10736();

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final Class m10737(Class cls) throws ClassNotFoundException {
        String name = cls.getName();
        C1200 c1200 = this.f19355;
        Class cls2 = (Class) c1200.get(name);
        if (cls2 != null) {
            return cls2;
        }
        Class<?> cls3 = Class.forName(cls.getPackage().getName() + "." + cls.getSimpleName() + "Parcelizer", false, cls.getClassLoader());
        c1200.put(cls.getName(), cls3);
        return cls3;
    }

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public final void m10738(int i, int i2) {
        mo10735(i2);
        ((C5185) this).f19361.writeInt(i);
    }

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public final void m10739(InterfaceC0396 interfaceC0396) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        if (interfaceC0396 == null) {
            ((C5185) this).f19361.writeString(null);
            return;
        }
        try {
            ((C5185) this).f19361.writeString(m10737(interfaceC0396.getClass()).getName());
            C5185 c5185Mo10736 = mo10736();
            try {
                m10741(interfaceC0396.getClass()).invoke(null, interfaceC0396, c5185Mo10736);
                Parcel parcel = c5185Mo10736.f19361;
                int i = c5185Mo10736.f19364;
                if (i >= 0) {
                    int i2 = c5185Mo10736.f19368.get(i);
                    int iDataPosition = parcel.dataPosition();
                    parcel.setDataPosition(i2);
                    parcel.writeInt(iDataPosition - i2);
                    parcel.setDataPosition(iDataPosition);
                }
            } catch (ClassNotFoundException e) {
                ᵨᴵᵺ.ᵪʩ("VersionedParcel encountered ClassNotFoundException", e);
            } catch (IllegalAccessException e2) {
                ᵨᴵᵺ.ᵪʩ("VersionedParcel encountered IllegalAccessException", e2);
            } catch (NoSuchMethodException e3) {
                ᵨᴵᵺ.ᵪʩ("VersionedParcel encountered NoSuchMethodException", e3);
            } catch (InvocationTargetException e4) {
                if (e4.getCause() instanceof RuntimeException) {
                    throw ((RuntimeException) e4.getCause());
                }
                ᵨᴵᵺ.ᵪʩ("VersionedParcel encountered InvocationTargetException", e4);
            }
        } catch (ClassNotFoundException e5) {
            ᵨᴵᵺ.ᵪʩ(interfaceC0396.getClass().getSimpleName().concat(" does not have a Parcelizer"), e5);
        }
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final InterfaceC0396 m10740() {
        String string = ((C5185) this).f19361.readString();
        if (string == null) {
            return null;
        }
        try {
            return (InterfaceC0396) m10734(string).invoke(null, mo10736());
        } catch (ClassNotFoundException e) {
            ᵨᴵᵺ.ᵪʩ("VersionedParcel encountered ClassNotFoundException", e);
            return null;
        } catch (IllegalAccessException e2) {
            ᵨᴵᵺ.ᵪʩ("VersionedParcel encountered IllegalAccessException", e2);
            return null;
        } catch (NoSuchMethodException e3) {
            ᵨᴵᵺ.ᵪʩ("VersionedParcel encountered NoSuchMethodException", e3);
            return null;
        } catch (InvocationTargetException e4) {
            if (e4.getCause() instanceof RuntimeException) {
                throw ((RuntimeException) e4.getCause());
            }
            ᵨᴵᵺ.ᵪʩ("VersionedParcel encountered InvocationTargetException", e4);
            return null;
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final Method m10741(Class cls) throws NoSuchMethodException, ClassNotFoundException, SecurityException {
        String name = cls.getName();
        C1200 c1200 = this.f19357;
        Method method = (Method) c1200.get(name);
        if (method != null) {
            return method;
        }
        Class clsM10737 = m10737(cls);
        System.currentTimeMillis();
        Method declaredMethod = clsM10737.getDeclaredMethod("write", cls, AbstractC5181.class);
        c1200.put(cls.getName(), declaredMethod);
        return declaredMethod;
    }
}
