package com.google.android.gms.ads.mediation.customevent; import android.content.Context; import android.os.Bundle; import android.view.View; import com.google.android.gms.ads.AdError; import com.google.android.gms.ads.AdSize; import com.google.android.gms.ads.MobileAds; import com.google.android.gms.ads.mediation.MediationAdRequest; import com.google.android.gms.ads.mediation.MediationBannerAdapter; import com.google.android.gms.ads.mediation.MediationBannerListener; import com.google.android.gms.ads.mediation.MediationConfiguration; import com.google.android.gms.ads.mediation.MediationInterstitialAdapter; import com.google.android.gms.ads.mediation.MediationInterstitialListener; import com.google.android.gms.ads.mediation.MediationNativeAdapter; import com.google.android.gms.ads.mediation.MediationNativeListener; import com.google.android.gms.ads.mediation.NativeMediationAdRequest; import com.google.android.gms.common.annotation.KeepForSdkWithMembers; import com.google.android.gms.common.annotation.KeepName; import com.google.android.gms.internal.ads.zzbzr; @KeepForSdkWithMembers @KeepName /* loaded from: classes.dex */ public final class CustomEventAdapter implements MediationBannerAdapter, MediationInterstitialAdapter, MediationNativeAdapter { static final AdError zza = new AdError(0, "Could not instantiate custom event adapter", MobileAds.ERROR_DOMAIN); CustomEventBanner zzb; CustomEventInterstitial zzc; CustomEventNative zzd; private View zze; private static Object zzb(Class cls, String str) { str.getClass(); try { return cls.cast(Class.forName(str).getDeclaredConstructor(new Class[0]).newInstance(new Object[0])); } catch (Throwable th) { zzbzr.zzj("Could not instantiate custom event adapter: " + str + ". " + th.getMessage()); return null; } } @Override // com.google.android.gms.ads.mediation.MediationBannerAdapter public View getBannerView() { return this.zze; } @Override // com.google.android.gms.ads.mediation.MediationAdapter public void onDestroy() { CustomEventBanner customEventBanner = this.zzb; if (customEventBanner != null) { customEventBanner.onDestroy(); } CustomEventInterstitial customEventInterstitial = this.zzc; if (customEventInterstitial != null) { customEventInterstitial.onDestroy(); } CustomEventNative customEventNative = this.zzd; if (customEventNative != null) { customEventNative.onDestroy(); } } @Override // com.google.android.gms.ads.mediation.MediationAdapter public void onPause() { CustomEventBanner customEventBanner = this.zzb; if (customEventBanner != null) { customEventBanner.onPause(); } CustomEventInterstitial customEventInterstitial = this.zzc; if (customEventInterstitial != null) { customEventInterstitial.onPause(); } CustomEventNative customEventNative = this.zzd; if (customEventNative != null) { customEventNative.onPause(); } } @Override // com.google.android.gms.ads.mediation.MediationAdapter public void onResume() { CustomEventBanner customEventBanner = this.zzb; if (customEventBanner != null) { customEventBanner.onResume(); } CustomEventInterstitial customEventInterstitial = this.zzc; if (customEventInterstitial != null) { customEventInterstitial.onResume(); } CustomEventNative customEventNative = this.zzd; if (customEventNative != null) { customEventNative.onResume(); } } @Override // com.google.android.gms.ads.mediation.MediationBannerAdapter public void requestBannerAd(Context context, MediationBannerListener mediationBannerListener, Bundle bundle, AdSize adSize, MediationAdRequest mediationAdRequest, Bundle bundle2) { CustomEventBanner customEventBanner = (CustomEventBanner) zzb(CustomEventBanner.class, bundle.getString("class_name")); this.zzb = customEventBanner; if (customEventBanner == null) { mediationBannerListener.onAdFailedToLoad(this, zza); return; } Bundle bundle3 = bundle2 == null ? null : bundle2.getBundle(bundle.getString("class_name")); CustomEventBanner customEventBanner2 = this.zzb; customEventBanner2.getClass(); customEventBanner2.requestBannerAd(context, new zza(this, mediationBannerListener), bundle.getString(MediationConfiguration.CUSTOM_EVENT_SERVER_PARAMETER_FIELD), adSize, mediationAdRequest, bundle3); } @Override // com.google.android.gms.ads.mediation.MediationInterstitialAdapter public void requestInterstitialAd(Context context, MediationInterstitialListener mediationInterstitialListener, Bundle bundle, MediationAdRequest mediationAdRequest, Bundle bundle2) { CustomEventInterstitial customEventInterstitial = (CustomEventInterstitial) zzb(CustomEventInterstitial.class, bundle.getString("class_name")); this.zzc = customEventInterstitial; if (customEventInterstitial == null) { mediationInterstitialListener.onAdFailedToLoad(this, zza); return; } Bundle bundle3 = bundle2 == null ? null : bundle2.getBundle(bundle.getString("class_name")); CustomEventInterstitial customEventInterstitial2 = this.zzc; customEventInterstitial2.getClass(); customEventInterstitial2.requestInterstitialAd(context, new zzb(this, this, mediationInterstitialListener), bundle.getString(MediationConfiguration.CUSTOM_EVENT_SERVER_PARAMETER_FIELD), mediationAdRequest, bundle3); } @Override // com.google.android.gms.ads.mediation.MediationNativeAdapter public void requestNativeAd(Context context, MediationNativeListener mediationNativeListener, Bundle bundle, NativeMediationAdRequest nativeMediationAdRequest, Bundle bundle2) { CustomEventNative customEventNative = (CustomEventNative) zzb(CustomEventNative.class, bundle.getString("class_name")); this.zzd = customEventNative; if (customEventNative == null) { mediationNativeListener.onAdFailedToLoad(this, zza); return; } Bundle bundle3 = bundle2 == null ? null : bundle2.getBundle(bundle.getString("class_name")); CustomEventNative customEventNative2 = this.zzd; customEventNative2.getClass(); customEventNative2.requestNativeAd(context, new zzc(this, mediationNativeListener), bundle.getString(MediationConfiguration.CUSTOM_EVENT_SERVER_PARAMETER_FIELD), nativeMediationAdRequest, bundle3); } @Override // com.google.android.gms.ads.mediation.MediationInterstitialAdapter public void showInterstitial() { CustomEventInterstitial customEventInterstitial = this.zzc; if (customEventInterstitial != null) { customEventInterstitial.showInterstitial(); } } }