Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
package androidx.versionedparcelable;
/* loaded from: classes.dex */
public abstract class CustomVersionedParcelable implements VersionedParcelable {
}

View File

@@ -0,0 +1,44 @@
package androidx.versionedparcelable;
import android.os.Parcel;
import android.os.Parcelable;
/* loaded from: classes.dex */
public class ParcelImpl implements Parcelable {
public static final Parcelable.Creator<ParcelImpl> CREATOR = new Parcelable.Creator<ParcelImpl>() { // from class: androidx.versionedparcelable.ParcelImpl.1
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public ParcelImpl createFromParcel(Parcel parcel) {
return new ParcelImpl(parcel);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public ParcelImpl[] newArray(int i) {
return new ParcelImpl[i];
}
};
private final VersionedParcelable mParcel;
public ParcelImpl(VersionedParcelable versionedParcelable) {
this.mParcel = versionedParcelable;
}
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
public <T extends VersionedParcelable> T getVersionedParcel() {
return (T) this.mParcel;
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
new VersionedParcelParcel(parcel).a(this.mParcel);
}
protected ParcelImpl(Parcel parcel) {
this.mParcel = new VersionedParcelParcel(parcel).h();
}
}

View File

@@ -0,0 +1,159 @@
package androidx.versionedparcelable;
import android.os.Parcelable;
import java.lang.reflect.InvocationTargetException;
/* loaded from: classes.dex */
public abstract class VersionedParcel {
public static class ParcelException extends RuntimeException {
public ParcelException(Throwable th) {
super(th);
}
}
private void c(VersionedParcelable versionedParcelable) {
try {
a(a((Class<? extends VersionedParcelable>) versionedParcelable.getClass()).getName());
} catch (ClassNotFoundException e) {
throw new RuntimeException(versionedParcelable.getClass().getSimpleName() + " does not have a Parcelizer", e);
}
}
public int a(int i, int i2) {
return !a(i2) ? i : e();
}
protected abstract void a();
protected abstract void a(Parcelable parcelable);
protected abstract void a(String str);
public void a(boolean z, boolean z2) {
}
protected abstract void a(byte[] bArr);
protected abstract boolean a(int i);
protected abstract VersionedParcel b();
protected abstract void b(int i);
public void b(byte[] bArr, int i) {
b(i);
a(bArr);
}
protected abstract void c(int i);
public boolean c() {
return false;
}
protected abstract byte[] d();
protected abstract int e();
protected abstract <T extends Parcelable> T f();
protected abstract String g();
protected <T extends VersionedParcelable> T h() {
String g = g();
if (g == null) {
return null;
}
return (T) a(g, b());
}
public String a(String str, int i) {
return !a(i) ? str : g();
}
public void b(int i, int i2) {
b(i2);
c(i);
}
public byte[] a(byte[] bArr, int i) {
return !a(i) ? bArr : d();
}
public void b(String str, int i) {
b(i);
a(str);
}
public <T extends Parcelable> T a(T t, int i) {
return !a(i) ? t : (T) f();
}
public void b(Parcelable parcelable, int i) {
b(i);
a(parcelable);
}
protected void a(VersionedParcelable versionedParcelable) {
if (versionedParcelable == null) {
a((String) null);
return;
}
c(versionedParcelable);
VersionedParcel b = b();
a(versionedParcelable, b);
b.a();
}
public void b(VersionedParcelable versionedParcelable, int i) {
b(i);
a(versionedParcelable);
}
private static <T extends VersionedParcelable> Class b(T t) throws ClassNotFoundException {
return a((Class<? extends VersionedParcelable>) t.getClass());
}
public <T extends VersionedParcelable> T a(T t, int i) {
return !a(i) ? t : (T) h();
}
protected static <T extends VersionedParcelable> T a(String str, VersionedParcel versionedParcel) {
try {
return (T) Class.forName(str, true, VersionedParcel.class.getClassLoader()).getDeclaredMethod("read", VersionedParcel.class).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);
}
}
protected static <T extends VersionedParcelable> void a(T t, VersionedParcel versionedParcel) {
try {
b(t).getDeclaredMethod("write", t.getClass(), VersionedParcel.class).invoke(null, t, 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 static Class a(Class<? extends VersionedParcelable> cls) throws ClassNotFoundException {
return Class.forName(String.format("%s.%sParcelizer", cls.getPackage().getName(), cls.getSimpleName()), false, cls.getClassLoader());
}
}

View File

@@ -0,0 +1,139 @@
package androidx.versionedparcelable;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.SparseIntArray;
/* loaded from: classes.dex */
class VersionedParcelParcel extends VersionedParcel {
private final SparseIntArray a;
private final Parcel b;
private final int c;
private final int d;
private final String e;
private int f;
private int g;
VersionedParcelParcel(Parcel parcel) {
this(parcel, parcel.dataPosition(), parcel.dataSize(), "");
}
private int d(int i) {
int readInt;
do {
int i2 = this.g;
if (i2 >= this.d) {
return -1;
}
this.b.setDataPosition(i2);
int readInt2 = this.b.readInt();
readInt = this.b.readInt();
this.g += readInt2;
} while (readInt != i);
return this.b.dataPosition();
}
@Override // androidx.versionedparcelable.VersionedParcel
public boolean a(int i) {
int d = d(i);
if (d == -1) {
return false;
}
this.b.setDataPosition(d);
return true;
}
@Override // androidx.versionedparcelable.VersionedParcel
public void b(int i) {
a();
this.f = i;
this.a.put(i, this.b.dataPosition());
c(0);
c(i);
}
@Override // androidx.versionedparcelable.VersionedParcel
public void c(int i) {
this.b.writeInt(i);
}
@Override // androidx.versionedparcelable.VersionedParcel
public int e() {
return this.b.readInt();
}
@Override // androidx.versionedparcelable.VersionedParcel
public <T extends Parcelable> T f() {
return (T) this.b.readParcelable(VersionedParcelParcel.class.getClassLoader());
}
@Override // androidx.versionedparcelable.VersionedParcel
public String g() {
return this.b.readString();
}
VersionedParcelParcel(Parcel parcel, int i, int i2, String str) {
this.a = new SparseIntArray();
this.f = -1;
this.g = 0;
this.b = parcel;
this.c = i;
this.d = i2;
this.g = this.c;
this.e = str;
}
@Override // androidx.versionedparcelable.VersionedParcel
public void a() {
int i = this.f;
if (i >= 0) {
int i2 = this.a.get(i);
int dataPosition = this.b.dataPosition();
this.b.setDataPosition(i2);
this.b.writeInt(dataPosition - i2);
this.b.setDataPosition(dataPosition);
}
}
@Override // androidx.versionedparcelable.VersionedParcel
protected VersionedParcel b() {
Parcel parcel = this.b;
int dataPosition = parcel.dataPosition();
int i = this.g;
if (i == this.c) {
i = this.d;
}
return new VersionedParcelParcel(parcel, dataPosition, i, this.e + " ");
}
@Override // androidx.versionedparcelable.VersionedParcel
public byte[] d() {
int readInt = this.b.readInt();
if (readInt < 0) {
return null;
}
byte[] bArr = new byte[readInt];
this.b.readByteArray(bArr);
return bArr;
}
@Override // androidx.versionedparcelable.VersionedParcel
public void a(byte[] bArr) {
if (bArr != null) {
this.b.writeInt(bArr.length);
this.b.writeByteArray(bArr);
} else {
this.b.writeInt(-1);
}
}
@Override // androidx.versionedparcelable.VersionedParcel
public void a(String str) {
this.b.writeString(str);
}
@Override // androidx.versionedparcelable.VersionedParcel
public void a(Parcelable parcelable) {
this.b.writeParcelable(parcelable, 0);
}
}

View File

@@ -0,0 +1,5 @@
package androidx.versionedparcelable;
/* loaded from: classes.dex */
public interface VersionedParcelable {
}