package com.google.android.gms.internal.ads;

import android.app.Activity;
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;

/* JADX INFO: loaded from: classes2.dex */
public final class my 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.overlay.client.IAdOverlayCreator");
        return iInterfaceQueryLocalInterface instanceof sy ? (sy) iInterfaceQueryLocalInterface : new qy(iBinder);
    }

    @Nullable
    public final py zza(Activity activity) {
        try {
            k8.b bVar = new k8.b(activity);
            qy qyVar = (qy) ((sy) getRemoteCreatorInstance(activity));
            Parcel parcelO = qyVar.O();
            aj.d(parcelO, bVar);
            Parcel parcelB0 = qyVar.B0(1, parcelO);
            IBinder strongBinder = parcelB0.readStrongBinder();
            parcelB0.recycle();
            if (strongBinder == null) {
                return null;
            }
            IInterface iInterfaceQueryLocalInterface = strongBinder.queryLocalInterface("com.google.android.gms.ads.internal.overlay.client.IAdOverlay");
            return iInterfaceQueryLocalInterface instanceof py ? (py) iInterfaceQueryLocalInterface : new ny(strongBinder);
        } catch (RemoteException | RemoteCreator$RemoteCreatorException unused) {
            return null;
        }
    }
}
