package vendor.amlogic.hardware.screencontrol;

import android.os.BadParcelableException;
import android.os.Parcel;
import android.os.Parcelable;

/* JADX INFO: loaded from: classes2.dex */
public class a implements Parcelable {
    public static final Parcelable.Creator<a> CREATOR = new C0101a();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f6673b = 0;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public int f6674g = 0;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public int f6675r = 0;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public int f6676x = 0;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public int f6677y = 0;

    /* JADX INFO: renamed from: H, reason: collision with root package name */
    public int f6671H = 0;

    /* JADX INFO: renamed from: I, reason: collision with root package name */
    public int f6672I = 0;

    /* JADX INFO: renamed from: vendor.amlogic.hardware.screencontrol.a$a, reason: collision with other inner class name */
    static class C0101a implements Parcelable.Creator {
        C0101a() {
        }

        @Override // android.os.Parcelable.Creator
        /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
        public a createFromParcel(Parcel parcel) {
            a aVar = new a();
            aVar.a(parcel);
            return aVar;
        }

        @Override // android.os.Parcelable.Creator
        /* JADX INFO: renamed from: b, reason: merged with bridge method [inline-methods] */
        public a[] newArray(int i2) {
            return new a[i2];
        }
    }

    public final void a(Parcel parcel) {
        int iDataPosition = parcel.dataPosition();
        int i2 = parcel.readInt();
        try {
            if (i2 < 4) {
                throw new BadParcelableException("Parcelable too small");
            }
            if (parcel.dataPosition() - iDataPosition < i2) {
                this.f6673b = parcel.readInt();
                if (parcel.dataPosition() - iDataPosition < i2) {
                    this.f6674g = parcel.readInt();
                    if (parcel.dataPosition() - iDataPosition < i2) {
                        this.f6675r = parcel.readInt();
                        if (parcel.dataPosition() - iDataPosition < i2) {
                            this.f6676x = parcel.readInt();
                            if (parcel.dataPosition() - iDataPosition < i2) {
                                this.f6677y = parcel.readInt();
                                if (parcel.dataPosition() - iDataPosition < i2) {
                                    this.f6671H = parcel.readInt();
                                    if (parcel.dataPosition() - iDataPosition < i2) {
                                        this.f6672I = parcel.readInt();
                                    } else if (iDataPosition > Integer.MAX_VALUE - i2) {
                                        throw new BadParcelableException("Overflow in the size of parcelable");
                                    }
                                } else if (iDataPosition > Integer.MAX_VALUE - i2) {
                                    throw new BadParcelableException("Overflow in the size of parcelable");
                                }
                            } else if (iDataPosition > Integer.MAX_VALUE - i2) {
                                throw new BadParcelableException("Overflow in the size of parcelable");
                            }
                        } else if (iDataPosition > Integer.MAX_VALUE - i2) {
                            throw new BadParcelableException("Overflow in the size of parcelable");
                        }
                    } else if (iDataPosition > Integer.MAX_VALUE - i2) {
                        throw new BadParcelableException("Overflow in the size of parcelable");
                    }
                } else if (iDataPosition > Integer.MAX_VALUE - i2) {
                    throw new BadParcelableException("Overflow in the size of parcelable");
                }
                parcel.setDataPosition(iDataPosition + i2);
                return;
            }
            if (iDataPosition > Integer.MAX_VALUE - i2) {
                throw new BadParcelableException("Overflow in the size of parcelable");
            }
            parcel.setDataPosition(iDataPosition + i2);
        } catch (Throwable th) {
            if (iDataPosition > Integer.MAX_VALUE - i2) {
                throw new BadParcelableException("Overflow in the size of parcelable");
            }
            parcel.setDataPosition(iDataPosition + i2);
            throw th;
        }
    }

    @Override // android.os.Parcelable
    public int describeContents() {
        return 0;
    }

    @Override // android.os.Parcelable
    public final void writeToParcel(Parcel parcel, int i2) {
        int iDataPosition = parcel.dataPosition();
        parcel.writeInt(0);
        parcel.writeInt(this.f6673b);
        parcel.writeInt(this.f6674g);
        parcel.writeInt(this.f6675r);
        parcel.writeInt(this.f6676x);
        parcel.writeInt(this.f6677y);
        parcel.writeInt(this.f6671H);
        parcel.writeInt(this.f6672I);
        int iDataPosition2 = parcel.dataPosition();
        parcel.setDataPosition(iDataPosition);
        parcel.writeInt(iDataPosition2 - iDataPosition);
        parcel.setDataPosition(iDataPosition2);
    }
}
