package androidx.versionedparcelable; import android.os.Parcelable; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /* loaded from: classes.dex */ public abstract class a { /* renamed from: a, reason: collision with root package name */ protected final androidx.collection.a f2772a; /* renamed from: b, reason: collision with root package name */ protected final androidx.collection.a f2773b; /* renamed from: c, reason: collision with root package name */ protected final androidx.collection.a f2774c; public a(androidx.collection.a aVar, androidx.collection.a aVar2, androidx.collection.a aVar3) { this.f2772a = aVar; this.f2773b = aVar2; this.f2774c = aVar3; } private void N(u0.a aVar) { try { I(c(aVar.getClass()).getName()); } catch (ClassNotFoundException e10) { throw new RuntimeException(aVar.getClass().getSimpleName() + " does not have a Parcelizer", e10); } } private Class c(Class cls) { Class cls2 = (Class) this.f2774c.get(cls.getName()); if (cls2 != null) { return cls2; } Class cls3 = Class.forName(String.format("%s.%sParcelizer", cls.getPackage().getName(), cls.getSimpleName()), false, cls.getClassLoader()); this.f2774c.put(cls.getName(), cls3); return cls3; } private Method d(String str) { Method method = (Method) this.f2772a.get(str); if (method != null) { return method; } System.currentTimeMillis(); Method declaredMethod = Class.forName(str, true, a.class.getClassLoader()).getDeclaredMethod("read", a.class); this.f2772a.put(str, declaredMethod); return declaredMethod; } /* JADX WARN: Multi-variable type inference failed */ private Method e(Class cls) { Method method = (Method) this.f2773b.get(cls.getName()); if (method != null) { return method; } Class c10 = c(cls); System.currentTimeMillis(); Method declaredMethod = c10.getDeclaredMethod("write", cls, a.class); this.f2773b.put(cls.getName(), declaredMethod); return declaredMethod; } protected abstract void A(byte[] bArr); public void B(byte[] bArr, int i10) { w(i10); A(bArr); } protected abstract void C(CharSequence charSequence); public void D(CharSequence charSequence, int i10) { w(i10); C(charSequence); } protected abstract void E(int i10); public void F(int i10, int i11) { w(i11); E(i10); } protected abstract void G(Parcelable parcelable); public void H(Parcelable parcelable, int i10) { w(i10); G(parcelable); } protected abstract void I(String str); public void J(String str, int i10) { w(i10); I(str); } protected void K(u0.a aVar, a aVar2) { try { e(aVar.getClass()).invoke(null, aVar, aVar2); } catch (ClassNotFoundException e10) { throw new RuntimeException("VersionedParcel encountered ClassNotFoundException", e10); } catch (IllegalAccessException e11) { throw new RuntimeException("VersionedParcel encountered IllegalAccessException", e11); } catch (NoSuchMethodException e12) { throw new RuntimeException("VersionedParcel encountered NoSuchMethodException", e12); } catch (InvocationTargetException e13) { if (!(e13.getCause() instanceof RuntimeException)) { throw new RuntimeException("VersionedParcel encountered InvocationTargetException", e13); } throw ((RuntimeException) e13.getCause()); } } protected void L(u0.a aVar) { if (aVar == null) { I(null); return; } N(aVar); a b10 = b(); K(aVar, b10); b10.a(); } public void M(u0.a aVar, int i10) { w(i10); L(aVar); } protected abstract void a(); protected abstract a b(); public boolean f() { return false; } protected abstract boolean g(); public boolean h(boolean z10, int i10) { return !m(i10) ? z10 : g(); } protected abstract byte[] i(); public byte[] j(byte[] bArr, int i10) { return !m(i10) ? bArr : i(); } protected abstract CharSequence k(); public CharSequence l(CharSequence charSequence, int i10) { return !m(i10) ? charSequence : k(); } protected abstract boolean m(int i10); protected u0.a n(String str, a aVar) { try { return (u0.a) d(str).invoke(null, aVar); } catch (ClassNotFoundException e10) { throw new RuntimeException("VersionedParcel encountered ClassNotFoundException", e10); } catch (IllegalAccessException e11) { throw new RuntimeException("VersionedParcel encountered IllegalAccessException", e11); } catch (NoSuchMethodException e12) { throw new RuntimeException("VersionedParcel encountered NoSuchMethodException", e12); } catch (InvocationTargetException e13) { if (e13.getCause() instanceof RuntimeException) { throw ((RuntimeException) e13.getCause()); } throw new RuntimeException("VersionedParcel encountered InvocationTargetException", e13); } } protected abstract int o(); public int p(int i10, int i11) { return !m(i11) ? i10 : o(); } protected abstract Parcelable q(); public Parcelable r(Parcelable parcelable, int i10) { return !m(i10) ? parcelable : q(); } protected abstract String s(); public String t(String str, int i10) { return !m(i10) ? str : s(); } protected u0.a u() { String s10 = s(); if (s10 == null) { return null; } return n(s10, b()); } public u0.a v(u0.a aVar, int i10) { return !m(i10) ? aVar : u(); } protected abstract void w(int i10); public void x(boolean z10, boolean z11) { } protected abstract void y(boolean z10); public void z(boolean z10, int i10) { w(i10); y(z10); } }