Cyber Surfer v5.2.5版本的 MD5 值为:db13c5fce988de393e52d2679f934b22
以下内容为反编译后的 DTBAdInterstitial.java 源代码,内容仅作参考
package com.amazon.device.ads;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.WindowManager;
import com.amazon.aps.shared.APSAnalytics;
import com.amazon.aps.shared.analytics.APSEventSeverity;
import com.amazon.aps.shared.analytics.APSEventType;
import com.safedk.android.analytics.brandsafety.BrandSafetyUtils;
import com.safedk.android.utils.Logger;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class DTBAdInterstitial {
protected static final String INTERSTITIAL_CACHE_KEY = "INTERSTITIAL_CACHE_KEY";
private static final String LOG_TAG = "DTBAdInterstitial";
private static Map<Integer, DTBAdInterstitial> dtbAdInterstitialCache = Collections.synchronizedMap(new HashMap());
DTBAdView adView;
private Context context;
public DTBAdInterstitial(Context context, DTBAdInterstitialListener dTBAdInterstitialListener) {
try {
this.context = context;
this.adView = new DTBAdView(context, dTBAdInterstitialListener);
} catch (RuntimeException e) {
DtbLog.error(LOG_TAG, "Fail to initialize DTBAdInterstitial class");
APSAnalytics.logEvent(APSEventSeverity.FATAL, APSEventType.EXCEPTION, "Fail to initialize DTBAdInterstitial class", e);
}
}
public static DTBAdInterstitial getFromCache(int i) {
if (dtbAdInterstitialCache.containsKey(Integer.valueOf(i))) {
return dtbAdInterstitialCache.get(Integer.valueOf(i));
}
return null;
}
private DTBAdMRAIDInterstitialController getInterstitialController() {
return (DTBAdMRAIDInterstitialController) this.adView.getController();
}
private DTBAdInterstitialListener getInterstitialListener() {
return getInterstitialController().getInterstitialListener();
}
public static int getWidth(Context context) {
try {
DisplayMetrics displayMetrics = new DisplayMetrics();
((WindowManager) context.getSystemService("window")).getDefaultDisplay().getMetrics(displayMetrics);
return displayMetrics.widthPixels;
} catch (RuntimeException e) {
DtbLog.error(LOG_TAG, "Fail to execute getWidth method");
APSAnalytics.logEvent(APSEventSeverity.ERROR, APSEventType.EXCEPTION, "Fail to execute getWidth method", e);
return 0;
}
}
private static int putInCache(DTBAdInterstitial dTBAdInterstitial) {
dtbAdInterstitialCache.put(Integer.valueOf(dTBAdInterstitial.hashCode()), dTBAdInterstitial);
return dTBAdInterstitial.hashCode();
}
public static void removeFromCache(int i) {
dtbAdInterstitialCache.remove(Integer.valueOf(i));
}
public static void safedk_Context_startActivity_97cb3195734cf5c9cc3418feeafa6dd6(Context context, Intent intent) {
Logger.d("SafeDK-Special|SafeDK: Call> Landroid/content/Context;->startActivity(Landroid/content/Intent;)V");
if (intent == null) {
return;
}
BrandSafetyUtils.detectAdClick(intent, "com.amazon.device.ads");
context.startActivity(intent);
}
private void startOMSDKSession() {
try {
DtbOmSdkSessionManager dtbOmSdkSessionManager = getInterstitialController().getDtbOmSdkSessionManager();
if (getAdView().isVideo()) {
dtbOmSdkSessionManager.initJavaScriptOmAdSession(getAdView(), "https://c.amazon-adsystem.com/");
} else {
dtbOmSdkSessionManager.initHtmlDisplayOmAdSession(getAdView(), "https://c.amazon-adsystem.com/");
}
dtbOmSdkSessionManager.registerAdView(getAdView());
dtbOmSdkSessionManager.startAdSession();
dtbOmSdkSessionManager.displayAdEventLoaded();
} catch (RuntimeException e) {
DtbLog.error(LOG_TAG, "Unable to start OM SDK session for Interstitial ad");
APSAnalytics.logEvent(APSEventSeverity.FATAL, APSEventType.EXCEPTION, "Unable to start OM SDK session for Interstitial ad", e);
}
}
public void fetchAd(Bundle bundle) {
try {
this.adView.fetchAd(bundle.getString(DTBAdView.BID_HTML, ""), bundle);
} catch (RuntimeException e) {
DtbLog.error(LOG_TAG, "Fail to execute fetchAd method with bundle argument");
APSAnalytics.logEvent(APSEventSeverity.FATAL, APSEventType.EXCEPTION, "Fail to execute fetchAd method with extraData argument", e);
}
}
public void fetchAd(String str) {
try {
this.adView.fetchAd(str);
} catch (RuntimeException e) {
DtbLog.error(LOG_TAG, "Fail to execute fetchAd method with bundle argument");
APSAnalytics.logEvent(APSEventSeverity.FATAL, APSEventType.EXCEPTION, "Fail to execute fetchAd method with adHtml argument", e);
}
}
public void fetchAd(String str, Bundle bundle) {
try {
this.adView.fetchAd(str, bundle);
} catch (RuntimeException e) {
DtbLog.error(LOG_TAG, "Fail to execute fetchAd method with adHtml and bundle argument");
APSAnalytics.logEvent(APSEventSeverity.FATAL, APSEventType.EXCEPTION, "Fail to execute fetchAd method with adHtml and bundle argument", e);
}
}
public void fetchAd(Map<String, Object> map) {
this.adView.fetchAd(map);
}
public DTBAdView getAdView() {
return this.adView;
}
void onAdClosed() {
DTBAdInterstitialListener interstitialListener = getInterstitialListener();
if (interstitialListener != null) {
interstitialListener.onAdClosed(this.adView);
}
}
void setListener(DTBAdInterstitialListener dTBAdInterstitialListener) {
getInterstitialController().setInterstitialListener(dTBAdInterstitialListener);
}
public void show() {
try {
if (getInterstitialController() == null) {
DtbLog.error(LOG_TAG, "Fail to show the interstitial ad");
APSAnalytics.logEvent(APSEventSeverity.FATAL, APSEventType.EXCEPTION, "There is no controller before showing the interstitial ad");
return;
}
Intent intent = new Intent(this.context, DTBInterstitialActivity.class);
intent.putExtra(INTERSTITIAL_CACHE_KEY, putInCache(this));
startOMSDKSession();
safedk_Context_startActivity_97cb3195734cf5c9cc3418feeafa6dd6(this.context, intent);
} catch (RuntimeException e) {
DtbLog.error(LOG_TAG, "Fail to execute show method");
APSAnalytics.logEvent(APSEventSeverity.FATAL, APSEventType.EXCEPTION, "Fail to execute show method", e);
}
}
}