package com.google.android.gms.common.internal.safeparcel; import android.app.PendingIntent; import android.os.Bundle; import android.os.IBinder; import android.os.Parcel; import android.os.Parcelable; import android.util.SparseArray; import android.util.SparseBooleanArray; import android.util.SparseIntArray; import android.util.SparseLongArray; import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; /* loaded from: classes.dex */ public class SafeParcelReader { /* loaded from: classes.dex */ public static class ParseException extends RuntimeException { /* JADX WARN: Illegal instructions before constructor call */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public ParseException(java.lang.String r3, android.os.Parcel r4) { /* r2 = this; int r0 = r4.dataPosition() int r4 = r4.dataSize() java.lang.StringBuilder r1 = new java.lang.StringBuilder r1.() r1.append(r3) java.lang.String r3 = " Parcel: pos=" r1.append(r3) r1.append(r0) java.lang.String r3 = " size=" r1.append(r3) r1.append(r4) java.lang.String r3 = r1.toString() r2.(r3) return */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.common.internal.safeparcel.SafeParcelReader.ParseException.(java.lang.String, android.os.Parcel):void"); } } public static BigDecimal createBigDecimal(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } byte[] createByteArray = parcel.createByteArray(); int readInt = parcel.readInt(); parcel.setDataPosition(dataPosition + readSize); return new BigDecimal(new BigInteger(createByteArray), readInt); } public static BigDecimal[] createBigDecimalArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } int readInt = parcel.readInt(); BigDecimal[] bigDecimalArr = new BigDecimal[readInt]; for (int i2 = 0; i2 < readInt; i2++) { byte[] createByteArray = parcel.createByteArray(); bigDecimalArr[i2] = new BigDecimal(new BigInteger(createByteArray), parcel.readInt()); } parcel.setDataPosition(dataPosition + readSize); return bigDecimalArr; } public static BigInteger createBigInteger(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } byte[] createByteArray = parcel.createByteArray(); parcel.setDataPosition(dataPosition + readSize); return new BigInteger(createByteArray); } public static BigInteger[] createBigIntegerArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } int readInt = parcel.readInt(); BigInteger[] bigIntegerArr = new BigInteger[readInt]; for (int i2 = 0; i2 < readInt; i2++) { bigIntegerArr[i2] = new BigInteger(parcel.createByteArray()); } parcel.setDataPosition(dataPosition + readSize); return bigIntegerArr; } public static boolean[] createBooleanArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } boolean[] createBooleanArray = parcel.createBooleanArray(); parcel.setDataPosition(dataPosition + readSize); return createBooleanArray; } public static ArrayList createBooleanList(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } ArrayList arrayList = new ArrayList<>(); int readInt = parcel.readInt(); for (int i2 = 0; i2 < readInt; i2++) { arrayList.add(Boolean.valueOf(parcel.readInt() != 0)); } parcel.setDataPosition(dataPosition + readSize); return arrayList; } public static Bundle createBundle(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } Bundle readBundle = parcel.readBundle(); parcel.setDataPosition(dataPosition + readSize); return readBundle; } public static byte[] createByteArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } byte[] createByteArray = parcel.createByteArray(); parcel.setDataPosition(dataPosition + readSize); return createByteArray; } public static byte[][] createByteArrayArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } int readInt = parcel.readInt(); byte[][] bArr = new byte[readInt]; for (int i2 = 0; i2 < readInt; i2++) { bArr[i2] = parcel.createByteArray(); } parcel.setDataPosition(dataPosition + readSize); return bArr; } public static SparseArray createByteArraySparseArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } int readInt = parcel.readInt(); SparseArray sparseArray = new SparseArray<>(readInt); for (int i2 = 0; i2 < readInt; i2++) { sparseArray.append(parcel.readInt(), parcel.createByteArray()); } parcel.setDataPosition(dataPosition + readSize); return sparseArray; } public static char[] createCharArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } char[] createCharArray = parcel.createCharArray(); parcel.setDataPosition(dataPosition + readSize); return createCharArray; } public static double[] createDoubleArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } double[] createDoubleArray = parcel.createDoubleArray(); parcel.setDataPosition(dataPosition + readSize); return createDoubleArray; } public static ArrayList createDoubleList(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } ArrayList arrayList = new ArrayList<>(); int readInt = parcel.readInt(); for (int i2 = 0; i2 < readInt; i2++) { arrayList.add(Double.valueOf(parcel.readDouble())); } parcel.setDataPosition(dataPosition + readSize); return arrayList; } public static SparseArray createDoubleSparseArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } SparseArray sparseArray = new SparseArray<>(); int readInt = parcel.readInt(); for (int i2 = 0; i2 < readInt; i2++) { sparseArray.append(parcel.readInt(), Double.valueOf(parcel.readDouble())); } parcel.setDataPosition(dataPosition + readSize); return sparseArray; } public static float[] createFloatArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } float[] createFloatArray = parcel.createFloatArray(); parcel.setDataPosition(dataPosition + readSize); return createFloatArray; } public static ArrayList createFloatList(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } ArrayList arrayList = new ArrayList<>(); int readInt = parcel.readInt(); for (int i2 = 0; i2 < readInt; i2++) { arrayList.add(Float.valueOf(parcel.readFloat())); } parcel.setDataPosition(dataPosition + readSize); return arrayList; } public static SparseArray createFloatSparseArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } SparseArray sparseArray = new SparseArray<>(); int readInt = parcel.readInt(); for (int i2 = 0; i2 < readInt; i2++) { sparseArray.append(parcel.readInt(), Float.valueOf(parcel.readFloat())); } parcel.setDataPosition(dataPosition + readSize); return sparseArray; } public static IBinder[] createIBinderArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } IBinder[] createBinderArray = parcel.createBinderArray(); parcel.setDataPosition(dataPosition + readSize); return createBinderArray; } public static ArrayList createIBinderList(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } ArrayList createBinderArrayList = parcel.createBinderArrayList(); parcel.setDataPosition(dataPosition + readSize); return createBinderArrayList; } public static SparseArray createIBinderSparseArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } int readInt = parcel.readInt(); SparseArray sparseArray = new SparseArray<>(readInt); for (int i2 = 0; i2 < readInt; i2++) { sparseArray.append(parcel.readInt(), parcel.readStrongBinder()); } parcel.setDataPosition(dataPosition + readSize); return sparseArray; } public static int[] createIntArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } int[] createIntArray = parcel.createIntArray(); parcel.setDataPosition(dataPosition + readSize); return createIntArray; } public static ArrayList createIntegerList(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } ArrayList arrayList = new ArrayList<>(); int readInt = parcel.readInt(); for (int i2 = 0; i2 < readInt; i2++) { arrayList.add(Integer.valueOf(parcel.readInt())); } parcel.setDataPosition(dataPosition + readSize); return arrayList; } public static long[] createLongArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } long[] createLongArray = parcel.createLongArray(); parcel.setDataPosition(dataPosition + readSize); return createLongArray; } public static ArrayList createLongList(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } ArrayList arrayList = new ArrayList<>(); int readInt = parcel.readInt(); for (int i2 = 0; i2 < readInt; i2++) { arrayList.add(Long.valueOf(parcel.readLong())); } parcel.setDataPosition(dataPosition + readSize); return arrayList; } public static Parcel createParcel(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } Parcel obtain = Parcel.obtain(); obtain.appendFrom(parcel, dataPosition, readSize); parcel.setDataPosition(dataPosition + readSize); return obtain; } public static Parcel[] createParcelArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } int readInt = parcel.readInt(); Parcel[] parcelArr = new Parcel[readInt]; for (int i2 = 0; i2 < readInt; i2++) { int readInt2 = parcel.readInt(); if (readInt2 != 0) { int dataPosition2 = parcel.dataPosition(); Parcel obtain = Parcel.obtain(); obtain.appendFrom(parcel, dataPosition2, readInt2); parcelArr[i2] = obtain; parcel.setDataPosition(dataPosition2 + readInt2); } else { parcelArr[i2] = null; } } parcel.setDataPosition(dataPosition + readSize); return parcelArr; } public static ArrayList createParcelList(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } int readInt = parcel.readInt(); ArrayList arrayList = new ArrayList<>(); for (int i2 = 0; i2 < readInt; i2++) { int readInt2 = parcel.readInt(); if (readInt2 != 0) { int dataPosition2 = parcel.dataPosition(); Parcel obtain = Parcel.obtain(); obtain.appendFrom(parcel, dataPosition2, readInt2); arrayList.add(obtain); parcel.setDataPosition(dataPosition2 + readInt2); } else { arrayList.add(null); } } parcel.setDataPosition(dataPosition + readSize); return arrayList; } public static SparseArray createParcelSparseArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } int readInt = parcel.readInt(); SparseArray sparseArray = new SparseArray<>(); for (int i2 = 0; i2 < readInt; i2++) { int readInt2 = parcel.readInt(); int readInt3 = parcel.readInt(); if (readInt3 != 0) { int dataPosition2 = parcel.dataPosition(); Parcel obtain = Parcel.obtain(); obtain.appendFrom(parcel, dataPosition2, readInt3); sparseArray.append(readInt2, obtain); parcel.setDataPosition(dataPosition2 + readInt3); } else { sparseArray.append(readInt2, null); } } parcel.setDataPosition(dataPosition + readSize); return sparseArray; } public static T createParcelable(Parcel parcel, int i, Parcelable.Creator creator) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } T createFromParcel = creator.createFromParcel(parcel); parcel.setDataPosition(dataPosition + readSize); return createFromParcel; } public static SparseBooleanArray createSparseBooleanArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } SparseBooleanArray readSparseBooleanArray = parcel.readSparseBooleanArray(); parcel.setDataPosition(dataPosition + readSize); return readSparseBooleanArray; } public static SparseIntArray createSparseIntArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } SparseIntArray sparseIntArray = new SparseIntArray(); int readInt = parcel.readInt(); for (int i2 = 0; i2 < readInt; i2++) { sparseIntArray.append(parcel.readInt(), parcel.readInt()); } parcel.setDataPosition(dataPosition + readSize); return sparseIntArray; } public static SparseLongArray createSparseLongArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } SparseLongArray sparseLongArray = new SparseLongArray(); int readInt = parcel.readInt(); for (int i2 = 0; i2 < readInt; i2++) { sparseLongArray.append(parcel.readInt(), parcel.readLong()); } parcel.setDataPosition(dataPosition + readSize); return sparseLongArray; } public static String createString(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } String readString = parcel.readString(); parcel.setDataPosition(dataPosition + readSize); return readString; } public static String[] createStringArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } String[] createStringArray = parcel.createStringArray(); parcel.setDataPosition(dataPosition + readSize); return createStringArray; } public static ArrayList createStringList(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } ArrayList createStringArrayList = parcel.createStringArrayList(); parcel.setDataPosition(dataPosition + readSize); return createStringArrayList; } public static SparseArray createStringSparseArray(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } SparseArray sparseArray = new SparseArray<>(); int readInt = parcel.readInt(); for (int i2 = 0; i2 < readInt; i2++) { sparseArray.append(parcel.readInt(), parcel.readString()); } parcel.setDataPosition(dataPosition + readSize); return sparseArray; } public static T[] createTypedArray(Parcel parcel, int i, Parcelable.Creator creator) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } T[] tArr = (T[]) parcel.createTypedArray(creator); parcel.setDataPosition(dataPosition + readSize); return tArr; } public static ArrayList createTypedList(Parcel parcel, int i, Parcelable.Creator creator) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } ArrayList createTypedArrayList = parcel.createTypedArrayList(creator); parcel.setDataPosition(dataPosition + readSize); return createTypedArrayList; } public static SparseArray createTypedSparseArray(Parcel parcel, int i, Parcelable.Creator creator) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } int readInt = parcel.readInt(); SparseArray sparseArray = new SparseArray<>(); for (int i2 = 0; i2 < readInt; i2++) { sparseArray.append(parcel.readInt(), parcel.readInt() != 0 ? creator.createFromParcel(parcel) : null); } parcel.setDataPosition(dataPosition + readSize); return sparseArray; } public static void ensureAtEnd(Parcel parcel, int i) { if (parcel.dataPosition() == i) { return; } StringBuilder sb = new StringBuilder("Overread allowed size end="); sb.append(i); throw new ParseException(sb.toString(), parcel); } public static int getFieldId(int i) { return (char) i; } public static boolean readBoolean(Parcel parcel, int i) { zzb(parcel, i, 4); return parcel.readInt() != 0; } public static Boolean readBooleanObject(Parcel parcel, int i) { int readSize = readSize(parcel, i); if (readSize == 0) { return null; } zza(parcel, i, readSize, 4); return Boolean.valueOf(parcel.readInt() != 0); } public static byte readByte(Parcel parcel, int i) { zzb(parcel, i, 4); return (byte) parcel.readInt(); } public static char readChar(Parcel parcel, int i) { zzb(parcel, i, 4); return (char) parcel.readInt(); } public static double readDouble(Parcel parcel, int i) { zzb(parcel, i, 8); return parcel.readDouble(); } public static Double readDoubleObject(Parcel parcel, int i) { int readSize = readSize(parcel, i); if (readSize == 0) { return null; } zza(parcel, i, readSize, 8); return Double.valueOf(parcel.readDouble()); } public static float readFloat(Parcel parcel, int i) { zzb(parcel, i, 4); return parcel.readFloat(); } public static Float readFloatObject(Parcel parcel, int i) { int readSize = readSize(parcel, i); if (readSize == 0) { return null; } zza(parcel, i, readSize, 4); return Float.valueOf(parcel.readFloat()); } public static int readHeader(Parcel parcel) { return parcel.readInt(); } public static IBinder readIBinder(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } IBinder readStrongBinder = parcel.readStrongBinder(); parcel.setDataPosition(dataPosition + readSize); return readStrongBinder; } public static int readInt(Parcel parcel, int i) { zzb(parcel, i, 4); return parcel.readInt(); } public static Integer readIntegerObject(Parcel parcel, int i) { int readSize = readSize(parcel, i); if (readSize == 0) { return null; } zza(parcel, i, readSize, 4); return Integer.valueOf(parcel.readInt()); } public static void readList(Parcel parcel, int i, List list, ClassLoader classLoader) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return; } parcel.readList(list, classLoader); parcel.setDataPosition(dataPosition + readSize); } public static long readLong(Parcel parcel, int i) { zzb(parcel, i, 8); return parcel.readLong(); } public static Long readLongObject(Parcel parcel, int i) { int readSize = readSize(parcel, i); if (readSize == 0) { return null; } zza(parcel, i, readSize, 8); return Long.valueOf(parcel.readLong()); } public static PendingIntent readPendingIntent(Parcel parcel, int i) { int readSize = readSize(parcel, i); int dataPosition = parcel.dataPosition(); if (readSize == 0) { return null; } PendingIntent readPendingIntentOrNullFromParcel = PendingIntent.readPendingIntentOrNullFromParcel(parcel); parcel.setDataPosition(dataPosition + readSize); return readPendingIntentOrNullFromParcel; } public static short readShort(Parcel parcel, int i) { zzb(parcel, i, 4); return (short) parcel.readInt(); } public static int readSize(Parcel parcel, int i) { return (i & (-65536)) != -65536 ? (char) (i >> 16) : parcel.readInt(); } public static void skipUnknownField(Parcel parcel, int i) { parcel.setDataPosition(parcel.dataPosition() + readSize(parcel, i)); } public static int validateObjectHeader(Parcel parcel) { int readHeader = readHeader(parcel); int readSize = readSize(parcel, readHeader); int dataPosition = parcel.dataPosition(); if (getFieldId(readHeader) != 20293) { throw new ParseException("Expected object header. Got 0x".concat(String.valueOf(Integer.toHexString(readHeader))), parcel); } int i = readSize + dataPosition; if (i >= dataPosition && i <= parcel.dataSize()) { return i; } StringBuilder sb = new StringBuilder("Size read is invalid start="); sb.append(dataPosition); sb.append(" end="); sb.append(i); throw new ParseException(sb.toString(), parcel); } private static void zza(Parcel parcel, int i, int i2, int i3) { if (i2 == i3) { return; } String hexString = Integer.toHexString(i2); StringBuilder sb = new StringBuilder("Expected size "); sb.append(i3); sb.append(" got "); sb.append(i2); sb.append(" (0x"); sb.append(hexString); sb.append(")"); throw new ParseException(sb.toString(), parcel); } private static void zzb(Parcel parcel, int i, int i2) { int readSize = readSize(parcel, i); if (readSize == i2) { return; } String hexString = Integer.toHexString(readSize); StringBuilder sb = new StringBuilder("Expected size "); sb.append(i2); sb.append(" got "); sb.append(readSize); sb.append(" (0x"); sb.append(hexString); sb.append(")"); throw new ParseException(sb.toString(), parcel); } private SafeParcelReader() { } }