package com.google.android.gms.ads.rewarded; import android.app.Activity; import android.content.Context; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.FullScreenContentCallback; import com.google.android.gms.ads.OnPaidEventListener; import com.google.android.gms.ads.OnUserEarnedRewardListener; import com.google.android.gms.ads.ResponseInfo; import com.google.android.gms.ads.admanager.AdManagerAdRequest; import com.google.android.gms.ads.internal.client.zzbe; import com.google.android.gms.ads.internal.util.client.zzo; import com.google.android.gms.common.internal.Preconditions; import com.google.android.gms.internal.ads.zzbcl; import com.google.android.gms.internal.ads.zzbej; import com.google.android.gms.internal.ads.zzbuh; import com.google.android.gms.internal.ads.zzbwy; /* loaded from: classes2.dex */ public abstract class RewardedAd { public static boolean isAdAvailable(@NonNull Context context, @NonNull String str) { Preconditions.checkNotNull(context, "Context cannot be null."); Preconditions.checkNotNull(str, "AdUnitId cannot be null."); return new zzbwy(context, str).zzc(); } public static void load(@NonNull final Context context, @NonNull final String str, @NonNull final AdRequest adRequest, @NonNull final RewardedAdLoadCallback rewardedAdLoadCallback) { Preconditions.checkNotNull(context, "Context cannot be null."); Preconditions.checkNotNull(str, "AdUnitId cannot be null."); Preconditions.checkNotNull(adRequest, "AdRequest cannot be null."); Preconditions.checkNotNull(rewardedAdLoadCallback, "LoadCallback cannot be null."); Preconditions.checkMainThread("#008 Must be called on the main UI thread."); zzbcl.zza(context); if (((Boolean) zzbej.zzk.zze()).booleanValue()) { if (((Boolean) zzbe.zzc().zza(zzbcl.zzla)).booleanValue()) { com.google.android.gms.ads.internal.util.client.zzb.zzb.execute(new Runnable() { // from class: com.google.android.gms.ads.rewarded.zzc @Override // java.lang.Runnable public final void run() { Context context2 = context; String str2 = str; AdRequest adRequest2 = adRequest; try { new zzbwy(context2, str2).zzb(adRequest2.zza(), rewardedAdLoadCallback); } catch (IllegalStateException e) { zzbuh.zza(context2).zzh(e, "RewardedAd.load"); } } }); return; } } zzo.zze("Loading on UI thread"); new zzbwy(context, str).zzb(adRequest.zza(), rewardedAdLoadCallback); } @Nullable public static RewardedAd pollAd(@NonNull Context context, @NonNull String str) { Preconditions.checkNotNull(context, "Context cannot be null."); Preconditions.checkNotNull(str, "AdUnitId cannot be null."); return new zzbwy(context, str).zza(); } @NonNull public abstract Bundle getAdMetadata(); @NonNull public abstract String getAdUnitId(); @Nullable public abstract FullScreenContentCallback getFullScreenContentCallback(); @Nullable public abstract OnAdMetadataChangedListener getOnAdMetadataChangedListener(); @Nullable public abstract OnPaidEventListener getOnPaidEventListener(); @NonNull public abstract ResponseInfo getResponseInfo(); @NonNull public abstract RewardItem getRewardItem(); public abstract void setFullScreenContentCallback(@Nullable FullScreenContentCallback fullScreenContentCallback); public abstract void setImmersiveMode(boolean z); public abstract void setOnAdMetadataChangedListener(@Nullable OnAdMetadataChangedListener onAdMetadataChangedListener); public abstract void setOnPaidEventListener(@Nullable OnPaidEventListener onPaidEventListener); public abstract void setServerSideVerificationOptions(@Nullable ServerSideVerificationOptions serverSideVerificationOptions); public abstract void show(@NonNull Activity activity, @NonNull OnUserEarnedRewardListener onUserEarnedRewardListener); public static void load(@NonNull final Context context, @NonNull final String str, @NonNull final AdManagerAdRequest adManagerAdRequest, @NonNull final RewardedAdLoadCallback rewardedAdLoadCallback) { Preconditions.checkNotNull(context, "Context cannot be null."); Preconditions.checkNotNull(str, "AdUnitId cannot be null."); Preconditions.checkNotNull(adManagerAdRequest, "AdManagerAdRequest cannot be null."); Preconditions.checkNotNull(rewardedAdLoadCallback, "LoadCallback cannot be null."); Preconditions.checkMainThread("#008 Must be called on the main UI thread."); zzbcl.zza(context); if (((Boolean) zzbej.zzk.zze()).booleanValue()) { if (((Boolean) zzbe.zzc().zza(zzbcl.zzla)).booleanValue()) { zzo.zze("Loading on background thread"); com.google.android.gms.ads.internal.util.client.zzb.zzb.execute(new Runnable() { // from class: com.google.android.gms.ads.rewarded.zzb @Override // java.lang.Runnable public final void run() { Context context2 = context; String str2 = str; AdManagerAdRequest adManagerAdRequest2 = adManagerAdRequest; try { new zzbwy(context2, str2).zzb(adManagerAdRequest2.zza(), rewardedAdLoadCallback); } catch (IllegalStateException e) { zzbuh.zza(context2).zzh(e, "RewardedAd.loadAdManager"); } } }); return; } } zzo.zze("Loading on UI thread"); new zzbwy(context, str).zzb(adManagerAdRequest.zza(), rewardedAdLoadCallback); } }