package o;

import android.os.IBinder;
import android.os.IInterface;
import com.google.android.gms.common.internal.Preconditions;
import java.lang.reflect.Field;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.hT, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class BinderC1385hT extends Do0 implements InterfaceC1180fG {
    public final Object d;

    public BinderC1385hT(Object obj) {
        super("com.google.android.gms.dynamic.IObjectWrapper");
        this.d = obj;
    }

    public static InterfaceC1180fG B(IBinder iBinder) {
        if (iBinder == null) {
            return null;
        }
        IInterface iInterfaceQueryLocalInterface = iBinder.queryLocalInterface("com.google.android.gms.dynamic.IObjectWrapper");
        return iInterfaceQueryLocalInterface instanceof InterfaceC1180fG ? (InterfaceC1180fG) iInterfaceQueryLocalInterface : new Bo0(iBinder, "com.google.android.gms.dynamic.IObjectWrapper");
    }

    public static Object C(InterfaceC1180fG interfaceC1180fG) throws SecurityException {
        if (interfaceC1180fG instanceof BinderC1385hT) {
            return ((BinderC1385hT) interfaceC1180fG).d;
        }
        IBinder iBinderAsBinder = interfaceC1180fG.asBinder();
        Field[] declaredFields = iBinderAsBinder.getClass().getDeclaredFields();
        Field field = null;
        int i = 0;
        for (Field field2 : declaredFields) {
            if (!field2.isSynthetic()) {
                i++;
                field = field2;
            }
        }
        if (i != 1) {
            throw new IllegalArgumentException(AbstractC0126Ew.j(declaredFields.length, "Unexpected number of IObjectWrapper declared fields: "));
        }
        Preconditions.checkNotNull(field);
        if (field.isAccessible()) {
            throw new IllegalArgumentException("IObjectWrapper declared field not private!");
        }
        field.setAccessible(true);
        try {
            return field.get(iBinderAsBinder);
        } catch (IllegalAccessException e) {
            throw new IllegalArgumentException("Could not access the field in remoteBinder.", e);
        } catch (NullPointerException e2) {
            throw new IllegalArgumentException("Binder object is null.", e2);
        }
    }
}
