package n7;

import android.content.Context;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
import androidx.annotation.Nullable;
import com.google.android.gms.dynamic.RemoteCreator$RemoteCreatorException;
import com.google.android.gms.dynamite.descriptors.com.google.android.gms.ads.dynamite.ModuleDescriptor;
import com.google.android.gms.internal.ads.aj;

/* JADX INFO: loaded from: classes2.dex */
public final class g3 extends k8.c {
    @Override // k8.c
    public final /* synthetic */ Object getRemoteCreator(IBinder iBinder) {
        if (iBinder == null) {
            return null;
        }
        IInterface iInterfaceQueryLocalInterface = iBinder.queryLocalInterface("com.google.android.gms.ads.internal.client.IMobileAdsSettingManagerCreator");
        return iInterfaceQueryLocalInterface instanceof t1 ? (t1) iInterfaceQueryLocalInterface : new t1(iBinder);
    }

    @Nullable
    public final s1 zza(Context context) {
        try {
            k8.b bVar = new k8.b(context);
            t1 t1Var = (t1) getRemoteCreatorInstance(context);
            Parcel parcelO = t1Var.O();
            aj.d(parcelO, bVar);
            parcelO.writeInt(ModuleDescriptor.MODULE_VERSION);
            Parcel parcelB0 = t1Var.B0(1, parcelO);
            IBinder strongBinder = parcelB0.readStrongBinder();
            parcelB0.recycle();
            if (strongBinder == null) {
                return null;
            }
            IInterface iInterfaceQueryLocalInterface = strongBinder.queryLocalInterface("com.google.android.gms.ads.internal.client.IMobileAdsSettingManager");
            return iInterfaceQueryLocalInterface instanceof s1 ? (s1) iInterfaceQueryLocalInterface : new q1(strongBinder);
        } catch (RemoteException | RemoteCreator$RemoteCreatorException unused) {
            return null;
        }
    }
}
