package ῲ.ᑓ;

import android.os.Parcelable;
import android.text.TextUtils;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import ῲ.㴹.C2284;

/* renamed from: ῲ.ᑓ.K  reason: contains not printable characters */
/* compiled from: VersionedParcel */
public abstract class AbstractC1617 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public final C2284<String, Class> f5812;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final C2284<String, Method> f5813;

    /* renamed from: K  reason: contains not printable characters */
    public final C2284<String, Method> f5814;

    public AbstractC1617(C2284<String, Method> k, C2284<String, Method> k2, C2284<String, Class> k3) {
        this.f5814 = k;
        this.f5813 = k2;
        this.f5812 = k3;
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public <T extends AbstractC1615> T m4191() {
        String readString = ((C1616) this).f5804.readString();
        if (readString == null) {
            return null;
        }
        AbstractC1617 r2 = m4193();
        try {
            return (T) ((AbstractC1615) m4202(readString).invoke(null, r2));
        } catch (IllegalAccessException e) {
            throw new RuntimeException("VersionedParcel encountered IllegalAccessException", e);
        } catch (InvocationTargetException e2) {
            if (e2.getCause() instanceof RuntimeException) {
                throw ((RuntimeException) e2.getCause());
            }
            throw new RuntimeException("VersionedParcel encountered InvocationTargetException", e2);
        } catch (NoSuchMethodException e3) {
            throw new RuntimeException("VersionedParcel encountered NoSuchMethodException", e3);
        } catch (ClassNotFoundException e4) {
            throw new RuntimeException("VersionedParcel encountered ClassNotFoundException", e4);
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public abstract AbstractC1617 m4193();

    /* renamed from: ῲ  reason: contains not printable characters */
    public abstract void m4194(int i);

    /* renamed from: ῲ  reason: contains not printable characters */
    public void m4195(int i, int i2) {
        m4194(i2);
        ((C1616) this).f5804.writeInt(i);
    }

    /* renamed from: K  reason: contains not printable characters */
    public abstract void m4203();

    /* renamed from: K  reason: contains not printable characters */
    public abstract boolean m4205(int i);

    /* renamed from: K  reason: contains not printable characters */
    public boolean m4206(boolean z, int i) {
        if (!m4205(i)) {
            return z;
        }
        return ((C1616) this).f5804.readInt() != 0;
    }

    /* renamed from: 㸾  reason: contains not printable characters */
    public void m4207() {
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public void m4196(Parcelable parcelable, int i) {
        m4194(i);
        ((C1616) this).f5804.writeParcelable(parcelable, 0);
    }

    /* renamed from: K  reason: contains not printable characters */
    public int m4197(int i, int i2) {
        if (!m4205(i2)) {
            return i;
        }
        return ((C1616) this).f5804.readInt();
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public final Method m4192(Class cls) throws IllegalAccessException, NoSuchMethodException, ClassNotFoundException {
        Method orDefault = this.f5813.getOrDefault(cls.getName(), null);
        if (orDefault != null) {
            return orDefault;
        }
        Class r0 = m4200(cls);
        System.currentTimeMillis();
        Method declaredMethod = r0.getDeclaredMethod("write", cls, AbstractC1617.class);
        this.f5813.put(cls.getName(), declaredMethod);
        return declaredMethod;
    }

    /* renamed from: K  reason: contains not printable characters */
    public String m4201(String str, int i) {
        if (!m4205(i)) {
            return str;
        }
        return ((C1616) this).f5804.readString();
    }

    /* renamed from: K  reason: contains not printable characters */
    public <T extends Parcelable> T m4198(T t, int i) {
        return !m4205(i) ? t : (T) ((C1616) this).f5804.readParcelable(C1616.class.getClassLoader());
    }

    /* renamed from: K  reason: contains not printable characters */
    public CharSequence m4199(CharSequence charSequence, int i) {
        if (!m4205(i)) {
            return charSequence;
        }
        return (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(((C1616) this).f5804);
    }

    /* JADX DEBUG: Multi-variable search result rejected for r5v0, resolved type: ῲ.ᑓ.K */
    /* JADX WARN: Multi-variable type inference failed */
    /* renamed from: K  reason: contains not printable characters */
    public void m4204(AbstractC1615 r6) {
        if (r6 == null) {
            ((C1616) this).f5804.writeString(null);
            return;
        }
        try {
            ((C1616) this).f5804.writeString(m4200((Class<? extends AbstractC1615>) r6.getClass()).getName());
            AbstractC1617 r1 = m4193();
            try {
                m4192(r6.getClass()).invoke(null, r6, r1);
                r1.m4203();
            } catch (IllegalAccessException e) {
                throw new RuntimeException("VersionedParcel encountered IllegalAccessException", e);
            } catch (InvocationTargetException e2) {
                if (e2.getCause() instanceof RuntimeException) {
                    throw ((RuntimeException) e2.getCause());
                }
                throw new RuntimeException("VersionedParcel encountered InvocationTargetException", e2);
            } catch (NoSuchMethodException e3) {
                throw new RuntimeException("VersionedParcel encountered NoSuchMethodException", e3);
            } catch (ClassNotFoundException e4) {
                throw new RuntimeException("VersionedParcel encountered ClassNotFoundException", e4);
            }
        } catch (ClassNotFoundException e5) {
            throw new RuntimeException(r6.getClass().getSimpleName() + " does not have a Parcelizer", e5);
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public final Method m4202(String str) throws IllegalAccessException, NoSuchMethodException, ClassNotFoundException {
        Method orDefault = this.f5814.getOrDefault(str, null);
        if (orDefault != null) {
            return orDefault;
        }
        System.currentTimeMillis();
        Method declaredMethod = Class.forName(str, true, AbstractC1617.class.getClassLoader()).getDeclaredMethod("read", AbstractC1617.class);
        this.f5814.put(str, declaredMethod);
        return declaredMethod;
    }

    /* renamed from: K  reason: contains not printable characters */
    public final Class m4200(Class<? extends AbstractC1615> cls) throws ClassNotFoundException {
        Class orDefault = this.f5812.getOrDefault(cls.getName(), null);
        if (orDefault != null) {
            return orDefault;
        }
        Class<?> cls2 = Class.forName(String.format("%s.%sParcelizer", cls.getPackage().getName(), cls.getSimpleName()), false, cls.getClassLoader());
        this.f5812.put(cls.getName(), cls2);
        return cls2;
    }
}
