package com.applovin.impl.mediation.ads; import android.app.Activity; import androidx.annotation.Nullable; import com.applovin.impl.ge; import com.applovin.impl.qc; import com.applovin.impl.sdk.j; import com.applovin.impl.sdk.n; import com.applovin.impl.sdk.utils.StringUtils; import com.applovin.impl.yp; import com.applovin.mediation.MaxAdExpirationListener; import com.applovin.mediation.MaxAdFormat; import com.applovin.mediation.MaxAdListener; import com.applovin.mediation.MaxAdRequestListener; import com.applovin.mediation.MaxAdRevenueListener; import com.applovin.mediation.MaxAdReviewListener; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; /* loaded from: classes2.dex */ public abstract class a { protected final MaxAdFormat adFormat; protected MaxAdListener adListener; @Nullable protected MaxAdReviewListener adReviewListener; protected final String adUnitId; @Nullable protected MaxAdExpirationListener expirationListener; protected final n logger; @Nullable protected MaxAdRequestListener requestListener; @Nullable protected MaxAdRevenueListener revenueListener; protected final j sdk; protected final String tag; protected final Map localExtraParameters = Collections.synchronizedMap(new HashMap()); protected final Map extraParameters = Collections.synchronizedMap(new HashMap()); /* renamed from: com.applovin.impl.mediation.ads.a$a, reason: collision with other inner class name */ public interface InterfaceC0026a extends MaxAdListener, MaxAdRevenueListener, MaxAdRequestListener { } public a(String str, MaxAdFormat maxAdFormat, String str2, j jVar) { this.adUnitId = str; this.adFormat = maxAdFormat; this.sdk = jVar; this.tag = str2; this.logger = jVar.J(); } public void a(ge geVar) { qc qcVar = new qc(); qcVar.a().a("MAX Ad").a(geVar).a(); if (n.a()) { this.logger.a(this.tag, qcVar.toString()); } } public void destroy() { this.localExtraParameters.clear(); this.adListener = null; this.revenueListener = null; this.requestListener = null; this.expirationListener = null; this.adReviewListener = null; } public String getAdUnitId() { return this.adUnitId; } public void logApiCall(String str) { if (n.a()) { this.logger.a(this.tag, str); } } public void setAdReviewListener(MaxAdReviewListener maxAdReviewListener) { if (n.a()) { this.logger.a(this.tag, "Setting Ad Review creative id listener: " + maxAdReviewListener); } this.adReviewListener = maxAdReviewListener; } public void setExpirationListener(@Nullable MaxAdExpirationListener maxAdExpirationListener) { if (n.a()) { this.logger.a(this.tag, "Setting expiration listener: " + maxAdExpirationListener); } this.expirationListener = maxAdExpirationListener; } public void setExtraParameter(String str, String str2) { if (str == null) { throw new IllegalArgumentException("No key specified"); } if (yp.c(this.sdk) && ("amazon_ad_response".equals(str) || "amazon_ad_error".equals(str))) { throw new IllegalArgumentException("`setExtraParameter()` is an incorrect method for passing `amazon_ad_response` or `amazon_ad_error`. Please use the following method: `setLocalExtraParameter()`. Also note that this exception occurs in development builds only."); } if (this.adFormat.isAdViewAd() && "ad_refresh_seconds".equals(str) && StringUtils.isValidString(str2)) { int parseInt = Integer.parseInt(str2); if (parseInt > TimeUnit.MINUTES.toSeconds(2L)) { n.h(this.tag, "Attempting to set extra parameter \"ad_refresh_seconds\" to over 2 minutes (" + parseInt + "s) - this will be ignored"); } } this.extraParameters.put(str, str2); } public void setListener(MaxAdListener maxAdListener) { if (n.a()) { this.logger.a(this.tag, "Setting listener: " + maxAdListener); } this.adListener = maxAdListener; } public void setLocalExtraParameter(String str, Object obj) { if (str == null) { throw new IllegalArgumentException("No key specified"); } if (obj instanceof Activity) { if (n.a()) { this.logger.b(this.tag, "Ignoring setting local extra parameter to Activity instance - please pass a WeakReference of it instead!"); } } else { if ("amazon_ad_response".equals(str) || "amazon_ad_error".equals(str)) { setExtraParameter("is_amazon_integration", Boolean.toString(true)); } this.localExtraParameters.put(str, obj); } } public void setRequestListener(MaxAdRequestListener maxAdRequestListener) { if (n.a()) { this.logger.a(this.tag, "Setting request listener: " + maxAdRequestListener); } this.requestListener = maxAdRequestListener; } public void setRevenueListener(MaxAdRevenueListener maxAdRevenueListener) { if (n.a()) { this.logger.a(this.tag, "Setting revenue listener: " + maxAdRevenueListener); } this.revenueListener = maxAdRevenueListener; } public static void logApiCall(String str, String str2) { j jVar = j.v0; if (jVar != null) { jVar.J(); if (n.a()) { j.v0.J().a(str, str2); } } } }