MD5 校验值:27cf44ec6e0720408f5ef017a90a3331
AdControlManager.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.jiubang.commerce.ad.manager; import android.content.Context; import android.support.v4.app.NotificationCompat; import android.text.TextUtils; import com.gau.utils.net.IConnectListener; import com.gau.utils.net.request.THttpRequest; import com.gau.utils.net.response.IResponse; import com.jb.ga0.commerce.util.LogUtils; import com.jiubang.commerce.ad.AdSdkLogUtils; import com.jiubang.commerce.ad.bean.AdModuleInfoBean; import com.jiubang.commerce.ad.bean.MainModuleDataItemBeanWrapper; import com.jiubang.commerce.ad.cache.AdCachePool; import com.jiubang.commerce.ad.gomo.GomoAdHelper; import com.jiubang.commerce.ad.http.AdSdkRequestDataUtils; import com.jiubang.commerce.ad.http.AdSdkRequestHeader; import com.jiubang.commerce.ad.http.bean.BaseAppInfoBean; import com.jiubang.commerce.ad.http.bean.BaseIntellModuleBean; import com.jiubang.commerce.ad.http.bean.BaseModuleDataItemBean; import com.jiubang.commerce.ad.http.bean.BaseOnlineAdInfoBean; import com.jiubang.commerce.ad.http.bean.BaseOnlineModuleInfoBean; import com.jiubang.commerce.ad.http.bean.BaseResponseBean; import com.jiubang.commerce.ad.ironscr.IronScrAd; import com.jiubang.commerce.ad.manager.AdSdkManager; import com.jiubang.commerce.ad.params.AdSdkParamsBuilder; import com.jiubang.commerce.ad.params.ModuleRequestParams; import com.jiubang.commerce.ad.params.OuterAdLoader; import com.jiubang.commerce.ad.sdk.SdkAdProxy; import com.jiubang.commerce.ad.sdk.bean.SdkAdSourceAdInfoBean; import com.jiubang.commerce.ad.sdk.bean.SdkAdSourceAdWrapper; import com.jiubang.commerce.ad.tricks.fb.FbNativeAdTrick; import com.jiubang.commerce.database.table.AdvertFilterTable; import com.jiubang.commerce.statistics.AdSdkOperationStatistic; import com.jiubang.commerce.statistics.adinfo.AdInfoStatisticManager; import com.jiubang.commerce.statistics.adinfo.ECommerceInfoManager; import com.jiubang.commerce.thread.AdSdkThread; import com.jiubang.commerce.utils.FileCacheUtils; import com.jiubang.commerce.utils.NetworkUtils; import com.jiubang.commerce.utils.StringUtils; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.http.HttpResponse; import org.json.JSONObject; public class AdControlManager { private static AdControlManager sInstance; private Context mContext; public interface AdControlRequestListener { void onFinish(int i, BaseModuleDataItemBean baseModuleDataItemBean, List<BaseModuleDataItemBean> list); } public interface AdIntellRequestListener { void onFinish(BaseIntellModuleBean baseIntellModuleBean); } public interface IBacthControlListener { void onFinish(List<BaseModuleDataItemBean> list); } public interface SdkAdSourceRequestListener { void onAdClicked(Object obj); void onAdClosed(Object obj); void onAdShowed(Object obj); void onException(int i); void onFinish(SdkAdSourceAdInfoBean sdkAdSourceAdInfoBean); } private AdControlManager(Context context) { this.mContext = context != null ? context.getApplicationContext() : null; } public static AdControlManager getInstance(Context context) { if (sInstance == null) { sInstance = new AdControlManager(context); } return sInstance; } public List<BaseModuleDataItemBean> getAdControlInfoFromCacheData(Context context, int i, MainModuleDataItemBeanWrapper mainModuleDataItemBeanWrapper) { List<BaseModuleDataItemBean> list; String readCacheDataToString = FileCacheUtils.readCacheDataToString(BaseModuleDataItemBean.getCacheFileName(i), true); if (!TextUtils.isEmpty(readCacheDataToString)) { try { BaseModuleDataItemBean parseMainModuleJsonObject = BaseModuleDataItemBean.parseMainModuleJsonObject(context, i, new JSONObject(readCacheDataToString)); if (mainModuleDataItemBeanWrapper != null) { mainModuleDataItemBeanWrapper.setMainModuleDataItemBean(parseMainModuleJsonObject); } if (parseMainModuleJsonObject != null) { list = parseMainModuleJsonObject.getChildModuleDataItemList(); if (list == null || list.isEmpty()) { if (list == null) { list = new ArrayList<>(); } list.add(parseMainModuleJsonObject); } } else { list = null; } boolean checkControlInfoValid = parseMainModuleJsonObject != null ? BaseModuleDataItemBean.checkControlInfoValid(parseMainModuleJsonObject.getSaveDataTime()) : false; if (!checkControlInfoValid && mainModuleDataItemBeanWrapper != null) { mainModuleDataItemBeanWrapper.setMainModuleDataItemBean(null); } if (list != null && !list.isEmpty() && checkControlInfoValid) { if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "[vmId:" + i + "]getAdControlInfoFromCacheData(Success, virtualModuleId:" + i + ", size:" + (list != null ? list.size() : -1) + ")"); } BaseResponseBean baseResponseBeanFromCacheData = BaseResponseBean.getBaseResponseBeanFromCacheData(context, i); if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "virtualModuleId=" + i + " user=" + baseResponseBeanFromCacheData.getUser() + " buychanneltype=" + baseResponseBeanFromCacheData.getBuychanneltype()); } for (int i2 = 0; i2 < list.size(); i2++) { list.get(i2).setBaseResponseBean(baseResponseBeanFromCacheData); } return list; } if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "[vmId:" + i + "]getAdControlInfoFromCacheData(Fail, virtualModuleId:" + i + ", size:" + (list != null ? list.size() : -1) + ")"); } } catch (Exception e) { e.printStackTrace(); } } return null; } public void getAdControlInfoFromNetwork(final Context context, final int i, int i2, boolean z, AdSdkParamsBuilder adSdkParamsBuilder, final AdControlRequestListener adControlRequestListener) { if (adControlRequestListener != null) { AdSdkRequestDataUtils.requestAdControlInfo(context, i, i2, z, adSdkParamsBuilder, new IConnectListener() { @Override public void onStart(THttpRequest tHttpRequest) { if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "[vmId:" + i + "]getAdControlInfoFromNetwork(onStart, virtualModuleId:" + i + ")"); } } @Override public void onFinish(THttpRequest tHttpRequest, IResponse iResponse) { JSONObject jSONObject; int i3; List<BaseModuleDataItemBean> list; try { jSONObject = new JSONObject(StringUtils.toString(iResponse.getResponse())); JSONObject jSONObject2 = jSONObject.has("result") ? jSONObject.getJSONObject("result") : null; i3 = jSONObject2 != null ? jSONObject2.getInt("status") : -1; if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "[vmId:" + i + "]getAdControlInfoFromNetwork(onFinish, status:" + i3 + "[" + (1 == i3) + "], virtualModuleId:" + i + ")"); } if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "[vmId:" + i + "]getAdControlInfoFromNetwork(" + i + ", " + jSONObject + ")"); } } catch (Exception e) { e.printStackTrace(); } if (1 == i3) { if (!AdSdkRequestDataUtils.canAdModuleReachable(context, i, jSONObject.optJSONObject(AdSdkRequestDataUtils.RESPONSE_JOSN_TAG_MFLAG))) { if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[vmId:" + i + "]ad module(" + i + ")removed-getAdControlInfoFromNetwork"); } adControlRequestListener.onFinish(19, null, null); return; } BaseResponseBean parseBaseResponseBeanJSONObject = BaseResponseBean.parseBaseResponseBeanJSONObject(context, i, jSONObject); if (parseBaseResponseBeanJSONObject != null) { if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "[vmId:" + i + "]virtualModuleId=" + i + " user=" + parseBaseResponseBeanJSONObject.getUser() + " buychanneltype=" + parseBaseResponseBeanJSONObject.getBuychanneltype()); } parseBaseResponseBeanJSONObject.saveSelfDataToSdcard(i); } JSONObject jSONObject3 = jSONObject.getJSONObject(AdSdkRequestDataUtils.RESPONSE_JOSN_TAG_DATAS); BaseModuleDataItemBean.saveAdDataToSdcard(i, jSONObject3); BaseModuleDataItemBean parseMainModuleJsonObject = BaseModuleDataItemBean.parseMainModuleJsonObject(context, i, jSONObject3); if (parseMainModuleJsonObject != null) { List<BaseModuleDataItemBean> childModuleDataItemList = parseMainModuleJsonObject.getChildModuleDataItemList(); if (childModuleDataItemList == null || childModuleDataItemList.isEmpty()) { if (childModuleDataItemList == null) { childModuleDataItemList = new ArrayList<>(); } childModuleDataItemList.add(parseMainModuleJsonObject); list = childModuleDataItemList; } else { list = childModuleDataItemList; } for (int i4 = 0; i4 < list.size(); i4++) { list.get(i4).setBaseResponseBean(parseBaseResponseBeanJSONObject); } try { Iterator<BaseModuleDataItemBean> it = list.iterator(); while (true) { if (!it.hasNext()) { break; } BaseModuleDataItemBean next = it.next(); if (next != null && next.getClearFlag() == 1) { break; } } } catch (Exception e2) { e2.printStackTrace(); } } else { list = null; } if (list != null && !list.isEmpty()) { adControlRequestListener.onFinish(16, parseMainModuleJsonObject, list); return; } else { adControlRequestListener.onFinish(20, parseMainModuleJsonObject, null); return; } } if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "[vmId:" + i + "]getAdControlInfoFromNetwork(onFinish--fail, status:" + i3 + ", responseJson:" + jSONObject + ")"); } adControlRequestListener.onFinish(18, null, null); } @Override public void onException(THttpRequest tHttpRequest, int i3) { adControlRequestListener.onFinish(18, null, null); if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "[vmId:" + i + "]getAdControlInfoFromNetwork(onException, reason:" + i3 + ", virtualModuleId:" + i + ")"); } } @Override public void onException(THttpRequest tHttpRequest, HttpResponse httpResponse, int i3) { onException(tHttpRequest, i3); } }); } } public void saveBatchAdControlInfoFromNetwork(final Context context, final List<ModuleRequestParams> list, boolean z, AdSdkParamsBuilder adSdkParamsBuilder) { AdSdkRequestDataUtils.requestAdControlInfo(context, list, "", z, adSdkParamsBuilder, new IConnectListener() { @Override public void onStart(THttpRequest tHttpRequest) { LogUtils.d("Ad_SDK", "saveBatchAdControlInfoFromNetwork(onStart)"); } @Override public void onFinish(THttpRequest tHttpRequest, IResponse iResponse) { AdControlManager.processBatchResponse(context, list, tHttpRequest, iResponse); } @Override public void onException(THttpRequest tHttpRequest, int i) { LogUtils.d("Ad_SDK", "saveBatchAdControlInfoFromNetwork(onException, reason:" + i); } @Override public void onException(THttpRequest tHttpRequest, HttpResponse httpResponse, int i) { onException(tHttpRequest, i); } }); } public static List<BaseModuleDataItemBean> processBatchResponse(Context context, List<ModuleRequestParams> list, THttpRequest tHttpRequest, IResponse iResponse) { List<BaseModuleDataItemBean> list2; ArrayList arrayList = new ArrayList(); try { JSONObject jSONObject = new JSONObject(StringUtils.toString(iResponse.getResponse())); JSONObject jSONObject2 = jSONObject.has("result") ? jSONObject.getJSONObject("result") : null; int i = jSONObject2 != null ? jSONObject2.getInt("status") : -1; LogUtils.d("Ad_SDK", "saveBatchAdControlInfoFromNetwork(onFinish, status:" + i + "[" + (1 == i) + "])"); if (1 == i) { Iterator<ModuleRequestParams> it = list.iterator(); while (it.hasNext()) { int intValue = it.next().getModuleId().intValue(); if (!AdSdkRequestDataUtils.canAdModuleReachable(context, intValue, jSONObject.optJSONObject(AdSdkRequestDataUtils.RESPONSE_JOSN_TAG_MFLAG))) { LogUtils.i("Ad_SDK", "[vmId:" + intValue + "]ad module(" + intValue + ")removed-saveBatchAdControlInfoFromNetwork"); } else { BaseResponseBean parseBaseResponseBeanJSONObject = BaseResponseBean.parseBaseResponseBeanJSONObject(context, intValue, jSONObject); if (parseBaseResponseBeanJSONObject != null) { LogUtils.d("Ad_SDK", "[vmId:" + intValue + "]virtualModuleId=" + intValue + " user=" + parseBaseResponseBeanJSONObject.getUser() + " buychanneltype=" + parseBaseResponseBeanJSONObject.getBuychanneltype()); parseBaseResponseBeanJSONObject.saveSelfDataToSdcard(intValue); } JSONObject jSONObject3 = jSONObject.getJSONObject(AdSdkRequestDataUtils.RESPONSE_JOSN_TAG_DATAS); LogUtils.d("Ad_SDK", "[vmId:" + intValue + "]saveBatchAdControlInfoFromNetwork(" + intValue + ", " + jSONObject3 + ")"); BaseModuleDataItemBean.saveAdDataToSdcard(intValue, jSONObject3); BaseModuleDataItemBean parseMainModuleJsonObject = BaseModuleDataItemBean.parseMainModuleJsonObject(context, intValue, jSONObject3); arrayList.add(parseMainModuleJsonObject); if (parseMainModuleJsonObject != null) { List<BaseModuleDataItemBean> childModuleDataItemList = parseMainModuleJsonObject.getChildModuleDataItemList(); if (childModuleDataItemList == null || childModuleDataItemList.isEmpty()) { if (childModuleDataItemList == null) { childModuleDataItemList = new ArrayList<>(); } childModuleDataItemList.add(parseMainModuleJsonObject); list2 = childModuleDataItemList; } else { list2 = childModuleDataItemList; } for (int i2 = 0; i2 < list2.size(); i2++) { list2.get(i2).setBaseResponseBean(parseBaseResponseBeanJSONObject); } try { Iterator<BaseModuleDataItemBean> it2 = list2.iterator(); while (true) { if (!it2.hasNext()) { break; } BaseModuleDataItemBean next = it2.next(); if (next != null && next.getClearFlag() == 1) { AdvertFilterTable.getInstance(context).deleteAllData(); break; } } } catch (Exception e) { e.printStackTrace(); } } } } } else { LogUtils.d("Ad_SDK", "saveBatchAdControlInfoFromNetwork(onFinish--fail, status:" + i + ", responseJson:" + jSONObject + ")"); } } catch (Exception e2) { e2.printStackTrace(); } return arrayList; } public void getBatchModuleControlInfo(final Context context, final List<ModuleRequestParams> list, AdSdkParamsBuilder adSdkParamsBuilder, boolean z, final IBacthControlListener iBacthControlListener) { if (iBacthControlListener != null) { final ArrayList arrayList = new ArrayList(); ArrayList arrayList2 = new ArrayList(); AdControlManager adControlManager = getInstance(context); for (ModuleRequestParams moduleRequestParams : list) { int intValue = moduleRequestParams.getModuleId().intValue(); MainModuleDataItemBeanWrapper mainModuleDataItemBeanWrapper = new MainModuleDataItemBeanWrapper(); adControlManager.getAdControlInfoFromCacheData(context, intValue, mainModuleDataItemBeanWrapper); if (mainModuleDataItemBeanWrapper.getMainModuleDataItemBean() != null) { arrayList.add(mainModuleDataItemBeanWrapper.getMainModuleDataItemBean()); } else { arrayList2.add(moduleRequestParams); } } if (!z || arrayList2.isEmpty() || !NetworkUtils.isNetworkOK(context)) { iBacthControlListener.onFinish(arrayList); } else { AdSdkRequestDataUtils.requestAdControlInfo(context, (List<ModuleRequestParams>) arrayList2, "", true, adSdkParamsBuilder, new IConnectListener() { @Override public void onStart(THttpRequest tHttpRequest) { LogUtils.d("Ad_SDK", "getBatchModuleControlInfo(onStart)"); } @Override public void onFinish(THttpRequest tHttpRequest, IResponse iResponse) { arrayList.addAll(AdControlManager.processBatchResponse(context, list, tHttpRequest, iResponse)); iBacthControlListener.onFinish(arrayList); } @Override public void onException(THttpRequest tHttpRequest, int i) { LogUtils.d("Ad_SDK", "getBatchModuleControlInfo(onException, reason:" + i); iBacthControlListener.onFinish(arrayList); } @Override public void onException(THttpRequest tHttpRequest, HttpResponse httpResponse, int i) { onException(tHttpRequest, i); } }); } } } public void loadSingleAdSourceInfo(final AdSdkParamsBuilder adSdkParamsBuilder, final List<BaseModuleDataItemBean> list, int i, final int i2, final boolean z, AdModuleInfoBean adModuleInfoBean, final AdSdkManager.ILoadAdvertDataListener iLoadAdvertDataListener) { boolean z2; final Context context = adSdkParamsBuilder.mContext; final int i3 = adSdkParamsBuilder.mVirtualModuleId; final int i4 = adSdkParamsBuilder.mReturnAdCount; final boolean z3 = adSdkParamsBuilder.mIsRequestData; boolean z4 = adSdkParamsBuilder.mIsAddFilterPackageNames; String str = adSdkParamsBuilder.mBuyuserchannel; Integer num = adSdkParamsBuilder.mCdays; final boolean z5 = adSdkParamsBuilder.mNeedShownFilter; if (iLoadAdvertDataListener == null) { LogUtils.e("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(failure, virtualModuleId:" + i3 + ", adSourceIndex:" + i + ", adCount:" + i4 + ", loadAdvertDataListener:" + iLoadAdvertDataListener + ")"); return; } if (adModuleInfoBean != null) { BaseModuleDataItemBean baseModuleDataItemBean = (i < 0 || list == null || list.size() <= i) ? null : list.get(i); if (baseModuleDataItemBean != null && baseModuleDataItemBean.isSdkOnlineAdType()) { SdkAdSourceAdInfoBean sdkAdSourceAdInfoBean = adModuleInfoBean.getSdkAdSourceAdInfoBean(); List<SdkAdSourceAdWrapper> adViewList = sdkAdSourceAdInfoBean != null ? sdkAdSourceAdInfoBean.getAdViewList() : null; if (AdModuleInfoBean.isMobileCoreAd(baseModuleDataItemBean) || (adViewList != null && !adViewList.isEmpty())) { z2 = true; if (!z2 || (adModuleInfoBean.getAdInfoList() != null && !adModuleInfoBean.getAdInfoList().isEmpty())) { iLoadAdvertDataListener.onAdInfoFinish(false, adModuleInfoBean); if (!LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(success, virtualModuleId:" + i3 + ", adSourceIndex:" + i + ", adCount:" + i4 + ")"); return; } return; } } } z2 = false; if (!z2) { } iLoadAdvertDataListener.onAdInfoFinish(false, adModuleInfoBean); if (!LogUtils.isShowLog()) { } } final int i5 = i + 1; if (list == null || list.size() <= i5) { if (list != null) { try { if (list.size() == 1) { BaseModuleDataItemBean baseModuleDataItemBean2 = list.get(0); List<BaseAppInfoBean> appInfoList = baseModuleDataItemBean2 != null ? baseModuleDataItemBean2.getAppInfoList() : null; if (appInfoList != null && appInfoList.size() > 0) { String readCacheDataToString = FileCacheUtils.readCacheDataToString(BaseModuleDataItemBean.getCacheFileName(i3), true); if (!TextUtils.isEmpty(readCacheDataToString)) { iLoadAdvertDataListener.onAdInfoFinish(true, BaseModuleDataItemBean.getOfflineAdInfoList(context, i3, i4, z5, baseModuleDataItemBean2, new JSONObject(readCacheDataToString))); if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(success---AlternateData, virtualModuleId:" + i3 + ", adSourceIndex:" + i5 + ", adCount:" + i4 + ", moduleDataItemList.size:" + (list != null ? Integer.valueOf(list.size()) : "null") + ")"); return; } return; } } } } catch (Exception e) { e.printStackTrace(); } } iLoadAdvertDataListener.onAdFail(21); if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(failure, virtualModuleId:" + i3 + ", adSourceIndex:" + i5 + ", adCount:" + i4 + ", moduleDataItemList.size:" + (list != null ? Integer.valueOf(list.size()) : "null") + ")"); return; } return; } final BaseModuleDataItemBean baseModuleDataItemBean3 = list.get(i5); if (baseModuleDataItemBean3 == null) { loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, null, iLoadAdvertDataListener); return; } try { if (!baseModuleDataItemBean3.isOfflineAdType()) { if (baseModuleDataItemBean3.isSdkOnlineAdType()) { if (!z) { iLoadAdvertDataListener.onAdInfoFinish(false, adModuleInfoBean); return; } if (AdModuleInfoBean.isFaceBookAd(baseModuleDataItemBean3) && adSdkParamsBuilder.commonLoadCondition(baseModuleDataItemBean3)) { SdkAdProxy.getInstance().loadFaceBookAdInfo(adSdkParamsBuilder, baseModuleDataItemBean3, new SdkAdSourceRequestListener() { @Override public void onFinish(SdkAdSourceAdInfoBean sdkAdSourceAdInfoBean2) { AdModuleInfoBean adModuleInfoBean2; List<SdkAdSourceAdWrapper> adViewList2 = sdkAdSourceAdInfoBean2 != null ? sdkAdSourceAdInfoBean2.getAdViewList() : null; if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(FaceBook--onFinish, virtualModuleId:" + i3 + ", adCount:" + (adViewList2 != null ? adViewList2.size() : -1) + ")"); } if (adViewList2 == null || adViewList2.isEmpty()) { adModuleInfoBean2 = null; } else { AdModuleInfoBean adModuleInfoBean3 = new AdModuleInfoBean(); if (sdkAdSourceAdInfoBean2.isFakeFbNative()) { adModuleInfoBean3.setFakeFbNativeControlInfo(baseModuleDataItemBean3, FbNativeAdTrick.adWrapper2AdInfoBeans(adViewList2)); adModuleInfoBean2 = adModuleInfoBean3; } else { adModuleInfoBean3.setSdkAdSourceAdInfoBean(sdkAdSourceAdInfoBean2); adModuleInfoBean3.setSdkAdControlInfo(baseModuleDataItemBean3); adModuleInfoBean2 = adModuleInfoBean3; } } if (adModuleInfoBean2 == null) { adModuleInfoBean2 = AdCachePool.getCacheAd(context, adSdkParamsBuilder, baseModuleDataItemBean3); } AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, adModuleInfoBean2, iLoadAdvertDataListener); } @Override public void onException(int i6) { AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, AdCachePool.getCacheAd(context, adSdkParamsBuilder, baseModuleDataItemBean3), iLoadAdvertDataListener); if (LogUtils.isShowLog()) { LogUtils.w("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(FaceBook--onException, virtualModuleId:" + i3 + ", " + i6 + ")"); } } @Override public void onAdShowed(Object obj) { iLoadAdvertDataListener.onAdShowed(obj); } @Override public void onAdClicked(Object obj) { AdInfoStatisticManager.getInstance(context).setHasClicked(AdControlManager.this.mContext, obj, true); ECommerceInfoManager.getInstance(context).setHasClicked(obj); iLoadAdvertDataListener.onAdClicked(obj); } @Override public void onAdClosed(Object obj) { iLoadAdvertDataListener.onAdClosed(obj); } }); return; } if (AdModuleInfoBean.isAdMobAd(baseModuleDataItemBean3) && adSdkParamsBuilder.commonLoadCondition(baseModuleDataItemBean3)) { SdkAdProxy.getInstance().loadAdMobAdInfo(adSdkParamsBuilder, baseModuleDataItemBean3, new SdkAdSourceRequestListener() { @Override public void onFinish(SdkAdSourceAdInfoBean sdkAdSourceAdInfoBean2) { AdModuleInfoBean adModuleInfoBean2 = null; List<SdkAdSourceAdWrapper> adViewList2 = sdkAdSourceAdInfoBean2 != null ? sdkAdSourceAdInfoBean2.getAdViewList() : null; if (adViewList2 != null && !adViewList2.isEmpty()) { adModuleInfoBean2 = new AdModuleInfoBean(); adModuleInfoBean2.setSdkAdSourceAdInfoBean(sdkAdSourceAdInfoBean2); adModuleInfoBean2.setSdkAdControlInfo(baseModuleDataItemBean3); } if (adModuleInfoBean2 == null) { adModuleInfoBean2 = AdCachePool.getCacheAd(context, adSdkParamsBuilder, baseModuleDataItemBean3); } AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, adModuleInfoBean2, iLoadAdvertDataListener); } @Override public void onException(int i6) { AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, AdCachePool.getCacheAd(context, adSdkParamsBuilder, baseModuleDataItemBean3), iLoadAdvertDataListener); } @Override public void onAdShowed(Object obj) { iLoadAdvertDataListener.onAdShowed(obj); } @Override public void onAdClicked(Object obj) { iLoadAdvertDataListener.onAdClicked(obj); } @Override public void onAdClosed(Object obj) { iLoadAdvertDataListener.onAdClosed(obj); } }); return; } if (AdModuleInfoBean.isMobileCoreAd(baseModuleDataItemBean3) && adSdkParamsBuilder.commonLoadCondition(baseModuleDataItemBean3)) { SdkAdProxy.getInstance().loadMobileCoreAdInfo(adSdkParamsBuilder, baseModuleDataItemBean3, new SdkAdSourceRequestListener() { @Override public void onFinish(SdkAdSourceAdInfoBean sdkAdSourceAdInfoBean2) { AdModuleInfoBean adModuleInfoBean2 = new AdModuleInfoBean(); adModuleInfoBean2.setSdkAdControlInfo(baseModuleDataItemBean3); iLoadAdvertDataListener.onAdInfoFinish(false, adModuleInfoBean2); } @Override public void onException(int i6) { AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, null, iLoadAdvertDataListener); } @Override public void onAdShowed(Object obj) { iLoadAdvertDataListener.onAdShowed(obj); } @Override public void onAdClicked(Object obj) { iLoadAdvertDataListener.onAdClicked(obj); } @Override public void onAdClosed(Object obj) { iLoadAdvertDataListener.onAdClosed(obj); } }); return; } if (AdModuleInfoBean.isLoopMeAd(baseModuleDataItemBean3) && adSdkParamsBuilder.commonLoadCondition(baseModuleDataItemBean3)) { SdkAdProxy.getInstance().loadLoopMeAdInfo(adSdkParamsBuilder, baseModuleDataItemBean3, new SdkAdSourceRequestListener() { @Override public void onFinish(SdkAdSourceAdInfoBean sdkAdSourceAdInfoBean2) { AdModuleInfoBean adModuleInfoBean2; List<SdkAdSourceAdWrapper> adViewList2 = sdkAdSourceAdInfoBean2 != null ? sdkAdSourceAdInfoBean2.getAdViewList() : null; if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(LoopMe--onFinish, virtualModuleId:" + i3 + ", adCount:" + (adViewList2 != null ? adViewList2.size() : -1) + ")"); } if (adViewList2 == null || adViewList2.isEmpty()) { adModuleInfoBean2 = null; } else { AdModuleInfoBean adModuleInfoBean3 = new AdModuleInfoBean(); adModuleInfoBean3.setSdkAdSourceAdInfoBean(sdkAdSourceAdInfoBean2); adModuleInfoBean3.setSdkAdControlInfo(baseModuleDataItemBean3); adModuleInfoBean2 = adModuleInfoBean3; } if (adModuleInfoBean2 == null) { adModuleInfoBean2 = AdCachePool.getCacheAd(context, adSdkParamsBuilder, baseModuleDataItemBean3); } AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, adModuleInfoBean2, iLoadAdvertDataListener); } @Override public void onException(int i6) { AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, AdCachePool.getCacheAd(context, adSdkParamsBuilder, baseModuleDataItemBean3), iLoadAdvertDataListener); if (LogUtils.isShowLog()) { LogUtils.w("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(LoopMe--onException, virtualModuleId:" + i3 + ", " + i6 + ")"); } } @Override public void onAdShowed(Object obj) { iLoadAdvertDataListener.onAdShowed(obj); } @Override public void onAdClicked(Object obj) { iLoadAdvertDataListener.onAdClicked(obj); } @Override public void onAdClosed(Object obj) { iLoadAdvertDataListener.onAdClosed(obj); } }); return; } if (AdModuleInfoBean.isVungleAd(baseModuleDataItemBean3) && adSdkParamsBuilder.commonLoadCondition(baseModuleDataItemBean3)) { if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[vmId:" + i3 + "]loadVungleAdAdInfo()"); } AdModuleInfoBean adModuleInfoBean2 = new AdModuleInfoBean(); adModuleInfoBean2.setSdkAdControlInfo(baseModuleDataItemBean3); iLoadAdvertDataListener.onAdInfoFinish(false, adModuleInfoBean2); return; } if (AdModuleInfoBean.isApplovinAd(baseModuleDataItemBean3) && adSdkParamsBuilder.commonLoadCondition(baseModuleDataItemBean3)) { if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[vmId:" + i3 + "]loadApplovinInfo()"); } AdModuleInfoBean adModuleInfoBean3 = new AdModuleInfoBean(); adModuleInfoBean3.setSdkAdControlInfo(baseModuleDataItemBean3); iLoadAdvertDataListener.onAdInfoFinish(false, adModuleInfoBean3); return; } if (AdModuleInfoBean.isCheetahAd(baseModuleDataItemBean3) && adSdkParamsBuilder.commonLoadCondition(baseModuleDataItemBean3)) { if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[vmId:" + i3 + "]loadCheetahInfo()"); } AdModuleInfoBean adModuleInfoBean4 = new AdModuleInfoBean(); adModuleInfoBean4.setSdkAdControlInfo(baseModuleDataItemBean3); iLoadAdvertDataListener.onAdInfoFinish(false, adModuleInfoBean4); return; } if (AdModuleInfoBean.isCheetahVideoAd(baseModuleDataItemBean3) && adSdkParamsBuilder.commonLoadCondition(baseModuleDataItemBean3)) { if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[vmId:" + i3 + "]loadCheetahVideoInfo()"); } AdModuleInfoBean adModuleInfoBean5 = new AdModuleInfoBean(); adModuleInfoBean5.setSdkAdControlInfo(baseModuleDataItemBean3); iLoadAdvertDataListener.onAdInfoFinish(false, adModuleInfoBean5); return; } if (AdModuleInfoBean.isIronScrAd(baseModuleDataItemBean3) && adSdkParamsBuilder.commonLoadCondition(baseModuleDataItemBean3)) { if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[vmId:" + i3 + "]loadIronScrInfo()"); } final long currentTimeMillis = System.currentTimeMillis(); AdSdkOperationStatistic.uploadAdRequestStatistic(context, IronScrAd.IRON_ID, adSdkParamsBuilder.mTabCategory, baseModuleDataItemBean3, adSdkParamsBuilder); SdkAdProxy.getInstance().loadIronScrAdInfo(adSdkParamsBuilder, baseModuleDataItemBean3, new SdkAdSourceRequestListener() { @Override public void onFinish(SdkAdSourceAdInfoBean sdkAdSourceAdInfoBean2) { AdModuleInfoBean adModuleInfoBean6; int size; List<SdkAdSourceAdWrapper> adViewList2 = sdkAdSourceAdInfoBean2 != null ? sdkAdSourceAdInfoBean2.getAdViewList() : null; if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(IronScrAd--onFinish, virtualModuleId:" + i3 + ", adCount:" + (adViewList2 != null ? adViewList2.size() : -1) + ")"); } if (adViewList2 == null || adViewList2.isEmpty()) { adModuleInfoBean6 = null; } else { AdModuleInfoBean adModuleInfoBean7 = new AdModuleInfoBean(); adModuleInfoBean7.setSdkAdSourceAdInfoBean(sdkAdSourceAdInfoBean2); adModuleInfoBean7.setSdkAdControlInfo(baseModuleDataItemBean3); adModuleInfoBean6 = adModuleInfoBean7; } if (sdkAdSourceAdInfoBean2 == null) { size = -2; } else { size = adViewList2 != null ? adViewList2.size() : -1; } AdSdkOperationStatistic.uploadAdRequestResultStatistic(context, IronScrAd.IRON_ID, adSdkParamsBuilder.mTabCategory, size, baseModuleDataItemBean3, System.currentTimeMillis() - currentTimeMillis, adSdkParamsBuilder); AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, adModuleInfoBean6 != null ? adModuleInfoBean6 : AdCachePool.getCacheAd(context, adSdkParamsBuilder, baseModuleDataItemBean3), iLoadAdvertDataListener); } @Override public void onException(int i6) { AdSdkOperationStatistic.uploadAdRequestResultStatistic(context, IronScrAd.IRON_ID, adSdkParamsBuilder.mTabCategory, -1, baseModuleDataItemBean3, System.currentTimeMillis() - currentTimeMillis, adSdkParamsBuilder); AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, AdCachePool.getCacheAd(context, adSdkParamsBuilder, baseModuleDataItemBean3), iLoadAdvertDataListener); if (LogUtils.isShowLog()) { LogUtils.w("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(IronScrAd--onException, virtualModuleId:" + i3 + ", " + i6 + ")"); } } @Override public void onAdShowed(Object obj) { iLoadAdvertDataListener.onAdShowed(obj); } @Override public void onAdClicked(Object obj) { iLoadAdvertDataListener.onAdClicked(obj); } @Override public void onAdClosed(Object obj) { iLoadAdvertDataListener.onAdClosed(obj); } }); return; } if ((AdModuleInfoBean.isMoPubAd(baseModuleDataItemBean3) || AdModuleInfoBean.isAmazonAd(baseModuleDataItemBean3)) && adSdkParamsBuilder.commonLoadCondition(baseModuleDataItemBean3)) { SdkAdProxy.getInstance().loadMoPubAdInfo(adSdkParamsBuilder, baseModuleDataItemBean3, new SdkAdSourceRequestListener() { @Override public void onFinish(SdkAdSourceAdInfoBean sdkAdSourceAdInfoBean2) { AdModuleInfoBean adModuleInfoBean6; List<SdkAdSourceAdWrapper> adViewList2 = sdkAdSourceAdInfoBean2 != null ? sdkAdSourceAdInfoBean2.getAdViewList() : null; if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(MoPubAd--onFinish, virtualModuleId:" + i3 + ", adCount:" + (adViewList2 != null ? adViewList2.size() : -1) + ")"); } if (adViewList2 == null || adViewList2.isEmpty()) { adModuleInfoBean6 = null; } else { AdModuleInfoBean adModuleInfoBean7 = new AdModuleInfoBean(); adModuleInfoBean7.setSdkAdSourceAdInfoBean(sdkAdSourceAdInfoBean2); adModuleInfoBean7.setSdkAdControlInfo(baseModuleDataItemBean3); adModuleInfoBean6 = adModuleInfoBean7; } if (adModuleInfoBean6 == null) { adModuleInfoBean6 = AdCachePool.getCacheAd(context, adSdkParamsBuilder, baseModuleDataItemBean3); } AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, adModuleInfoBean6, iLoadAdvertDataListener); } @Override public void onException(int i6) { AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, AdCachePool.getCacheAd(context, adSdkParamsBuilder, baseModuleDataItemBean3), iLoadAdvertDataListener); if (LogUtils.isShowLog()) { LogUtils.w("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(IronScrAd--onException, virtualModuleId:" + i3 + ", " + i6 + ")"); } } @Override public void onAdShowed(Object obj) { iLoadAdvertDataListener.onAdShowed(obj); } @Override public void onAdClicked(Object obj) { iLoadAdvertDataListener.onAdClicked(obj); } @Override public void onAdClosed(Object obj) { iLoadAdvertDataListener.onAdClosed(obj); } }); return; } else if (OuterAdLoader.canProcess(adSdkParamsBuilder, baseModuleDataItemBean3)) { if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[vmId:" + i3 + "]loadUnKnownAdSourceInfo(onStart)"); } OuterAdLoader.ProcessUnKnownAdSource(adSdkParamsBuilder, baseModuleDataItemBean3, new SdkAdSourceRequestListener() { @Override public void onFinish(SdkAdSourceAdInfoBean sdkAdSourceAdInfoBean2) { AdModuleInfoBean adModuleInfoBean6; List<SdkAdSourceAdWrapper> adViewList2 = sdkAdSourceAdInfoBean2 != null ? sdkAdSourceAdInfoBean2.getAdViewList() : null; if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[vmId:" + i3 + "]loadUnKnownAdSourceInfo(onFinish, virtualModuleId:" + i3 + ", adCount:" + (adViewList2 != null ? adViewList2.size() : -1) + ")"); } if (adViewList2 == null || adViewList2.isEmpty()) { adModuleInfoBean6 = null; } else { AdModuleInfoBean adModuleInfoBean7 = new AdModuleInfoBean(); adModuleInfoBean7.setSdkAdSourceAdInfoBean(sdkAdSourceAdInfoBean2); adModuleInfoBean7.setSdkAdControlInfo(baseModuleDataItemBean3); adModuleInfoBean6 = adModuleInfoBean7; } if (adModuleInfoBean6 == null) { adModuleInfoBean6 = AdCachePool.getCacheAd(context, adSdkParamsBuilder, baseModuleDataItemBean3); } AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, adModuleInfoBean6, iLoadAdvertDataListener); } @Override public void onException(int i6) { AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, AdCachePool.getCacheAd(context, adSdkParamsBuilder, baseModuleDataItemBean3), iLoadAdvertDataListener); if (LogUtils.isShowLog()) { LogUtils.w("Ad_SDK", "[vmId:" + i3 + "]loadUnKnownAdSourceInfo(onException, virtualModuleId:" + i3 + ", " + i6 + ")"); } } @Override public void onAdShowed(Object obj) { iLoadAdvertDataListener.onAdShowed(obj); } @Override public void onAdClicked(Object obj) { iLoadAdvertDataListener.onAdClicked(obj); } @Override public void onAdClosed(Object obj) { iLoadAdvertDataListener.onAdClosed(obj); } }); return; } } else if (AdModuleInfoBean.isGomoAd(baseModuleDataItemBean3) && adSdkParamsBuilder.commonLoadCondition(baseModuleDataItemBean3)) { new AdSdkThread("loadGomoAd", new Runnable() { @Override public void run() { AdModuleInfoBean adModuleInfoBean6; int i6 = -1; String[] fbIds = baseModuleDataItemBean3 != null ? baseModuleDataItemBean3.getFbIds() : null; int intValue = (fbIds == null || fbIds.length <= 0) ? -1 : StringUtils.toInteger(fbIds[0], -1).intValue(); if (intValue != -1) { String str2 = adSdkParamsBuilder.mTabCategory; if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "[vmId:" + i3 + "]loadGomoAds:tabCategory=" + str2); } long currentTimeMillis2 = System.currentTimeMillis(); AdSdkOperationStatistic.uploadAdRequestStatistic(context, "", str2, baseModuleDataItemBean3, adSdkParamsBuilder); adModuleInfoBean6 = GomoAdHelper.loadGomoAds(context, baseModuleDataItemBean3, i3, i4, baseModuleDataItemBean3.getFbAdvCount(), intValue, z3, z5, null); if (adModuleInfoBean6 != null && adModuleInfoBean6.getAdInfoList() != null) { i6 = adModuleInfoBean6.getAdInfoList().size(); } if (i6 > 0 && adSdkParamsBuilder.mReturnAdCount > 0 && i6 > adSdkParamsBuilder.mReturnAdCount) { adModuleInfoBean6.setAdInfoList(adModuleInfoBean6.getAdInfoList().subList(0, adSdkParamsBuilder.mReturnAdCount)); } AdSdkOperationStatistic.uploadAdRequestResultStatistic(context, "", str2, i6, baseModuleDataItemBean3, System.currentTimeMillis() - currentTimeMillis2, adSdkParamsBuilder); if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "[vmId:" + i3 + "]loadGomoAds(success--GomoAd:fbAdvCount:" + baseModuleDataItemBean3.getFbAdvCount() + ", fbId:" + intValue + ", getAdCount:" + ((adModuleInfoBean6 == null || adModuleInfoBean6.getAdInfoList() == null) ? "-1" : Integer.valueOf(adModuleInfoBean6.getAdInfoList().size())) + ")"); } } else { adModuleInfoBean6 = null; } AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, adModuleInfoBean6, iLoadAdvertDataListener); } }).start(); return; } else if (AdModuleInfoBean.isS2SAd(baseModuleDataItemBean3) && adSdkParamsBuilder.commonLoadCondition(baseModuleDataItemBean3)) { new AdSdkThread("loadS2SAd", new Runnable() { @Override public void run() { String str2 = adSdkParamsBuilder.mTabCategory; String[] fbIds = baseModuleDataItemBean3 != null ? baseModuleDataItemBean3.getFbIds() : null; int intValue = (fbIds == null || fbIds.length <= 0) ? -1 : StringUtils.toInteger(fbIds[0], -1).intValue(); if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "loadSingleAdSource:onlineApi:tabCategory=" + str2); } long currentTimeMillis2 = System.currentTimeMillis(); AdSdkOperationStatistic.uploadAdRequestStatistic(context, "", str2, baseModuleDataItemBean3, adSdkParamsBuilder); AdModuleInfoBean loadOnlineAdInfo = AdControlManager.this.loadOnlineAdInfo(context, baseModuleDataItemBean3, i3, i4, baseModuleDataItemBean3.getFbAdvCount(), intValue, z3, z5, null, adSdkParamsBuilder.mS2SParams); int i6 = -1; if (loadOnlineAdInfo != null && loadOnlineAdInfo.getAdInfoList() != null) { i6 = loadOnlineAdInfo.getAdInfoList().size(); } if (i6 > 0 && adSdkParamsBuilder.mReturnAdCount > 0 && i6 > adSdkParamsBuilder.mReturnAdCount) { loadOnlineAdInfo.setAdInfoList(loadOnlineAdInfo.getAdInfoList().subList(0, adSdkParamsBuilder.mReturnAdCount)); } AdSdkOperationStatistic.uploadAdRequestResultStatistic(context, "", str2, i6, baseModuleDataItemBean3, System.currentTimeMillis() - currentTimeMillis2, adSdkParamsBuilder); if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(success--onlineAd, virtualModuleId:" + i3 + ", fbAdvCount:" + baseModuleDataItemBean3.getFbAdvCount() + ", adPosId:" + intValue + ", getAdCount:" + ((loadOnlineAdInfo == null || loadOnlineAdInfo.getAdInfoList() == null) ? "-1" : Integer.valueOf(loadOnlineAdInfo.getAdInfoList().size())) + ")"); } AdControlManager.this.loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, loadOnlineAdInfo, iLoadAdvertDataListener); } }).start(); return; } } else if (adSdkParamsBuilder.commonLoadCondition(baseModuleDataItemBean3)) { String str2 = adSdkParamsBuilder.mTabCategory; if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "loadSingleAdSource:offlineAd:tabCategory=" + str2); } long currentTimeMillis2 = System.currentTimeMillis(); AdSdkOperationStatistic.uploadAdRequestStatistic(context, "", str2, baseModuleDataItemBean3, adSdkParamsBuilder); String readCacheDataToString2 = FileCacheUtils.readCacheDataToString(BaseModuleDataItemBean.getCacheFileName(i3), true); if (!TextUtils.isEmpty(readCacheDataToString2)) { try { adModuleInfoBean = BaseModuleDataItemBean.getOfflineAdInfoList(context, i3, i4, z5, baseModuleDataItemBean3, new JSONObject(readCacheDataToString2)); } catch (Exception e2) { e2.printStackTrace(); } } int i6 = -1; if (adModuleInfoBean != null && adModuleInfoBean.getAdInfoList() != null) { i6 = adModuleInfoBean.getAdInfoList().size(); } AdSdkOperationStatistic.uploadAdRequestResultStatistic(context, "", str2, i6, baseModuleDataItemBean3, System.currentTimeMillis() - currentTimeMillis2, adSdkParamsBuilder); if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(success--offlineAd[cache], virtualModuleId:" + i3 + ", getAdCount:" + ((adModuleInfoBean == null || adModuleInfoBean.getAdInfoList() == null) ? "-1" : Integer.valueOf(adModuleInfoBean.getAdInfoList().size())) + ")"); } loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, adModuleInfoBean, iLoadAdvertDataListener); return; } } catch (Exception e3) { e3.printStackTrace(); LogUtils.e("Ad_SDK", "[vmId:" + i3 + "]loadSingleAdSourceInfo(error, " + e3.getMessage() + ")", e3); } loadSingleAdSourceInfo(adSdkParamsBuilder, list, i5, i2, z, null, iLoadAdvertDataListener); } public void loadAdInfo(AdSdkParamsBuilder adSdkParamsBuilder, boolean z, int i, boolean z2, List<BaseModuleDataItemBean> list) { final Context context = adSdkParamsBuilder.mContext; final int i2 = adSdkParamsBuilder.mVirtualModuleId; final boolean z3 = adSdkParamsBuilder.mIsNeedDownloadIcon; final boolean z4 = adSdkParamsBuilder.mIsNeedDownloadBanner; final boolean z5 = adSdkParamsBuilder.mIsNeedPreResolve; final boolean z6 = adSdkParamsBuilder.mIsPreResolveBeforeShow; final AdSdkManager.ILoadAdvertDataListener iLoadAdvertDataListener = adSdkParamsBuilder.mLoadAdvertDataListener; if (LogUtils.isShowLog() && list != null && !list.isEmpty()) { Iterator<BaseModuleDataItemBean> it = list.iterator(); while (it.hasNext()) { LogUtils.i("Ad_SDK", "[vmId:" + i2 + "]广告源信息" + AdSdkLogUtils.getSimpleLogString(it.next())); } } loadSingleAdSourceInfo(adSdkParamsBuilder, list, -1, i, z2, null, new AdSdkManager.ILoadAdvertDataListener() { @Override public void onAdInfoFinish(boolean z7, AdModuleInfoBean adModuleInfoBean) { if (LogUtils.isShowLog()) { BaseModuleDataItemBean moduleDataItemBean = adModuleInfoBean != null ? adModuleInfoBean.getModuleDataItemBean() : null; if (moduleDataItemBean != null) { LogUtils.i("Ad_SDK", "[vmId:" + i2 + "]onAdInfoFinish(return, virtualModuleId:" + i2 + ", ModuleId:" + moduleDataItemBean.getModuleId() + ", " + adModuleInfoBean.getAdType() + ", AdvDataSource:" + moduleDataItemBean.getAdvDataSource() + ", Onlineadvtype:" + moduleDataItemBean.getOnlineAdvType() + ")"); } else { LogUtils.i("Ad_SDK", "[vmId:" + i2 + "]onAdInfoFinish(return, virtualModuleId:" + i2 + ", adModuleInfoBean or ModuleDataItemBean is null)"); } } AdSdkManager.handleAdData(context, z7, adModuleInfoBean, z3, z4, z5, z6, iLoadAdvertDataListener); } @Override public void onAdImageFinish(AdModuleInfoBean adModuleInfoBean) { } @Override public void onAdFail(int i3) { if (iLoadAdvertDataListener != null) { iLoadAdvertDataListener.onAdFail(i3); } if (LogUtils.isShowLog()) { LogUtils.w("Ad_SDK", "[vmId:" + i2 + "]onAdFail(return, statusCode:" + i3 + ")"); } } @Override public void onAdShowed(Object obj) { iLoadAdvertDataListener.onAdShowed(obj); } @Override public void onAdClicked(Object obj) { iLoadAdvertDataListener.onAdClicked(obj); } @Override public void onAdClosed(Object obj) { iLoadAdvertDataListener.onAdClosed(obj); } }); } public AdModuleInfoBean loadOnlineAdInfo(final Context context, final BaseModuleDataItemBean baseModuleDataItemBean, final int i, final int i2, int i3, final int i4, boolean z, final boolean z2, final List<String> list, AdSdkRequestHeader.S2SParams s2SParams) { if (!z) { String readCacheDataToString = FileCacheUtils.readCacheDataToString(BaseOnlineModuleInfoBean.getCacheFileName(i4), true); if (!TextUtils.isEmpty(readCacheDataToString)) { try { AdModuleInfoBean onlineAdInfoList = BaseOnlineModuleInfoBean.getOnlineAdInfoList(context, baseModuleDataItemBean, i4, i2, z2, list, new JSONObject(readCacheDataToString)); List<BaseOnlineAdInfoBean> onlineAdInfoList2 = onlineAdInfoList != null ? onlineAdInfoList.getOnlineAdInfoList() : null; if (onlineAdInfoList2 != null && !onlineAdInfoList2.isEmpty()) { BaseOnlineModuleInfoBean onlineModuleInfoBean = onlineAdInfoList.getOnlineModuleInfoBean(); long saveDataTime = onlineModuleInfoBean != null ? onlineModuleInfoBean.getSaveDataTime() : -1L; if (BaseOnlineModuleInfoBean.checkOnlineAdInfoValid(saveDataTime)) { if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "loadOnlineAdInfo(end--cacheData, onlineAdPosId:" + i4 + ", adCount:" + i2 + ", requestAdCount:" + i3 + ", adSize:" + (onlineAdInfoList.getOfflineAdInfoList() != null ? onlineAdInfoList.getOfflineAdInfoList().size() : -1) + ")"); return onlineAdInfoList; } return onlineAdInfoList; } if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "loadOnlineAdInfo(cacheData----cache data expired, loadOnlineAdTime:" + saveDataTime + ", onlineAdPosId:" + i4 + ", adCount:" + i2 + ", requestAdCount:" + i3 + ")"); } } } catch (Exception e) { e.printStackTrace(); if (LogUtils.isShowLog()) { LogUtils.e("Ad_SDK", "loadOnlineAdInfo(cacheData---error, Exception:" + (e != null ? e.getMessage() : "") + ", onlineAdPosId:" + i4 + ", adCount:" + i2 + ", requestAdCount:" + i3 + ")"); } } } } final ArrayList arrayList = new ArrayList(); AdSdkRequestDataUtils.requestOnlineAdInfo(context, i3, i4, s2SParams, new IConnectListener() { @Override public void onStart(THttpRequest tHttpRequest) { } @Override public void onFinish(THttpRequest tHttpRequest, IResponse iResponse) { try { JSONObject jSONObject = new JSONObject(StringUtils.toString(iResponse.getResponse())); JSONObject optJSONObject = jSONObject != null ? jSONObject.optJSONObject(BaseOnlineAdInfoBean.ONLINE_AD_JSON_TAG) : null; if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "loadOnlineAdInfo=" + optJSONObject); } if (optJSONObject == null || optJSONObject.length() < 1) { if (jSONObject != null && LogUtils.isShowLog()) { LogUtils.e("Ad_SDK", "loadOnlineAdInfo(error, " + i4 + ", 错误代码::->" + jSONObject.optInt("errorCode", -1) + ", 错误信息::->" + jSONObject.optString(NotificationCompat.CATEGORY_MESSAGE, "") + ")"); return; } return; } BaseOnlineModuleInfoBean.saveAdDataToSdcard(i4, optJSONObject); AdModuleInfoBean onlineAdInfoList3 = BaseOnlineModuleInfoBean.getOnlineAdInfoList(context, baseModuleDataItemBean, i4, i2, z2, list, optJSONObject); List<BaseOnlineAdInfoBean> onlineAdInfoList4 = onlineAdInfoList3 != null ? onlineAdInfoList3.getOnlineAdInfoList() : null; if (onlineAdInfoList4 != null && !onlineAdInfoList4.isEmpty()) { arrayList.add(onlineAdInfoList3); } if (LogUtils.isShowLog()) { LogUtils.d("Ad_SDK", "loadOnlineAdInfo(success, online ad size:" + (onlineAdInfoList4 != null ? onlineAdInfoList4.size() : -1) + ")"); } } catch (Exception e2) { e2.printStackTrace(); LogUtils.e("Ad_SDK", "loadOnlineAdInfo(error, virtualModuleId:" + i + ", errorMessage:" + (e2 != null ? e2.getMessage() : "") + ")"); } } @Override public void onException(THttpRequest tHttpRequest, int i5) { LogUtils.e("Ad_SDK", "loadOnlineAdInfo(error, virtualModuleId:" + i + ", reason:" + i5 + ")"); } @Override public void onException(THttpRequest tHttpRequest, HttpResponse httpResponse, int i5) { onException(tHttpRequest, i5); } }); if (arrayList.size() > 0) { return (AdModuleInfoBean) arrayList.get(0); } return null; } public void loadIntelligentAdInfo(final Context context, final int i, final AdIntellRequestListener adIntellRequestListener) { if (adIntellRequestListener != null) { AdSdkRequestDataUtils.requestIntelligentAdInfo(context, i, new IConnectListener() { @Override public void onStart(THttpRequest tHttpRequest) { LogUtils.i("Ad_SDK", "[adPos:" + i + "]loadIntelligentAdInfo(start)"); } @Override public void onFinish(THttpRequest tHttpRequest, IResponse iResponse) { BaseIntellModuleBean baseIntellModuleBean = null; try { JSONObject jSONObject = new JSONObject(StringUtils.toString(iResponse.getResponse())); baseIntellModuleBean = BaseIntellModuleBean.parseJSONObject(context, i, jSONObject); if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[adPos:" + i + "]loadIntelligentAdInfo(json:" + jSONObject + ")"); } if ((baseIntellModuleBean == null || baseIntellModuleBean.getmSuccess() != 1) && LogUtils.isShowLog()) { LogUtils.e("Ad_SDK", "[adPos:" + i + "]loadIntelligentAdInfo(serverError,message:" + (baseIntellModuleBean != null ? baseIntellModuleBean.getmErrorMessage() : "null") + ")"); } } catch (Exception e) { LogUtils.e("Ad_SDK", "loadIntelligentAdInfo--error, adPos:" + i, e); } finally { adIntellRequestListener.onFinish(baseIntellModuleBean); } } @Override public void onException(THttpRequest tHttpRequest, int i2) { if (LogUtils.isShowLog()) { LogUtils.w("Ad_SDK", "[adPos:" + i + "]loadIntelligentAdInfo(onException, reason:" + i2 + ")"); } adIntellRequestListener.onFinish(null); } @Override public void onException(THttpRequest tHttpRequest, HttpResponse httpResponse, int i2) { onException(tHttpRequest, i2); } }); } } public void loadSearchPresolveAdInfo(final Context context, final int i, final String str, final AdIntellRequestListener adIntellRequestListener) { if (adIntellRequestListener != null) { AdSdkRequestDataUtils.requestSearchPresolveAdInfo(context, i, str, new IConnectListener() { @Override public void onStart(THttpRequest tHttpRequest) { LogUtils.i("Ad_SDK", "[adPos:" + i + "]loadSearchPresolveAdInfo onStart key=" + str); } @Override public void onFinish(THttpRequest tHttpRequest, IResponse iResponse) { BaseIntellModuleBean baseIntellModuleBean = null; try { JSONObject jSONObject = new JSONObject(StringUtils.toString(iResponse.getResponse())); baseIntellModuleBean = BaseIntellModuleBean.parseJSONObject(context, i, jSONObject); if (LogUtils.isShowLog()) { LogUtils.i("Ad_SDK", "[adPos:" + i + "]loadSearchPresolveAdInfo(json:" + jSONObject + ")"); } if ((baseIntellModuleBean == null || baseIntellModuleBean.getmSuccess() != 1) && LogUtils.isShowLog()) { LogUtils.e("Ad_SDK", "[adPos:" + i + "]loadSearchPresolveAdInfo(serverError,message:" + (baseIntellModuleBean != null ? baseIntellModuleBean.getmErrorMessage() : "null") + ")"); } } catch (Exception e) { LogUtils.e("Ad_SDK", "loadSearchPresolveAdInfo--error, adPos:" + i, e); } finally { adIntellRequestListener.onFinish(baseIntellModuleBean); } } @Override public void onException(THttpRequest tHttpRequest, int i2) { if (LogUtils.isShowLog()) { LogUtils.w("Ad_SDK", "[adPos:" + i + "]loadSearchPresolveAdInfo(onException, reason:" + i2 + ")"); } adIntellRequestListener.onFinish(null); } @Override public void onException(THttpRequest tHttpRequest, HttpResponse httpResponse, int i2) { onException(tHttpRequest, i2); } }); } } private void statisticAdInfo(AdModuleInfoBean adModuleInfoBean) { } }