package com.ironsource.adapters.applovin; import android.content.Context; import android.text.TextUtils; import android.widget.FrameLayout; import com.applovin.adview.AppLovinAdView; import com.applovin.adview.AppLovinIncentivizedInterstitial; import com.applovin.adview.AppLovinInterstitialAd; import com.applovin.adview.AppLovinInterstitialAdDialog; import com.applovin.sdk.AppLovinAd; import com.applovin.sdk.AppLovinAdSize; import com.applovin.sdk.AppLovinErrorCodes; import com.applovin.sdk.AppLovinPrivacySettings; import com.applovin.sdk.AppLovinSdk; import com.applovin.sdk.AppLovinSdkConfiguration; import com.applovin.sdk.AppLovinSdkInitializationConfiguration; import com.applovin.sdk.AppLovinSdkSettings; import com.ironsource.environment.ContextProvider; import com.ironsource.mediationsdk.AbstractAdapter; import com.ironsource.mediationsdk.AdapterUtils; import com.ironsource.mediationsdk.INetworkInitCallbackListener; import com.ironsource.mediationsdk.ISBannerSize; import com.ironsource.mediationsdk.IntegrationData; import com.ironsource.mediationsdk.IronSource; import com.ironsource.mediationsdk.IronSourceBannerLayout; import com.ironsource.mediationsdk.LoadWhileShowSupportState; import com.ironsource.mediationsdk.logger.IronLog; import com.ironsource.mediationsdk.metadata.MetaDataUtils; import com.ironsource.mediationsdk.sdk.BannerSmashListener; import com.ironsource.mediationsdk.sdk.InterstitialSmashListener; import com.ironsource.mediationsdk.sdk.RewardedVideoSmashListener; import com.ironsource.mediationsdk.utils.ErrorBuilder; import com.ironsource.mediationsdk.utils.IronSourceConstants; import csdk.gluads.ironsource.EAIronSource; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.atomic.AtomicBoolean; import org.json.JSONObject; /* loaded from: classes2.dex */ class AppLovinAdapter extends AbstractAdapter implements INetworkInitCallbackListener { private static final String DEFAULT_ZONE_ID = "defaultZoneId"; private static final String GitHash = "824ceff"; private static final String SDK_KEY = "sdkKey"; private static final String VERSION = "4.3.47"; private static final String ZONE_ID = "zoneId"; private static AppLovinSdk mAppLovinSdk; private static AppLovinSdkSettings mAppLovinSettings; protected final CopyOnWriteArraySet mRewardedVideoZoneIdsForInitCallbacks; protected final ConcurrentHashMap mZoneIdToAppLovinBannerListener; protected final ConcurrentHashMap mZoneIdToAppLovinInterstitialListener; protected final ConcurrentHashMap mZoneIdToAppLovinRewardedVideoListener; protected final ConcurrentHashMap mZoneIdToBannerAd; protected final ConcurrentHashMap mZoneIdToBannerLayout; protected final ConcurrentHashMap mZoneIdToBannerSize; protected final ConcurrentHashMap mZoneIdToBannerSmashListener; protected final ConcurrentHashMap mZoneIdToInterstitialAdReadyStatus; protected final ConcurrentHashMap mZoneIdToInterstitialSmashListener; protected final ConcurrentHashMap mZoneIdToRewardedVideoAd; protected final ConcurrentHashMap mZoneIdToRewardedVideoSmashListener; protected static final ConcurrentHashMap mZoneIdToInterstitialAd = new ConcurrentHashMap<>(); private static final AtomicBoolean mWasInitCalled = new AtomicBoolean(false); private static InitState mInitState = InitState.INIT_STATE_NONE; private static final HashSet initCallbackListeners = new HashSet<>(); public enum InitState { INIT_STATE_NONE, INIT_STATE_IN_PROGRESS, INIT_STATE_SUCCESS, INIT_STATE_FAILED } public String getErrorString(int i) { if (i == -8) { return "The provided ad token is invalid; ad token must be returned from AppLovin S2S integration."; } if (i == -7) { return "The zone provided is invalid; the zone needs to be added to your AppLovin account or may still be propagating to our servers."; } if (i == -6) { return "There has been a failure to render an ad on screen."; } switch (i) { case -1009: return "The device had no network connectivity at the time of an ad request, either due to airplane mode or no service."; case -1001: return "The network conditions prevented the SDK from receiving an ad."; case AppLovinErrorCodes.INVALID_URL /* -900 */: return "A postback URL you attempted to dispatch was empty or nil."; case AppLovinErrorCodes.INVALID_RESPONSE /* -800 */: return "The AppLovin servers have returned an invalid response"; case AppLovinErrorCodes.INCENTIVIZED_USER_CLOSED_VIDEO /* -600 */: return "The user exited out of the ad early. You may or may not wish to grant a reward depending on your preference."; case AppLovinErrorCodes.INCENTIVIZED_SERVER_TIMEOUT /* -500 */: return "A reward validation requested timed out (usually due to poor connectivity)."; case AppLovinErrorCodes.INCENTIVIZED_UNKNOWN_SERVER_ERROR /* -400 */: return "An unknown server-side error occurred."; case AppLovinErrorCodes.INCENTIVIZED_NO_AD_PRELOADED /* -300 */: return "The developer called for a rewarded video before one was available."; case AppLovinErrorCodes.SDK_DISABLED /* -22 */: return "The SDK is currently disabled."; case -1: return "The system is in unexpected state."; case 204: return "No ads are currently eligible for your device."; default: switch (i) { case AppLovinErrorCodes.UNABLE_TO_PRECACHE_VIDEO_RESOURCES /* -202 */: return "An attempt to cache a video resource to the filesystem failed; the device may be out of space."; case AppLovinErrorCodes.UNABLE_TO_PRECACHE_IMAGE_RESOURCES /* -201 */: return "An attempt to cache an image resource to the filesystem failed; the device may be out of space."; case AppLovinErrorCodes.UNABLE_TO_PRECACHE_RESOURCES /* -200 */: return "An attempt to cache a resource to the filesystem failed; the device may be out of space."; default: return "Unknown error"; } } } @Override // com.ironsource.mediationsdk.AbstractAdapter public String getVersion() { return VERSION; } @Override // com.ironsource.mediationsdk.AbstractAdapter public boolean isUsingActivityBeforeImpression(IronSource.AD_UNIT ad_unit) { return false; } public static AppLovinAdapter startAdapter(String str) { if (EAIronSource.adapterDisabled(AppLovinAdapter.class.getName())) { return null; } return new AppLovinAdapter(str); } private AppLovinAdapter(String str) { super(str); IronLog.INTERNAL.verbose(); this.mZoneIdToAppLovinRewardedVideoListener = new ConcurrentHashMap<>(); this.mZoneIdToRewardedVideoAd = new ConcurrentHashMap<>(); this.mZoneIdToRewardedVideoSmashListener = new ConcurrentHashMap<>(); this.mRewardedVideoZoneIdsForInitCallbacks = new CopyOnWriteArraySet<>(); this.mZoneIdToAppLovinInterstitialListener = new ConcurrentHashMap<>(); this.mZoneIdToInterstitialSmashListener = new ConcurrentHashMap<>(); this.mZoneIdToInterstitialAdReadyStatus = new ConcurrentHashMap<>(); this.mZoneIdToAppLovinBannerListener = new ConcurrentHashMap<>(); this.mZoneIdToBannerSmashListener = new ConcurrentHashMap<>(); this.mZoneIdToBannerLayout = new ConcurrentHashMap<>(); this.mZoneIdToBannerAd = new ConcurrentHashMap<>(); this.mZoneIdToBannerSize = new ConcurrentHashMap<>(); this.mLWSSupportState = LoadWhileShowSupportState.LOAD_WHILE_SHOW_BY_INSTANCE; } public static IntegrationData getIntegrationData(Context context) { return new IntegrationData("AppLovin", VERSION); } @Override // com.ironsource.mediationsdk.AbstractAdapter public String getCoreSDKVersion() { return getAdapterSDKVersion(); } public static String getAdapterSDKVersion() { return AppLovinSdk.VERSION; } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: initSdk, reason: merged with bridge method [inline-methods] and merged with bridge method [inline-methods] and merged with bridge method [inline-methods] and merged with bridge method [inline-methods] */ public void lambda$initRewardedVideoWithCallback$0(String str, String str2) { if (mInitState == InitState.INIT_STATE_NONE || mInitState == InitState.INIT_STATE_IN_PROGRESS) { initCallbackListeners.add(this); } if (mWasInitCalled.compareAndSet(false, true)) { IronLog ironLog = IronLog.ADAPTER_API; ironLog.verbose("sdkKey = " + str); Context applicationContext = ContextProvider.getInstance().getApplicationContext(); mInitState = InitState.INIT_STATE_IN_PROGRESS; try { AppLovinSdkInitializationConfiguration build = AppLovinSdkInitializationConfiguration.builder(str, applicationContext).setMediationProvider("ironsource").build(); AppLovinSdk appLovinSdk = AppLovinSdk.getInstance(applicationContext); mAppLovinSdk = appLovinSdk; AppLovinSdkSettings settings = appLovinSdk.getSettings(); settings.setVerboseLogging(isAdaptersDebugEnabled()); if (!TextUtils.isEmpty(str2)) { ironLog.verbose("setUserIdentifier to " + str2); settings.setUserIdentifier(str2); } mAppLovinSettings = settings; mAppLovinSdk.initialize(build, new AppLovinSdk.SdkInitializationListener() { // from class: com.ironsource.adapters.applovin.AppLovinAdapter.1 @Override // com.applovin.sdk.AppLovinSdk.SdkInitializationListener public void onSdkInitialized(AppLovinSdkConfiguration appLovinSdkConfiguration) { AppLovinAdapter.this.initializationSuccess(); } }); } catch (Throwable th) { initializationFailure(th.getMessage()); } } } /* JADX INFO: Access modifiers changed from: private */ public void initializationSuccess() { IronLog.ADAPTER_CALLBACK.verbose(); mInitState = InitState.INIT_STATE_SUCCESS; Iterator it = initCallbackListeners.iterator(); while (it.hasNext()) { it.next().onNetworkInitCallbackSuccess(); } initCallbackListeners.clear(); } private void initializationFailure(String str) { IronLog.ADAPTER_CALLBACK.verbose(); mInitState = InitState.INIT_STATE_FAILED; Iterator it = initCallbackListeners.iterator(); while (it.hasNext()) { it.next().onNetworkInitCallbackFailed("AppLovin sdk init failed - " + str); } initCallbackListeners.clear(); } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.INetworkInitCallbackListener public void onNetworkInitCallbackSuccess() { for (String str : this.mZoneIdToRewardedVideoSmashListener.keySet()) { RewardedVideoSmashListener rewardedVideoSmashListener = this.mZoneIdToRewardedVideoSmashListener.get(str); if (rewardedVideoSmashListener != null) { if (this.mRewardedVideoZoneIdsForInitCallbacks.contains(str)) { rewardedVideoSmashListener.onRewardedVideoInitSuccess(); } else { loadRewardedVideoInternal(str, rewardedVideoSmashListener); } } } Iterator it = this.mZoneIdToInterstitialSmashListener.values().iterator(); while (it.hasNext()) { it.next().onInterstitialInitSuccess(); } Iterator it2 = this.mZoneIdToBannerSmashListener.values().iterator(); while (it2.hasNext()) { it2.next().onBannerInitSuccess(); } } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.INetworkInitCallbackListener public void onNetworkInitCallbackFailed(String str) { for (String str2 : this.mZoneIdToRewardedVideoSmashListener.keySet()) { RewardedVideoSmashListener rewardedVideoSmashListener = this.mZoneIdToRewardedVideoSmashListener.get(str2); if (rewardedVideoSmashListener != null) { if (this.mRewardedVideoZoneIdsForInitCallbacks.contains(str2)) { rewardedVideoSmashListener.onRewardedVideoInitFailed(ErrorBuilder.buildInitFailedError(str, IronSourceConstants.REWARDED_VIDEO_AD_UNIT)); } else { rewardedVideoSmashListener.onRewardedVideoAvailabilityChanged(false); } } } Iterator it = this.mZoneIdToInterstitialSmashListener.values().iterator(); while (it.hasNext()) { it.next().onInterstitialInitFailed(ErrorBuilder.buildInitFailedError(str, "Interstitial")); } Iterator it2 = this.mZoneIdToBannerSmashListener.values().iterator(); while (it2.hasNext()) { it2.next().onBannerInitFailed(ErrorBuilder.buildInitFailedError(str, "Banner")); } } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.sdk.RewardedVideoAdapterInterface public void initRewardedVideoWithCallback(String str, final String str2, JSONObject jSONObject, RewardedVideoSmashListener rewardedVideoSmashListener) { String zoneId = getZoneId(jSONObject); final String optString = jSONObject.optString(SDK_KEY); if (TextUtils.isEmpty(optString)) { IronLog.INTERNAL.error("error - missing param - sdkKey"); rewardedVideoSmashListener.onRewardedVideoInitFailed(ErrorBuilder.buildInitFailedError("Missing param - sdkKey", IronSourceConstants.REWARDED_VIDEO_AD_UNIT)); return; } if (TextUtils.isEmpty(zoneId)) { IronLog.INTERNAL.error("Missing param - zoneId"); rewardedVideoSmashListener.onRewardedVideoInitFailed(ErrorBuilder.buildInitFailedError("Missing param - zoneId", IronSourceConstants.REWARDED_VIDEO_AD_UNIT)); return; } IronLog.ADAPTER_API.verbose("zoneId = " + zoneId); this.mZoneIdToRewardedVideoSmashListener.put(zoneId, rewardedVideoSmashListener); this.mRewardedVideoZoneIdsForInitCallbacks.add(zoneId); int i = AnonymousClass2.$SwitchMap$com$ironsource$adapters$applovin$AppLovinAdapter$InitState[mInitState.ordinal()]; if (i == 1 || i == 2) { AbstractAdapter.postOnUIThread(new Runnable() { // from class: com.ironsource.adapters.applovin.AppLovinAdapter$$ExternalSyntheticLambda4 @Override // java.lang.Runnable public final void run() { AppLovinAdapter.this.lambda$initRewardedVideoWithCallback$0(optString, str2); } }); } else { if (i != 3) { return; } rewardedVideoSmashListener.onRewardedVideoInitSuccess(); } } /* renamed from: com.ironsource.adapters.applovin.AppLovinAdapter$2, reason: invalid class name */ public static /* synthetic */ class AnonymousClass2 { static final /* synthetic */ int[] $SwitchMap$com$ironsource$adapters$applovin$AppLovinAdapter$InitState; static { int[] iArr = new int[InitState.values().length]; $SwitchMap$com$ironsource$adapters$applovin$AppLovinAdapter$InitState = iArr; try { iArr[InitState.INIT_STATE_NONE.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { $SwitchMap$com$ironsource$adapters$applovin$AppLovinAdapter$InitState[InitState.INIT_STATE_IN_PROGRESS.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { $SwitchMap$com$ironsource$adapters$applovin$AppLovinAdapter$InitState[InitState.INIT_STATE_SUCCESS.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } } } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.sdk.RewardedVideoAdapterInterface public void initAndLoadRewardedVideo(String str, final String str2, JSONObject jSONObject, JSONObject jSONObject2, RewardedVideoSmashListener rewardedVideoSmashListener) { String zoneId = getZoneId(jSONObject); final String optString = jSONObject.optString(SDK_KEY); if (TextUtils.isEmpty(optString)) { IronLog.INTERNAL.error("Missing param - sdkKey"); rewardedVideoSmashListener.onRewardedVideoAvailabilityChanged(false); return; } if (TextUtils.isEmpty(zoneId)) { IronLog.INTERNAL.error("Missing param - zoneId"); rewardedVideoSmashListener.onRewardedVideoAvailabilityChanged(false); return; } IronLog.ADAPTER_API.verbose("zoneId = " + zoneId); this.mZoneIdToRewardedVideoSmashListener.put(zoneId, rewardedVideoSmashListener); int i = AnonymousClass2.$SwitchMap$com$ironsource$adapters$applovin$AppLovinAdapter$InitState[mInitState.ordinal()]; if (i == 1 || i == 2) { AbstractAdapter.postOnUIThread(new Runnable() { // from class: com.ironsource.adapters.applovin.AppLovinAdapter$$ExternalSyntheticLambda2 @Override // java.lang.Runnable public final void run() { AppLovinAdapter.this.lambda$initAndLoadRewardedVideo$1(optString, str2); } }); } else { if (i != 3) { return; } loadRewardedVideoInternal(zoneId, rewardedVideoSmashListener); } } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.sdk.RewardedVideoAdapterInterface public void loadRewardedVideo(JSONObject jSONObject, JSONObject jSONObject2, RewardedVideoSmashListener rewardedVideoSmashListener) { loadRewardedVideoInternal(getZoneId(jSONObject), rewardedVideoSmashListener); } private void loadRewardedVideoInternal(String str, RewardedVideoSmashListener rewardedVideoSmashListener) { AppLovinIncentivizedInterstitial create; IronLog.ADAPTER_API.verbose("zoneId = " + str); if (this.mZoneIdToRewardedVideoAd.containsKey(str)) { create = this.mZoneIdToRewardedVideoAd.get(str); } else { if (!str.equals(DEFAULT_ZONE_ID)) { create = AppLovinIncentivizedInterstitial.create(str, mAppLovinSdk); } else { create = AppLovinIncentivizedInterstitial.create(mAppLovinSdk); } this.mZoneIdToRewardedVideoAd.put(str, create); } AppLovinRewardedVideoListener appLovinRewardedVideoListener = new AppLovinRewardedVideoListener(this, rewardedVideoSmashListener, str); this.mZoneIdToAppLovinRewardedVideoListener.put(str, appLovinRewardedVideoListener); create.preload(appLovinRewardedVideoListener); } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.sdk.RewardedVideoAdapterInterface public void showRewardedVideo(JSONObject jSONObject, RewardedVideoSmashListener rewardedVideoSmashListener) { String zoneId = getZoneId(jSONObject); IronLog.ADAPTER_API.verbose("zoneId = " + zoneId); if (isRewardedVideoAvailable(jSONObject)) { if (!TextUtils.isEmpty(getDynamicUserId())) { mAppLovinSettings.setUserIdentifier(getDynamicUserId()); } AppLovinIncentivizedInterstitial appLovinIncentivizedInterstitial = this.mZoneIdToRewardedVideoAd.get(zoneId); AppLovinRewardedVideoListener appLovinRewardedVideoListener = this.mZoneIdToAppLovinRewardedVideoListener.get(zoneId); appLovinIncentivizedInterstitial.show(ContextProvider.getInstance().getCurrentActiveActivity(), appLovinRewardedVideoListener, appLovinRewardedVideoListener, appLovinRewardedVideoListener, appLovinRewardedVideoListener); return; } rewardedVideoSmashListener.onRewardedVideoAdShowFailed(ErrorBuilder.buildNoAdsToShowError(IronSourceConstants.REWARDED_VIDEO_AD_UNIT)); } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.sdk.RewardedVideoAdapterInterface public boolean isRewardedVideoAvailable(JSONObject jSONObject) { AppLovinIncentivizedInterstitial appLovinIncentivizedInterstitial = this.mZoneIdToRewardedVideoAd.get(getZoneId(jSONObject)); return appLovinIncentivizedInterstitial != null && appLovinIncentivizedInterstitial.isAdReadyToDisplay(); } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.sdk.InterstitialAdapterInterface public void initInterstitial(String str, final String str2, JSONObject jSONObject, InterstitialSmashListener interstitialSmashListener) { String zoneId = getZoneId(jSONObject); final String optString = jSONObject.optString(SDK_KEY); if (TextUtils.isEmpty(optString)) { IronLog.INTERNAL.error("Missing param - sdkKey"); interstitialSmashListener.onInterstitialInitFailed(ErrorBuilder.buildInitFailedError("Missing param - sdkKey", "Interstitial")); return; } if (TextUtils.isEmpty(zoneId)) { IronLog.INTERNAL.error("Missing param - zoneId"); interstitialSmashListener.onInterstitialInitFailed(ErrorBuilder.buildInitFailedError("Missing param - zoneId", "Interstitial")); return; } IronLog.ADAPTER_API.verbose("zoneId = " + zoneId); this.mZoneIdToInterstitialSmashListener.put(zoneId, interstitialSmashListener); int i = AnonymousClass2.$SwitchMap$com$ironsource$adapters$applovin$AppLovinAdapter$InitState[mInitState.ordinal()]; if (i == 1 || i == 2) { AbstractAdapter.postOnUIThread(new Runnable() { // from class: com.ironsource.adapters.applovin.AppLovinAdapter$$ExternalSyntheticLambda3 @Override // java.lang.Runnable public final void run() { AppLovinAdapter.this.lambda$initInterstitial$2(optString, str2); } }); } else { if (i != 3) { return; } interstitialSmashListener.onInterstitialInitSuccess(); } } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.sdk.InterstitialAdapterInterface public void loadInterstitial(JSONObject jSONObject, JSONObject jSONObject2, InterstitialSmashListener interstitialSmashListener) { String zoneId = getZoneId(jSONObject); IronLog.ADAPTER_API.verbose("zoneId = " + zoneId); AppLovinInterstitialListener appLovinInterstitialListener = new AppLovinInterstitialListener(this, interstitialSmashListener, zoneId); this.mZoneIdToAppLovinInterstitialListener.put(zoneId, appLovinInterstitialListener); if (mZoneIdToInterstitialAd.containsKey(zoneId)) { String str = "AppLovin can't load multiple interstitial ads for the same zoneId - " + zoneId + ", skipping load attempt since there is a loaded interstitial ad for this zoneId"; IronLog.INTERNAL.info(str); interstitialSmashListener.onInterstitialAdLoadFailed(ErrorBuilder.buildLoadFailedError(str)); return; } if (!zoneId.equals(DEFAULT_ZONE_ID)) { mAppLovinSdk.getAdService().loadNextAdForZoneId(zoneId, appLovinInterstitialListener); } else { mAppLovinSdk.getAdService().loadNextAd(AppLovinAdSize.INTERSTITIAL, appLovinInterstitialListener); } } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.sdk.InterstitialAdapterInterface public void showInterstitial(JSONObject jSONObject, InterstitialSmashListener interstitialSmashListener) { String zoneId = getZoneId(jSONObject); IronLog.ADAPTER_API.verbose("zoneId = " + zoneId); if (isInterstitialReady(jSONObject)) { AppLovinAd appLovinAd = mZoneIdToInterstitialAd.get(zoneId); AppLovinInterstitialListener appLovinInterstitialListener = this.mZoneIdToAppLovinInterstitialListener.get(zoneId); AppLovinInterstitialAdDialog create = AppLovinInterstitialAd.create(mAppLovinSdk, ContextProvider.getInstance().getApplicationContext()); create.setAdClickListener(appLovinInterstitialListener); create.setAdDisplayListener(appLovinInterstitialListener); create.setAdVideoPlaybackListener(appLovinInterstitialListener); create.showAndRender(appLovinAd); this.mZoneIdToInterstitialAdReadyStatus.put(zoneId, Boolean.FALSE); return; } mZoneIdToInterstitialAd.remove(zoneId); interstitialSmashListener.onInterstitialAdShowFailed(ErrorBuilder.buildNoAdsToShowError("Interstitial")); } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.sdk.InterstitialAdapterInterface public boolean isInterstitialReady(JSONObject jSONObject) { String zoneId = getZoneId(jSONObject); return mZoneIdToInterstitialAd.containsKey(zoneId) && this.mZoneIdToInterstitialAdReadyStatus.containsKey(zoneId) && this.mZoneIdToInterstitialAdReadyStatus.get(zoneId).booleanValue(); } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.sdk.BannerAdapterInterface public void initBanners(String str, final String str2, JSONObject jSONObject, BannerSmashListener bannerSmashListener) { String zoneId = getZoneId(jSONObject); final String optString = jSONObject.optString(SDK_KEY); if (TextUtils.isEmpty(optString)) { IronLog.INTERNAL.error("Missing param - sdkKey"); bannerSmashListener.onBannerInitFailed(ErrorBuilder.buildInitFailedError("Missing param - sdkKey", "Banner")); return; } if (TextUtils.isEmpty(zoneId)) { IronLog.INTERNAL.error("Missing param - zoneId"); bannerSmashListener.onBannerInitFailed(ErrorBuilder.buildInitFailedError("Missing param - zoneId", "Banner")); return; } IronLog.ADAPTER_API.verbose("zoneId = " + zoneId); this.mZoneIdToBannerSmashListener.put(zoneId, bannerSmashListener); int i = AnonymousClass2.$SwitchMap$com$ironsource$adapters$applovin$AppLovinAdapter$InitState[mInitState.ordinal()]; if (i == 1 || i == 2) { AbstractAdapter.postOnUIThread(new Runnable() { // from class: com.ironsource.adapters.applovin.AppLovinAdapter$$ExternalSyntheticLambda5 @Override // java.lang.Runnable public final void run() { AppLovinAdapter.this.lambda$initBanners$3(optString, str2); } }); } else { if (i != 3) { return; } bannerSmashListener.onBannerInitSuccess(); } } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.sdk.BannerAdapterInterface public void loadBanner(JSONObject jSONObject, JSONObject jSONObject2, final IronSourceBannerLayout ironSourceBannerLayout, final BannerSmashListener bannerSmashListener) { final String zoneId = getZoneId(jSONObject); IronLog.ADAPTER_API.verbose("zoneId = " + zoneId); if (ironSourceBannerLayout == null) { IronLog.INTERNAL.error("banner layout is null"); bannerSmashListener.onBannerAdLoadFailed(ErrorBuilder.buildNoConfigurationAvailableError("banner layout is null")); return; } final AppLovinAdSize calculateBannerSize = calculateBannerSize(ironSourceBannerLayout.getSize(), AdapterUtils.isLargeScreen(ContextProvider.getInstance().getApplicationContext())); if (calculateBannerSize == null) { IronLog.INTERNAL.error("size not supported, size is null"); bannerSmashListener.onBannerAdLoadFailed(ErrorBuilder.unsupportedBannerSize(getProviderName())); } else { AbstractAdapter.postOnUIThread(new Runnable() { // from class: com.ironsource.adapters.applovin.AppLovinAdapter$$ExternalSyntheticLambda1 @Override // java.lang.Runnable public final void run() { AppLovinAdapter.this.lambda$loadBanner$4(ironSourceBannerLayout, bannerSmashListener, zoneId, calculateBannerSize); } }); } } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void lambda$loadBanner$4(IronSourceBannerLayout ironSourceBannerLayout, BannerSmashListener bannerSmashListener, String str, AppLovinAdSize appLovinAdSize) { try { FrameLayout.LayoutParams bannerLayoutParams = getBannerLayoutParams(ironSourceBannerLayout.getSize()); AppLovinBannerListener appLovinBannerListener = new AppLovinBannerListener(this, bannerSmashListener, str, bannerLayoutParams); AppLovinAdView appLovinAdView = new AppLovinAdView(mAppLovinSdk, appLovinAdSize, ContextProvider.getInstance().getApplicationContext()); appLovinAdView.setAdDisplayListener(appLovinBannerListener); appLovinAdView.setAdClickListener(appLovinBannerListener); appLovinAdView.setAdViewEventListener(appLovinBannerListener); this.mZoneIdToBannerAd.put(str, appLovinAdView); this.mZoneIdToBannerLayout.put(str, bannerLayoutParams); this.mZoneIdToAppLovinBannerListener.put(str, appLovinBannerListener); this.mZoneIdToBannerSize.put(str, appLovinAdSize); if (!str.equals(DEFAULT_ZONE_ID)) { mAppLovinSdk.getAdService().loadNextAdForZoneId(str, appLovinBannerListener); } else { mAppLovinSdk.getAdService().loadNextAd(appLovinAdSize, appLovinBannerListener); } } catch (Exception e) { bannerSmashListener.onBannerAdLoadFailed(ErrorBuilder.buildLoadFailedError(getProviderName() + " loadBanner exception " + e.getMessage())); } } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.sdk.BannerAdapterInterface public void destroyBanner(JSONObject jSONObject) { final String zoneId = getZoneId(jSONObject); final AppLovinAdView appLovinAdView = this.mZoneIdToBannerAd.get(zoneId); AbstractAdapter.postOnUIThread(new Runnable() { // from class: com.ironsource.adapters.applovin.AppLovinAdapter$$ExternalSyntheticLambda0 @Override // java.lang.Runnable public final void run() { AppLovinAdapter.this.lambda$destroyBanner$5(appLovinAdView, zoneId); } }); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void lambda$destroyBanner$5(AppLovinAdView appLovinAdView, String str) { if (appLovinAdView != null) { appLovinAdView.destroy(); } this.mZoneIdToBannerAd.remove(str); this.mZoneIdToBannerLayout.remove(str); this.mZoneIdToAppLovinBannerListener.remove(str); this.mZoneIdToBannerSize.remove(str); } @Override // com.ironsource.mediationsdk.AbstractAdapter, com.ironsource.mediationsdk.sdk.ReleaseMemoryAdapterInterface public void releaseMemory(IronSource.AD_UNIT ad_unit, JSONObject jSONObject) { IronLog.INTERNAL.verbose("adUnit = " + ad_unit); if (ad_unit == IronSource.AD_UNIT.REWARDED_VIDEO) { this.mZoneIdToAppLovinRewardedVideoListener.clear(); this.mZoneIdToRewardedVideoAd.clear(); this.mZoneIdToRewardedVideoSmashListener.clear(); this.mRewardedVideoZoneIdsForInitCallbacks.clear(); return; } if (ad_unit == IronSource.AD_UNIT.INTERSTITIAL) { this.mZoneIdToAppLovinInterstitialListener.clear(); this.mZoneIdToInterstitialAdReadyStatus.clear(); mZoneIdToInterstitialAd.clear(); this.mZoneIdToInterstitialSmashListener.clear(); return; } if (ad_unit == IronSource.AD_UNIT.BANNER) { AbstractAdapter.postOnUIThread(new Runnable() { // from class: com.ironsource.adapters.applovin.AppLovinAdapter$$ExternalSyntheticLambda6 @Override // java.lang.Runnable public final void run() { AppLovinAdapter.this.lambda$releaseMemory$6(); } }); } } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void lambda$releaseMemory$6() { Iterator it = this.mZoneIdToBannerAd.values().iterator(); while (it.hasNext()) { it.next().destroy(); } this.mZoneIdToAppLovinBannerListener.clear(); this.mZoneIdToBannerSmashListener.clear(); this.mZoneIdToBannerLayout.clear(); this.mZoneIdToBannerAd.clear(); } @Override // com.ironsource.mediationsdk.AbstractAdapter public void setMetaData(String str, List list) { if (list.isEmpty()) { return; } String str2 = list.get(0); IronLog.ADAPTER_API.verbose("key = " + str + ", value = " + str2); if (MetaDataUtils.isValidCCPAMetaData(str, str2)) { setCCPAValue(MetaDataUtils.getMetaDataBooleanValue(str2)); } } @Override // com.ironsource.mediationsdk.AbstractAdapter public void setConsent(boolean z) { IronLog.ADAPTER_API.verbose("consent = " + z); AppLovinPrivacySettings.setHasUserConsent(z, ContextProvider.getInstance().getApplicationContext()); } private void setCCPAValue(boolean z) { IronLog.ADAPTER_API.verbose("value = " + z); AppLovinPrivacySettings.setDoNotSell(z, ContextProvider.getInstance().getApplicationContext()); } private AppLovinAdSize calculateBannerSize(ISBannerSize iSBannerSize, boolean z) { if (iSBannerSize == null) { IronLog.ADAPTER_API.error(getProviderName() + " calculateLayoutParams - bannerSize is null"); return null; } String description = iSBannerSize.getDescription(); description.hashCode(); switch (description) { case "RECTANGLE": return AppLovinAdSize.MREC; case "LARGE": case "BANNER": return AppLovinAdSize.BANNER; case "SMART": return z ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; case "CUSTOM": if (iSBannerSize.getHeight() >= 40 && iSBannerSize.getHeight() <= 60) { return AppLovinAdSize.BANNER; } break; default: return null; } } /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */ /* JADX WARN: Code restructure failed: missing block: B:33:0x0051, code lost: if (r3.equals(com.ironsource.mediationsdk.l.c) == false) goto L4; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private android.widget.FrameLayout.LayoutParams getBannerLayoutParams(com.ironsource.mediationsdk.ISBannerSize r7) { /* r6 = this; android.widget.FrameLayout$LayoutParams r0 = new android.widget.FrameLayout$LayoutParams r1 = 0 r0.(r1, r1) com.ironsource.environment.ContextProvider r2 = com.ironsource.environment.ContextProvider.getInstance() android.content.Context r2 = r2.getApplicationContext() java.lang.String r3 = r7.getDescription() r3.hashCode() int r4 = r3.hashCode() r5 = -1 switch(r4) { case -387072689: goto L4b; case 72205083: goto L40; case 79011241: goto L35; case 1951953708: goto L2a; case 1999208305: goto L1f; default: goto L1d; } L1d: r1 = r5 goto L54 L1f: java.lang.String r1 = "CUSTOM" boolean r1 = r3.equals(r1) if (r1 != 0) goto L28 goto L1d L28: r1 = 4 goto L54 L2a: java.lang.String r1 = "BANNER" boolean r1 = r3.equals(r1) if (r1 != 0) goto L33 goto L1d L33: r1 = 3 goto L54 L35: java.lang.String r1 = "SMART" boolean r1 = r3.equals(r1) if (r1 != 0) goto L3e goto L1d L3e: r1 = 2 goto L54 L40: java.lang.String r1 = "LARGE" boolean r1 = r3.equals(r1) if (r1 != 0) goto L49 goto L1d L49: r1 = 1 goto L54 L4b: java.lang.String r4 = "RECTANGLE" boolean r3 = r3.equals(r4) if (r3 != 0) goto L54 goto L1d L54: r3 = 50 r4 = 320(0x140, float:4.48E-43) switch(r1) { case 0: goto Lae; case 1: goto La0; case 2: goto L7a; case 3: goto La0; case 4: goto L5c; default: goto L5b; } L5b: goto Lbf L5c: int r1 = r7.getHeight() r5 = 40 if (r1 < r5) goto Lbf int r7 = r7.getHeight() r1 = 60 if (r7 > r1) goto Lbf android.widget.FrameLayout$LayoutParams r0 = new android.widget.FrameLayout$LayoutParams int r7 = com.ironsource.mediationsdk.AdapterUtils.dpToPixels(r2, r4) int r1 = com.ironsource.mediationsdk.AdapterUtils.dpToPixels(r2, r3) r0.(r7, r1) goto Lbf L7a: boolean r7 = com.ironsource.mediationsdk.AdapterUtils.isLargeScreen(r2) if (r7 == 0) goto L92 android.widget.FrameLayout$LayoutParams r0 = new android.widget.FrameLayout$LayoutParams r7 = 728(0x2d8, float:1.02E-42) int r7 = com.ironsource.mediationsdk.AdapterUtils.dpToPixels(r2, r7) r1 = 90 int r1 = com.ironsource.mediationsdk.AdapterUtils.dpToPixels(r2, r1) r0.(r7, r1) goto Lbf L92: android.widget.FrameLayout$LayoutParams r0 = new android.widget.FrameLayout$LayoutParams int r7 = com.ironsource.mediationsdk.AdapterUtils.dpToPixels(r2, r4) int r1 = com.ironsource.mediationsdk.AdapterUtils.dpToPixels(r2, r3) r0.(r7, r1) goto Lbf La0: android.widget.FrameLayout$LayoutParams r0 = new android.widget.FrameLayout$LayoutParams int r7 = com.ironsource.mediationsdk.AdapterUtils.dpToPixels(r2, r4) int r1 = com.ironsource.mediationsdk.AdapterUtils.dpToPixels(r2, r3) r0.(r7, r1) goto Lbf Lae: android.widget.FrameLayout$LayoutParams r0 = new android.widget.FrameLayout$LayoutParams r7 = 300(0x12c, float:4.2E-43) int r7 = com.ironsource.mediationsdk.AdapterUtils.dpToPixels(r2, r7) r1 = 250(0xfa, float:3.5E-43) int r1 = com.ironsource.mediationsdk.AdapterUtils.dpToPixels(r2, r1) r0.(r7, r1) Lbf: r7 = 17 r0.gravity = r7 return r0 */ throw new UnsupportedOperationException("Method not decompiled: com.ironsource.adapters.applovin.AppLovinAdapter.getBannerLayoutParams(com.ironsource.mediationsdk.ISBannerSize):android.widget.FrameLayout$LayoutParams"); } private String getZoneId(JSONObject jSONObject) { return !TextUtils.isEmpty(jSONObject.optString(ZONE_ID)) ? jSONObject.optString(ZONE_ID) : DEFAULT_ZONE_ID; } }