package defpackage;

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

/* JADX INFO: renamed from: ᵡᵮˋ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public abstract class AbstractC3228 {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final C3310 f12289;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final C3310 f12290;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final C3310 f12291;

    public AbstractC3228(C3310 c3310, C3310 c33102, C3310 c33103) {
        this.f12291 = c3310;
        this.f12289 = c33102;
        this.f12290 = c33103;
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final Class m7378(Class cls) throws ClassNotFoundException {
        String name = cls.getName();
        C3310 c3310 = this.f12290;
        Class cls2 = (Class) c3310.get(name);
        if (cls2 != null) {
            return cls2;
        }
        Class<?> cls3 = Class.forName(cls.getPackage().getName() + "." + cls.getSimpleName() + "Parcelizer", false, cls.getClassLoader());
        c3310.put(cls.getName(), cls3);
        return cls3;
    }

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final InterfaceC5423 m7379() {
        String string = ((C2096) this).f8305.readString();
        if (string == null) {
            return null;
        }
        try {
            return (InterfaceC5423) m7380(string).invoke(null, mo5581());
        } 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 INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final Method m7380(String str) throws NoSuchMethodException {
        C3310 c3310 = this.f12291;
        Method method = (Method) c3310.get(str);
        if (method != null) {
            return method;
        }
        System.currentTimeMillis();
        Method declaredMethod = Class.forName(str, true, AbstractC3228.class.getClassLoader()).getDeclaredMethod("read", AbstractC3228.class);
        c3310.put(str, declaredMethod);
        return declaredMethod;
    }

    /* JADX INFO: renamed from: ᵨᵣ */
    public abstract boolean mo5580(int i);

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final void m7381(int i, int i2) {
        mo5582(i2);
        ((C2096) this).f8305.writeInt(i);
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    public abstract C2096 mo5581();

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final Parcelable m7382(Parcelable parcelable, int i) {
        if (!mo5580(i)) {
            return parcelable;
        }
        return ((C2096) this).f8305.readParcelable(C2096.class.getClassLoader());
    }

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public final void m7383(InterfaceC5423 interfaceC5423) {
        if (interfaceC5423 == null) {
            ((C2096) this).f8305.writeString(null);
            return;
        }
        try {
            ((C2096) this).f8305.writeString(m7378(interfaceC5423.getClass()).getName());
            C2096 c2096Mo5581 = mo5581();
            try {
                m7384(interfaceC5423.getClass()).invoke(null, interfaceC5423, c2096Mo5581);
                Parcel parcel = c2096Mo5581.f8305;
                int i = c2096Mo5581.f8310;
                if (i >= 0) {
                    int i2 = c2096Mo5581.f8309.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) {
            ᵷᵝˎ.ᵪᵹᵥᵻ(interfaceC5423.getClass().getSimpleName().concat(" does not have a Parcelizer"), e5);
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final Method m7384(Class cls) throws NoSuchMethodException, ClassNotFoundException {
        String name = cls.getName();
        C3310 c3310 = this.f12289;
        Method method = (Method) c3310.get(name);
        if (method != null) {
            return method;
        }
        Class clsM7378 = m7378(cls);
        System.currentTimeMillis();
        Method declaredMethod = clsM7378.getDeclaredMethod("write", cls, AbstractC3228.class);
        c3310.put(cls.getName(), declaredMethod);
        return declaredMethod;
    }

    /* JADX INFO: renamed from: ᵻʽᵯ */
    public abstract void mo5582(int i);

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final int m7385(int i, int i2) {
        return !mo5580(i2) ? i : ((C2096) this).f8305.readInt();
    }
}
