package R1;

import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/* JADX INFO: loaded from: classes2.dex */
public abstract class b {
    public static void a(Parcel parcel) {
        try {
            Method declaredMethod = Parcel.class.getDeclaredMethod("enforceNoDataAvail", null);
            declaredMethod.setAccessible(true);
            declaredMethod.invoke(parcel, null);
        } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e2) {
            Log.d("ReflectParcel", "enforceNoDataAvailOverlay: failed", e2);
        }
    }

    public static Parcel b(IBinder iBinder) {
        try {
            return (Parcel) Parcel.class.getMethod("obtain", IBinder.class).invoke(null, iBinder);
        } catch (Throwable th) {
            Log.d("ReflectParcel", "obtainOverlay failed", th);
            return null;
        }
    }

    public static Object c(Parcel parcel, Parcelable.Creator creator) {
        try {
            Method declaredMethod = Parcel.class.getDeclaredMethod("readTypedObject", Parcelable.Creator.class);
            declaredMethod.setAccessible(true);
            return declaredMethod.invoke(parcel, creator);
        } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e2) {
            Log.d("ReflectParcel", "readTypedObjectOverlay: failed", e2);
            return null;
        }
    }

    public static void d(Parcel parcel, Parcelable parcelable, int i2) {
        try {
            Method declaredMethod = Parcel.class.getDeclaredMethod("writeTypedObject", Parcelable.class, Integer.TYPE);
            declaredMethod.setAccessible(true);
            declaredMethod.invoke(parcel, parcelable, Integer.valueOf(i2));
        } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e2) {
            Log.d("ReflectParcel", "writeTypedObjectOverlay: failed", e2);
        }
    }
}
