211 lines
6.3 KiB
Java
211 lines
6.3 KiB
Java
|
package androidx.versionedparcelable;
|
||
|
|
||
|
import android.os.Parcelable;
|
||
|
import java.lang.reflect.InvocationTargetException;
|
||
|
import java.lang.reflect.Method;
|
||
|
import o.YiR;
|
||
|
import o.nyh;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public abstract class VersionedParcel {
|
||
|
public final nyh<String, Method> b;
|
||
|
public final nyh<String, Class> d;
|
||
|
public final nyh<String, Method> e;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public static class ParcelException extends RuntimeException {
|
||
|
}
|
||
|
|
||
|
public static boolean d() {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
protected abstract <T extends Parcelable> T Cb_();
|
||
|
|
||
|
protected abstract void Cc_(Parcelable parcelable);
|
||
|
|
||
|
protected abstract void a(boolean z);
|
||
|
|
||
|
protected abstract boolean a(int i);
|
||
|
|
||
|
protected abstract byte[] a();
|
||
|
|
||
|
protected abstract void b(int i);
|
||
|
|
||
|
protected abstract boolean b();
|
||
|
|
||
|
protected abstract VersionedParcel c();
|
||
|
|
||
|
protected abstract void c(CharSequence charSequence);
|
||
|
|
||
|
protected abstract void d(String str);
|
||
|
|
||
|
protected abstract void d(byte[] bArr);
|
||
|
|
||
|
protected abstract void e();
|
||
|
|
||
|
protected abstract void e(int i);
|
||
|
|
||
|
protected abstract String f();
|
||
|
|
||
|
protected abstract CharSequence i();
|
||
|
|
||
|
protected abstract int j();
|
||
|
|
||
|
public VersionedParcel(nyh<String, Method> nyhVar, nyh<String, Method> nyhVar2, nyh<String, Class> nyhVar3) {
|
||
|
this.e = nyhVar;
|
||
|
this.b = nyhVar2;
|
||
|
this.d = nyhVar3;
|
||
|
}
|
||
|
|
||
|
public final void d(boolean z, int i) {
|
||
|
b(i);
|
||
|
a(z);
|
||
|
}
|
||
|
|
||
|
public final void e(byte[] bArr) {
|
||
|
b(2);
|
||
|
d(bArr);
|
||
|
}
|
||
|
|
||
|
public final void a(CharSequence charSequence, int i) {
|
||
|
b(i);
|
||
|
c(charSequence);
|
||
|
}
|
||
|
|
||
|
public final void e(int i, int i2) {
|
||
|
b(i2);
|
||
|
e(i);
|
||
|
}
|
||
|
|
||
|
public final void a(String str, int i) {
|
||
|
b(i);
|
||
|
d(str);
|
||
|
}
|
||
|
|
||
|
public final void Ca_(Parcelable parcelable, int i) {
|
||
|
b(i);
|
||
|
Cc_(parcelable);
|
||
|
}
|
||
|
|
||
|
public final boolean e(boolean z, int i) {
|
||
|
return !a(i) ? z : b();
|
||
|
}
|
||
|
|
||
|
public final int c(int i, int i2) {
|
||
|
return !a(i2) ? i : j();
|
||
|
}
|
||
|
|
||
|
public final String b(String str, int i) {
|
||
|
return !a(i) ? str : f();
|
||
|
}
|
||
|
|
||
|
public final byte[] b(byte[] bArr) {
|
||
|
return !a(2) ? bArr : a();
|
||
|
}
|
||
|
|
||
|
public final <T extends Parcelable> T BY_(T t, int i) {
|
||
|
return !a(i) ? t : (T) Cb_();
|
||
|
}
|
||
|
|
||
|
public final CharSequence e(CharSequence charSequence, int i) {
|
||
|
return !a(i) ? charSequence : i();
|
||
|
}
|
||
|
|
||
|
public final void a(YiR yiR) {
|
||
|
b(1);
|
||
|
e(yiR);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
public final void e(YiR yiR) {
|
||
|
if (yiR == null) {
|
||
|
d((String) null);
|
||
|
return;
|
||
|
}
|
||
|
try {
|
||
|
d(a((Class<? extends YiR>) yiR.getClass()).getName());
|
||
|
VersionedParcel c = c();
|
||
|
try {
|
||
|
Class<?> cls = yiR.getClass();
|
||
|
Method method = this.b.get(cls.getName());
|
||
|
if (method == null) {
|
||
|
method = a((Class<? extends YiR>) cls).getDeclaredMethod("write", cls, VersionedParcel.class);
|
||
|
this.b.put(cls.getName(), method);
|
||
|
}
|
||
|
method.invoke(null, yiR, c);
|
||
|
c.e();
|
||
|
} catch (ClassNotFoundException e) {
|
||
|
throw new RuntimeException("VersionedParcel encountered ClassNotFoundException", e);
|
||
|
} catch (IllegalAccessException e2) {
|
||
|
throw new RuntimeException("VersionedParcel encountered IllegalAccessException", e2);
|
||
|
} catch (NoSuchMethodException e3) {
|
||
|
throw new RuntimeException("VersionedParcel encountered NoSuchMethodException", e3);
|
||
|
} catch (InvocationTargetException e4) {
|
||
|
if (e4.getCause() instanceof RuntimeException) {
|
||
|
throw ((RuntimeException) e4.getCause());
|
||
|
}
|
||
|
throw new RuntimeException("VersionedParcel encountered InvocationTargetException", e4);
|
||
|
}
|
||
|
} catch (ClassNotFoundException e5) {
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append(yiR.getClass().getSimpleName());
|
||
|
sb.append(" does not have a Parcelizer");
|
||
|
throw new RuntimeException(sb.toString(), e5);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final <T extends YiR> T b(T t) {
|
||
|
if (!a(1)) {
|
||
|
return t;
|
||
|
}
|
||
|
String f = f();
|
||
|
if (f == null) {
|
||
|
return null;
|
||
|
}
|
||
|
return (T) c(f, c());
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public final <T extends YiR> T h() {
|
||
|
String f = f();
|
||
|
if (f == null) {
|
||
|
return null;
|
||
|
}
|
||
|
return (T) c(f, c());
|
||
|
}
|
||
|
|
||
|
private <T extends YiR> T c(String str, VersionedParcel versionedParcel) {
|
||
|
try {
|
||
|
Method method = this.e.get(str);
|
||
|
if (method == null) {
|
||
|
method = Class.forName(str, true, VersionedParcel.class.getClassLoader()).getDeclaredMethod("read", VersionedParcel.class);
|
||
|
this.e.put(str, method);
|
||
|
}
|
||
|
return (T) method.invoke(null, versionedParcel);
|
||
|
} catch (ClassNotFoundException e) {
|
||
|
throw new RuntimeException("VersionedParcel encountered ClassNotFoundException", e);
|
||
|
} catch (IllegalAccessException e2) {
|
||
|
throw new RuntimeException("VersionedParcel encountered IllegalAccessException", e2);
|
||
|
} catch (NoSuchMethodException e3) {
|
||
|
throw new RuntimeException("VersionedParcel encountered NoSuchMethodException", e3);
|
||
|
} catch (InvocationTargetException e4) {
|
||
|
if (e4.getCause() instanceof RuntimeException) {
|
||
|
throw ((RuntimeException) e4.getCause());
|
||
|
}
|
||
|
throw new RuntimeException("VersionedParcel encountered InvocationTargetException", e4);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private Class a(Class<? extends YiR> cls) throws ClassNotFoundException {
|
||
|
Class cls2 = this.d.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.d.put(cls.getName(), cls3);
|
||
|
return cls3;
|
||
|
}
|
||
|
}
|