Files

135 lines
4.7 KiB
Java

package D0;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import s.e;
/* loaded from: classes.dex */
public abstract class b {
/* renamed from: a, reason: collision with root package name */
public final e f361a;
/* renamed from: b, reason: collision with root package name */
public final e f362b;
/* renamed from: c, reason: collision with root package name */
public final e f363c;
public b(e eVar, e eVar2, e eVar3) {
this.f361a = eVar;
this.f362b = eVar2;
this.f363c = eVar3;
}
public abstract c a();
public final Class b(Class cls) {
String name = cls.getName();
e eVar = this.f363c;
Class cls2 = (Class) eVar.get(name);
if (cls2 != null) {
return cls2;
}
Class<?> cls3 = Class.forName(cls.getPackage().getName() + "." + cls.getSimpleName() + "Parcelizer", false, cls.getClassLoader());
eVar.put(cls.getName(), cls3);
return cls3;
}
public final Method c(String str) {
e eVar = this.f361a;
Method method = (Method) eVar.get(str);
if (method != null) {
return method;
}
System.currentTimeMillis();
Method declaredMethod = Class.forName(str, true, b.class.getClassLoader()).getDeclaredMethod("read", b.class);
eVar.put(str, declaredMethod);
return declaredMethod;
}
public final Method d(Class cls) {
String name = cls.getName();
e eVar = this.f362b;
Method method = (Method) eVar.get(name);
if (method != null) {
return method;
}
Class b4 = b(cls);
System.currentTimeMillis();
Method declaredMethod = b4.getDeclaredMethod("write", cls, b.class);
eVar.put(cls.getName(), declaredMethod);
return declaredMethod;
}
public abstract boolean e(int i);
public final Parcelable f(Parcelable parcelable, int i) {
if (!e(i)) {
return parcelable;
}
return ((c) this).f365e.readParcelable(c.class.getClassLoader());
}
public final d g() {
String readString = ((c) this).f365e.readString();
if (readString == null) {
return null;
}
try {
return (d) c(readString).invoke(null, a());
} catch (ClassNotFoundException e4) {
throw new RuntimeException("VersionedParcel encountered ClassNotFoundException", e4);
} catch (IllegalAccessException e5) {
throw new RuntimeException("VersionedParcel encountered IllegalAccessException", e5);
} catch (NoSuchMethodException e6) {
throw new RuntimeException("VersionedParcel encountered NoSuchMethodException", e6);
} catch (InvocationTargetException e7) {
if (e7.getCause() instanceof RuntimeException) {
throw ((RuntimeException) e7.getCause());
}
throw new RuntimeException("VersionedParcel encountered InvocationTargetException", e7);
}
}
public abstract void h(int i);
public final void i(d dVar) {
if (dVar == null) {
((c) this).f365e.writeString(null);
return;
}
try {
((c) this).f365e.writeString(b(dVar.getClass()).getName());
c a2 = a();
try {
d(dVar.getClass()).invoke(null, dVar, a2);
int i = a2.i;
if (i >= 0) {
int i4 = a2.f364d.get(i);
Parcel parcel = a2.f365e;
int dataPosition = parcel.dataPosition();
parcel.setDataPosition(i4);
parcel.writeInt(dataPosition - i4);
parcel.setDataPosition(dataPosition);
}
} catch (ClassNotFoundException e4) {
throw new RuntimeException("VersionedParcel encountered ClassNotFoundException", e4);
} catch (IllegalAccessException e5) {
throw new RuntimeException("VersionedParcel encountered IllegalAccessException", e5);
} catch (NoSuchMethodException e6) {
throw new RuntimeException("VersionedParcel encountered NoSuchMethodException", e6);
} catch (InvocationTargetException e7) {
if (!(e7.getCause() instanceof RuntimeException)) {
throw new RuntimeException("VersionedParcel encountered InvocationTargetException", e7);
}
throw ((RuntimeException) e7.getCause());
}
} catch (ClassNotFoundException e8) {
throw new RuntimeException(dVar.getClass().getSimpleName().concat(" does not have a Parcelizer"), e8);
}
}
}