Cyber Surfer v5.2.5版本的 MD5 值为:db13c5fce988de393e52d2679f934b22
以下内容为反编译后的 e.java 源代码,内容仅作参考
package com.safedk.android.analytics.brandsafety.creatives.discoveries;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import com.safedk.android.SafeDK;
import com.safedk.android.analytics.brandsafety.BrandSafetyUtils;
import com.safedk.android.analytics.brandsafety.a;
import com.safedk.android.analytics.brandsafety.creatives.AdNetworkConfiguration;
import com.safedk.android.analytics.brandsafety.creatives.AdNetworkDiscovery;
import com.safedk.android.analytics.brandsafety.creatives.CreativeInfoManager;
import com.safedk.android.analytics.brandsafety.creatives.VastAdTagUri;
import com.safedk.android.analytics.brandsafety.creatives.discoveries.c;
import com.safedk.android.analytics.brandsafety.creatives.g;
import com.safedk.android.analytics.brandsafety.creatives.infos.CreativeInfo;
import com.safedk.android.analytics.brandsafety.creatives.infos.InMobiCreativeInfo;
import com.safedk.android.analytics.events.BrandSafetyEvent;
import com.safedk.android.utils.Logger;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class e extends d {
private static final String A = "landingUrl";
private static final String B = "landingPageUrl";
private static final String C = "markupType";
private static final String D = "inmobiJson";
private static final String E = "requestId";
private static final String F = ".w.inmobi.com/c.asm/";
private static final String G = "banner";
private static final String H = "mrec";
private static final String I = "com.applovin.mediation.adapters.InMobiMediationAdapter";
private static final String J = "ads.inmobi.com/sdk";
private static final String K = "client-request-id";
private static final String L = "mk-ad-slot";
private static final String M = "im-plid";
private static final String N = "adtype";
private static final String O = "creativeType";
private static final String P = "metaInfo";
private static final String Q = "omsdkInfo";
private static final String R = "macros";
private static final String S = "$PLACEMENT_DIMENSION";
private static final String T = "content";
private static final String U = "trackers";
private static final String V = "title";
private static final String W = "screenshots";
private static final String X = "url";
private static final String Y = "icon";
private static final String Z = "iconUrl";
private static final String aa = "description";
private static final String ab = "cta";
private static final String ac = "ctaText";
private static final String ad = "rating";
private static final String ae = "star";
private static final String af = "com.inmobi.ads.rendering.InMobiAdActivity.IN_APP_BROWSER_URL";
private static final String ag = "com.inmobi.ads.rendering.InMobiAdActivity.EXTRA_AD_CONTAINER_INDEX";
private static final float ah = 0.3f;
private static final Map<String, VastAdTagUri> ai = new HashMap();
private static final Map<String, CreativeInfo> aj = new ConcurrentHashMap();
private static final Map<String, CreativeInfo> ak = new ConcurrentHashMap();
private static final Map<String, CreativeInfo> al = new ConcurrentHashMap();
private static final Map<String, CreativeInfo> am = new ConcurrentHashMap();
private static final Map<String, String> an = new ConcurrentHashMap();
public static final String f9322b = "contextData";
public static final String c = "advertisedContent";
private static final String d = "InMobiDiscovery";
private static final String e = "rootContainer";
private static final String f = "assetValue";
private static final String g = "placementId";
private static final String h = "ads";
private static final String i = "adSets";
private static final String u = "creativeId";
private static final String v = "impressionId";
private static final String w = "bidBundle";
private static final String x = "pubContent";
private static final String y = "passThroughJson";
private static final String z = "adContent";
public e() {
super(com.safedk.android.utils.h.i, d, false);
this.m.b(AdNetworkConfiguration.SUPPORTS_PREFETCH_RECEIVING_BY_APPLOVIN, true);
this.m.b(AdNetworkConfiguration.SHOULD_UPDATE_CREATIVE_INFO_FROM_VAST, false);
this.m.b(AdNetworkConfiguration.SUPPORTS_GZIP_CONTENT, true);
this.m.b(AdNetworkConfiguration.SUPPORTS_JAVASCRIPT_BASED_VIDEO_STATE_DETECTION, true);
this.m.b(AdNetworkConfiguration.SUPPORTS_MREC_IMPRESSION_TRACKING, true);
this.m.b(AdNetworkConfiguration.SUPPORTS_MREC_IMPRESSION_EOV, true);
this.m.b(AdNetworkConfiguration.SUPPORTS_AUTO_REDIRECTS_IDENTIFICATION, true);
this.m.b(AdNetworkConfiguration.SUPPORTS_EXPANDED_ADS_IDENTIFICATION, true);
this.m.b(AdNetworkConfiguration.AD_NETWORK_SUPPORTS_PREFETCH_REUSE, true);
this.m.a(AdNetworkConfiguration.BITMAP_SCAN_BOTTOM_MARGIN_PERCENT, ah);
this.m.b(AdNetworkConfiguration.BITMAP_SCAN_SHOULD_CHECK_FOR_GREYSCALE, true);
this.m.b(AdNetworkConfiguration.ENFORCE_CLOSE_INPUT_STREAM_VAST_IN_VAST, true);
this.m.b(AdNetworkConfiguration.SUPPORTS_BANNER_IMPRESSION_TRACKING, true);
this.m.b(AdNetworkConfiguration.SUPPORTS_BIDDING_INTERSTITIAL_IMPRESSION_MATCHING_BY_MAX, true);
this.m.b(AdNetworkConfiguration.AVOID_CLEANING_PENDING_CI_LIST_ON_AD_END, true);
this.m.b(AdNetworkConfiguration.AD_NETWORK_INTERNAL_BROWSER_OPENS_IN_SAME_ACTIVITY, true);
this.m.b(AdNetworkConfiguration.DETECT_MULTIPLE_ADS_BY_WEB_VIEW_CHANGE, true);
this.m.b(AdNetworkConfiguration.SHOULD_USE_EARLY_VAST_AD_TAG_URI_PARSING, true);
this.m.b(AdNetworkConfiguration.SUPPORTS_NATIVE_BANNERS_USING_BANNER_KEY, true);
}
private static List<String> a(CreativeInfo creativeInfo, String str) {
Logger.d(d, "extracting urls");
new ArrayList();
ArrayList<String> f2 = com.safedk.android.utils.l.f(str);
Logger.d(d, "prefetch resources list: " + f2);
Logger.d(d, "prefetch resources list after impression beacons urls removal : " + f2);
creativeInfo.b(f2);
return f2;
}
private List<CreativeInfo> a(String str, String str2, InMobiCreativeInfo inMobiCreativeInfo, String str3) {
ArrayList<g.a> arrayList;
String o;
String n;
ArrayList<CreativeInfo> arrayList2 = new ArrayList();
if (str2 == null) {
arrayList2.add(inMobiCreativeInfo);
return arrayList2;
}
BrandSafetyUtils.AdType I2 = inMobiCreativeInfo.I();
String j = com.safedk.android.utils.l.j(str2);
if (g.a(j)) {
arrayList = g.b(j, true);
com.safedk.android.utils.l.b(d, "vast ad infos: " + (arrayList != null ? arrayList.toString() : "null"));
} else {
arrayList = null;
}
if (arrayList != null && arrayList.size() > 0 && !str3.startsWith("vast")) {
str3 = TextUtils.isEmpty(str3) ? "vast" : "vast/" + str3;
}
Logger.d(d, "is prefetch multi ad? " + (inMobiCreativeInfo.b() > 1 || t(j)));
if (arrayList == null || arrayList.size() == 0) {
Logger.d(d, "no vast info detected in prefetch");
if (TextUtils.isEmpty(str3)) {
str3 = "mraid";
if (inMobiCreativeInfo.b() > 1) {
str3 = "mraid" + CreativeInfo.aG + inMobiCreativeInfo.b();
}
}
if (inMobiCreativeInfo.K() == null && (n = n(j)) != null) {
inMobiCreativeInfo.s(n);
}
if (inMobiCreativeInfo.o() == null && (o = o(j)) != null) {
inMobiCreativeInfo.p(o);
}
arrayList2.add(inMobiCreativeInfo);
} else if (arrayList.size() == 1) {
Logger.d(d, "prefetch has vast info");
a(inMobiCreativeInfo, arrayList.get(0), str);
if (inMobiCreativeInfo.b() > 1) {
str3 = str3 + CreativeInfo.aG + inMobiCreativeInfo.b();
}
Logger.d(d, "downstream struct set to " + str3);
inMobiCreativeInfo.c(true);
arrayList2.add(inMobiCreativeInfo);
} else {
Logger.d(d, "prefetch has multiple vast infos");
str3 = str3 + CreativeInfo.aG + arrayList.size() + "/multiple_ads";
Iterator<g.a> it = arrayList.iterator();
while (it.hasNext()) {
InMobiCreativeInfo ah2 = inMobiCreativeInfo.ah();
ah2.ag();
a(ah2, it.next(), str);
inMobiCreativeInfo.c(true);
arrayList2.add(ah2);
}
}
if (str3.endsWith("/")) {
str3 = str3.substring(0, str3.length() - 1);
}
Logger.d(d, "downstream struct set to " + str3);
if (inMobiCreativeInfo.h() == null || str3.contains(inMobiCreativeInfo.h())) {
inMobiCreativeInfo.c(str3);
}
ArrayList<String> f2 = com.safedk.android.utils.l.f(j);
Logger.d(d, "prefetch resources list: " + f2);
for (CreativeInfo creativeInfo : arrayList2) {
creativeInfo.b(f2);
}
if (f2.size() > 0) {
for (String str4 : f2) {
if (str4.contains(F)) {
Logger.d(d, "adding " + I2.name().toLowerCase() + " ci with url as key (" + str4 + ")");
am.put(str4, inMobiCreativeInfo);
com.safedk.android.utils.l.b(d, "added " + I2.name().toLowerCase() + " CI. # of cis is " + am.size() + ", impressionId: " + inMobiCreativeInfo.J() + ", prefetchResource: " + str4 + ", ci = " + inMobiCreativeInfo);
}
}
}
return arrayList2;
}
private void a(InMobiCreativeInfo inMobiCreativeInfo, JSONObject jSONObject) {
if (!jSONObject.has(x)) {
Logger.d(d, "addDSPDomainURLs did not find pub_content");
return;
}
try {
JSONObject jSONObject2 = jSONObject.getJSONObject(x);
if (!jSONObject2.has(U)) {
Logger.d(d, "addDSPDomainURLs did not find trackers array");
return;
}
ArrayList arrayList = new ArrayList();
JSONArray jSONArray = jSONObject2.getJSONArray(U);
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
if (jSONArray.getJSONObject(i2).has("url")) {
arrayList.add(jSONArray.getJSONObject(i2).getString("url"));
}
}
inMobiCreativeInfo.b(arrayList);
} catch (JSONException e2) {
Logger.d(d, "addDSPDomainURLs not a native ad (" + e2.getMessage() + ")");
}
}
private boolean a(JSONObject jSONObject) {
try {
boolean z2 = jSONObject.has(C) && jSONObject.getString(C).equals(D);
boolean z3 = jSONObject.has(x) && com.safedk.android.utils.l.s(jSONObject.getString(x));
boolean z4 = jSONObject.getJSONObject(x).has(z) && jSONObject.getJSONObject(x).getJSONObject(z).length() > 0;
if (z2 && z3 && z4) {
Logger.d(d, "is native ad - adObj is indeed an inmobi native ad");
return true;
}
} catch (JSONException e2) {
Logger.d(d, "isNativeAd not a native ad (" + e2.getMessage() + ")");
}
return false;
}
private boolean a(JSONObject jSONObject, String str, CreativeInfo creativeInfo, String str2, boolean z2, boolean z3) {
try {
if (jSONObject.has(str2)) {
if (z3) {
creativeInfo.y(jSONObject.getString(str2));
} else {
creativeInfo.x(jSONObject.getString(str2));
}
return true;
}
} catch (JSONException e2) {
Logger.d(d, "findInJSONAndAddText - exception happened during trying to retrieve key " + str2 + " form json element " + str);
}
if (z2) {
Logger.d(d, "findInJSONAndAddText - did not find the key: " + str2 + " inside the json element: " + str);
}
return false;
}
private String b(InMobiCreativeInfo inMobiCreativeInfo, JSONObject jSONObject) {
JSONObject jSONObject2;
String str = CreativeInfo.aF;
try {
str = CreativeInfo.aF + "/" + jSONObject.getString(C);
if (jSONObject.has(P)) {
if (jSONObject.getJSONObject(P).has(O)) {
str = str + "/" + jSONObject2.getString(O);
inMobiCreativeInfo.c(str);
} else {
Logger.d(d, "set downstreamStruct failed because there is no creativeType in metaInfo");
}
} else {
Logger.d(d, "set downstreamStruct failed because there is no metaInfo in ad object");
}
} catch (JSONException e2) {
Logger.d(d, "set downstreamStruct - failed because of jsonException " + e2.getMessage());
}
return str;
}
private String b(JSONObject jSONObject) {
String str = null;
if (jSONObject.has(x)) {
try {
JSONObject jSONObject2 = jSONObject.getJSONObject(x);
if (jSONObject2.has(y)) {
JSONObject jSONObject3 = jSONObject2.getJSONObject(y);
if (jSONObject3.has(A)) {
String string = jSONObject3.getString(A);
Logger.d(d, "getNativeAdClickUrl returned " + string);
str = string;
}
}
String string2 = jSONObject2.getJSONObject(z).getString(B);
Logger.d(d, "getNativeAdClickUrl returned " + string2);
str = string2;
} catch (JSONException e2) {
Logger.d(d, "getNativeAdClickUrl not a native ad (" + e2.getMessage() + ")");
}
} else {
Logger.d(d, "getNativeAdClickUrl did not find pub_content");
}
return str;
}
public static void b(View view, String str) {
List<CreativeInfo> a2;
Logger.d(d, "redirect potential source: " + view);
a aVar = null;
if (com.safedk.android.utils.l.a(view.getWidth(), view.getHeight())) {
aVar = SafeDK.getInstance().a(BrandSafetyUtils.AdType.BANNER);
} else if (com.safedk.android.utils.l.b(view.getWidth(), view.getHeight())) {
aVar = SafeDK.getInstance().a(BrandSafetyUtils.AdType.MREC);
}
if (aVar == null || (a2 = aVar.a(com.safedk.android.utils.h.i, BrandSafetyUtils.a(view))) == null) {
return;
}
for (CreativeInfo creativeInfo : a2) {
creativeInfo.t("redirectPotentialSource=" + str + ",view=" + view);
}
}
private void b(CreativeInfo creativeInfo, String str) {
List<String> a2 = com.safedk.android.utils.l.a(com.safedk.android.utils.g.F(), str);
if (a2 == null || a2.size() <= 1) {
return;
}
for (String str2 : a2) {
Logger.d(d, "adding vast clause " + str2 + " to ci debug info");
creativeInfo.t(str2);
}
}
private BrandSafetyUtils.AdType c(JSONObject jSONObject) throws JSONException {
if (jSONObject.has(P) && jSONObject.getJSONObject(P).has(Q)) {
JSONObject jSONObject2 = jSONObject.getJSONObject(P).getJSONObject(Q);
if (jSONObject2.has(R)) {
JSONObject jSONObject3 = jSONObject2.getJSONObject(R);
if (jSONObject3.has(S)) {
String string = jSONObject3.getString(S);
Logger.d(d, "generate info - placementDimension = " + string);
if (string.contains("X")) {
String[] split = string.split("X");
int parseInt = Integer.parseInt(split[0]);
int parseInt2 = Integer.parseInt(split[1]);
if (parseInt != 0 && parseInt2 != 0 && com.safedk.android.utils.l.a(parseInt, parseInt2)) {
BrandSafetyUtils.AdType adType = BrandSafetyUtils.AdType.BANNER;
Logger.d(d, "generate info - adtype set to BANNER : placementDimension is " + string);
return adType;
} else if (parseInt == 0 || parseInt2 == 0 || !com.safedk.android.utils.l.b(parseInt, parseInt2)) {
return null;
} else {
BrandSafetyUtils.AdType adType2 = BrandSafetyUtils.AdType.MREC;
Logger.d(d, "generate info - adtype set to MREC : placementDimension is " + string);
return adType2;
}
}
return null;
}
return null;
}
return null;
}
return null;
}
private List<CreativeInfo> c(String str, String str2, Map<String, List<String>> map, c.a aVar) {
JSONObject jSONObject;
String str3;
JSONArray jSONArray;
BrandSafetyUtils.AdType c2;
BrandSafetyUtils.AdType adType;
ArrayList arrayList = new ArrayList();
try {
jSONObject = new JSONObject(str2);
} catch (Throwable th) {
Logger.e(d, "error: " + th.getMessage(), th);
}
if (!jSONObject.has("requestId") || (!jSONObject.has(i) && !jSONObject.has("ads"))) {
Logger.d(d, "generate info - not a JSON prefetch");
return arrayList;
} else if (jSONObject.getJSONArray(i).length() == 0) {
Logger.d(d, "generate info - ad sets array is empty, skipping");
return arrayList;
} else {
if (jSONObject.has("requestId")) {
String string = jSONObject.getString("requestId");
Logger.d(d, "generate info - request id: " + string);
str3 = string;
} else {
str3 = null;
}
String str4 = null;
if (jSONObject.has("placementId")) {
str4 = jSONObject.getString("placementId");
Logger.d(d, "generate info - placement id: " + str4);
}
com.safedk.android.utils.l.b(d, "generate info - url: " + str + " , Headers: " + (map != null ? map.toString() : "null") + ", buffer size: " + (str2 == null ? "0" : Integer.valueOf(str2.length())) + " , buffer: " + str2);
JSONObject jSONObject2 = null;
if (jSONObject.has(i)) {
JSONArray jSONArray2 = jSONObject.getJSONArray(i);
Logger.d(d, "generate info - ad sets : " + jSONArray2.length() + " items");
if (jSONArray2.length() <= 0) {
Logger.d(d, "generate info - ad sets element has no items");
return arrayList;
}
jSONObject2 = jSONArray2.getJSONObject(0);
}
if (jSONObject2 != null) {
jSONArray = jSONObject2.getJSONArray("ads");
} else if (!jSONObject.has("ads") || !(jSONObject.get("ads") instanceof JSONArray)) {
Logger.d(d, "generate info - ads element has no items or is not an array");
return arrayList;
} else {
jSONArray = jSONObject.getJSONArray("ads");
}
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
JSONObject jSONObject3 = jSONArray.getJSONObject(i2);
String string2 = jSONObject3.getString(u);
String string3 = jSONObject3.getString(v);
Logger.d(d, "generate info - impression id: " + string3 + ", creative id: " + string2);
JSONObject optJSONObject = jSONObject3.optJSONObject(f9322b);
String optString = optJSONObject != null ? optJSONObject.optString(c) : null;
if (str3 != null && an.containsKey(str4)) {
String str5 = an.get(str4);
Logger.d(d, "generate info - placement id to ad type list contains ad type " + str5 + " for placement id " + str4);
if (str5.equals("banner")) {
adType = c(jSONObject3);
if (adType == null) {
adType = BrandSafetyUtils.AdType.BANNER;
}
} else {
adType = str5.equals(H) ? BrandSafetyUtils.AdType.MREC : BrandSafetyUtils.AdType.INTERSTITIAL;
}
c2 = adType;
} else if (aVar != null && (aVar.f9318b == BrandSafetyEvent.AdFormatType.BANNER || aVar.f9318b == BrandSafetyEvent.AdFormatType.LEADER)) {
c2 = BrandSafetyUtils.AdType.BANNER;
} else if (aVar == null || aVar.f9318b != BrandSafetyEvent.AdFormatType.MREC) {
c2 = c(jSONObject3);
if (c2 == null) {
c2 = BrandSafetyUtils.AdType.INTERSTITIAL;
}
} else {
c2 = BrandSafetyUtils.AdType.MREC;
}
Logger.d(d, "generate info - ad type: " + (c2 != null ? c2.name() : "null"));
InMobiCreativeInfo inMobiCreativeInfo = new InMobiCreativeInfo(string3, string2, str4, this.q, c2, jSONArray.length(), aVar == null ? null : aVar.f9318b, aVar == null ? null : aVar.f9317a, optString);
boolean a2 = a(jSONObject3);
String string4 = jSONObject3.getString(x);
String l = l(string4);
List<CreativeInfo> arrayList2 = new ArrayList<>();
if (com.safedk.android.utils.l.a((Object) string4)) {
inMobiCreativeInfo.t("pubContentUrl=" + string4);
Logger.d(d, "generate info - adding pubContent URL to follow: " + string4);
aj.put(string4, inMobiCreativeInfo);
arrayList2.add(inMobiCreativeInfo);
} else if (a2 && l != null) {
com.safedk.android.utils.l.b(d, "generate info - found native vast inside pubContent");
arrayList2 = a(str, l, inMobiCreativeInfo, b(inMobiCreativeInfo, jSONObject3));
} else if (a2) {
arrayList2 = a(str, string4, inMobiCreativeInfo, b(inMobiCreativeInfo, jSONObject3));
inMobiCreativeInfo.s(b(jSONObject3));
a(inMobiCreativeInfo, jSONObject3);
c(inMobiCreativeInfo, jSONObject3);
} else {
arrayList2 = l != null ? a(str, l, inMobiCreativeInfo, "") : a(str, string4, inMobiCreativeInfo, "");
}
if (c2 == BrandSafetyUtils.AdType.INTERSTITIAL) {
if (aVar == null) {
Logger.d(d, "generate info - adding interstitial ci with creative id as key (" + string2 + ")");
ak.put(string2, inMobiCreativeInfo);
com.safedk.android.utils.l.b(d, "generate info - added interstitial CI. # of cis is " + ak.size() + ", impression id: " + string3 + ", creative id: " + string2 + ", CI: " + inMobiCreativeInfo.toString());
} else if (aVar.f9317a == null || str4 == null) {
Logger.d(d, "generate info - placementId and/or eventId are missing, cannot process ci");
} else {
String str6 = str4 + "_" + aVar.f9317a + "_" + com.safedk.android.utils.h.i;
Logger.d(d, "generate info - adding interstitial ci with complex key (" + str6 + ")");
ak.put(str6, inMobiCreativeInfo);
inMobiCreativeInfo.e(aVar.f9317a);
com.safedk.android.utils.l.b(d, "added interstitial CI. # of cis is " + ak.size() + ", impression id: " + string3 + ", complex key: " + str6 + ", CI: " + inMobiCreativeInfo.toString());
}
} else if ((c2 == BrandSafetyUtils.AdType.BANNER || c2 == BrandSafetyUtils.AdType.MREC) && str4 != null && aVar != null && aVar.f9317a != null && inMobiCreativeInfo.b() == 1) {
String str7 = str4 + "_" + aVar.f9317a + "_" + com.safedk.android.utils.h.i;
Logger.d(d, "adding banner ci with complex key (" + str7 + ")");
al.put(str7, inMobiCreativeInfo);
com.safedk.android.utils.l.b(d, "added banner CI. # of cis is " + al.size() + ", impression id: " + string3 + ", adType = " + c2 + ", complex key: " + str7 + ", CI: " + inMobiCreativeInfo.toString());
}
Logger.d(d, "recent creative IDs array item added. Key = " + string2);
if (arrayList2 != null && arrayList2.size() > 0) {
arrayList.addAll(arrayList2);
}
}
return arrayList;
}
}
private void c(InMobiCreativeInfo inMobiCreativeInfo, JSONObject jSONObject) {
boolean z2;
boolean z3;
boolean z4;
boolean z5 = false;
try {
JSONObject jSONObject2 = jSONObject.getJSONObject(x);
if (jSONObject2.has(y)) {
JSONObject jSONObject3 = jSONObject2.getJSONObject(y);
if (jSONObject3.has(W)) {
a(jSONObject3.getJSONObject(W), W, inMobiCreativeInfo, "url", true, false);
}
r10 = jSONObject3.has("icon") ? a(jSONObject3.getJSONObject("icon"), "icons", inMobiCreativeInfo, "url", false, false) : false;
boolean a2 = a(jSONObject3, y, inMobiCreativeInfo, "title", false, true);
z4 = a(jSONObject3, y, inMobiCreativeInfo, "description", false, true);
z3 = a(jSONObject3, y, inMobiCreativeInfo, "cta", false, true);
z2 = a(jSONObject3, y, inMobiCreativeInfo, "rating", false, true);
z5 = a2;
} else {
z2 = false;
z3 = false;
z4 = false;
}
if (jSONObject2.has(z)) {
JSONObject jSONObject4 = jSONObject2.getJSONObject(z);
a(jSONObject4, z, inMobiCreativeInfo, "title", !z5, true);
a(jSONObject4, z, inMobiCreativeInfo, Z, !r10, false);
a(jSONObject4, z, inMobiCreativeInfo, "description", !z4, true);
a(jSONObject4, z, inMobiCreativeInfo, ac, !z3, true);
a(jSONObject4, z, inMobiCreativeInfo, "rating", !z2, true);
}
} catch (JSONException e2) {
Logger.d(d, "extract native ad content - failed because of jsonException " + e2.getMessage());
}
}
private List<CreativeInfo> f(String str, String str2) {
ArrayList arrayList = new ArrayList();
try {
if (TextUtils.isEmpty(str2)) {
Logger.d(d, "generate info - buffer value cannot be empty, skipping.");
} else {
Logger.d(d, "generate info - InMobi vast proxy prefetch. vast ad tag proxy urls to follow: " + ai.toString());
CreativeInfo creativeInfo = null;
if (ai.containsKey(str)) {
Logger.d(d, "vasts proxy redirect url found: " + str);
creativeInfo = this.n.remove(ai.remove(str));
}
String q = q(str);
Logger.d(d, "decodedUrl : " + q);
if (creativeInfo == null && ai.containsKey(q)) {
Logger.d(d, "vasts proxy redirect url found: " + str);
creativeInfo = this.n.remove(ai.remove(q));
}
if (creativeInfo != null) {
com.safedk.android.utils.l.b(d, "found vast proxy url: " + str + ", ci: " + creativeInfo + ", content: " + str2);
a(creativeInfo, str, str2, true);
Logger.d(d, "vast processing was done in BaseDiscovery.");
arrayList.add(creativeInfo);
return arrayList;
}
}
} catch (Throwable th) {
Logger.e(d, "generate info exception: " + th.getMessage(), th);
}
return arrayList;
}
private String l(String str) {
String str2 = null;
try {
if (com.safedk.android.utils.l.s(str)) {
JSONObject jSONObject = new JSONObject(str);
if (jSONObject.has(e)) {
JSONObject jSONObject2 = jSONObject.getJSONObject(e);
if (jSONObject2.has(f)) {
JSONArray jSONArray = jSONObject2.getJSONArray(f);
loop0: for (int i2 = 0; i2 < jSONArray.length(); i2++) {
JSONObject jSONObject3 = jSONArray.getJSONObject(i2);
if (jSONObject3.has(f)) {
JSONArray jSONArray2 = jSONObject3.getJSONArray(f);
for (int i3 = 0; i3 < jSONArray2.length(); i3++) {
if ((jSONArray2.get(i3) instanceof String) && g.a(jSONArray2.getString(i3))) {
Logger.d(d, "check vast format prefetch - found vast value inside");
str2 = jSONArray2.getString(i3);
break loop0;
}
}
continue;
}
}
}
}
} else {
Logger.d(d, "check vast format prefetch - pubContent is not a JSON");
}
} catch (JSONException e2) {
Logger.d(d, "check vast format prefetch - exception occurred: " + e2.getMessage());
}
return str2;
}
private boolean r(String str) {
return str.contains("requestId") && str.contains("placementId") && str.contains(i) && str.contains(u);
}
private String s(String str) {
Map<String, String> b2;
String str2 = null;
if (str != null && (b2 = com.safedk.android.utils.l.b(str, false)) != null && b2.size() > 0) {
Iterator<String> it = b2.values().iterator();
while (it.hasNext()) {
str2 = it.next();
}
}
return str2;
}
private boolean t(String str) {
List<String> a2 = com.safedk.android.utils.l.a(com.safedk.android.utils.g.H(), str);
List<String> a3 = com.safedk.android.utils.l.a(com.safedk.android.utils.g.G(), str);
if (a2 == null || a2.size() <= 1) {
return a3 != null && a3.size() > 1;
}
return true;
}
@Override
public CreativeInfo a(Object obj) {
try {
Logger.d(d, "match info ad instance: " + obj);
} catch (Throwable th) {
Logger.d(d, "exception in match info ad instance", th);
}
if (obj == null) {
Logger.d(d, "match info ad instance is null");
return null;
}
if (obj instanceof String) {
String str = (String) obj;
com.safedk.android.utils.l.b(d, "match info ad instance " + obj + ", banner CI to ID map: " + al.keySet());
if (al.containsKey(str)) {
CreativeInfo creativeInfo = al.get(str);
Logger.d(d, "match info ad instance - CI MATCH FOUND! by key: " + str + ", CI: " + creativeInfo.toString());
return creativeInfo;
}
Logger.d(d, "match info ad instance - cannot find CI");
}
return null;
}
@Override
public String a(Bundle bundle) {
int i2;
if (bundle == null || (i2 = bundle.getInt(ag)) <= 0) {
return null;
}
String hexString = Integer.toHexString(i2);
Logger.d(d, "found expanded ad webview address in intent extra: " + hexString);
return hexString;
}
@Override
protected String a(String str, CreativeInfo creativeInfo) {
return null;
}
@Override
protected synchronized void a(VastAdTagUri vastAdTagUri) {
if (vastAdTagUri != null) {
Iterator<Map.Entry<String, VastAdTagUri>> it = ai.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, VastAdTagUri> next = it.next();
if (next.getValue().equals(vastAdTagUri)) {
Logger.d(d, "remove vast ad tag proxy uri from url to follow list: " + next.getValue());
it.remove();
}
}
}
}
@Override
public void a(FileInputStream fileInputStream, FileDescriptor fileDescriptor) {
}
@Override
public void a(FileInputStream fileInputStream, String str) {
}
@Override
public void a(Object obj, Object obj2) {
}
@Override
protected void a(String str, VastAdTagUri vastAdTagUri) {
if (str != null) {
String[] split = str.split("://");
if (split.length == 2) {
ai.put("http://vastproxy.brand.inmobi.com/g/" + split[1], vastAdTagUri);
}
}
}
@Override
public void a(String str, String str2, String str3, String str4) {
BrandSafetyEvent.AdFormatType adFormatType;
CreativeInfo creativeInfo;
Logger.d(d, "update CI details placementId=" + str + ", creativeId=" + str2 + ", eventId=" + str3 + ", adFormat=" + str4);
if (str4.equals(BrandSafetyEvent.AdFormatType.APPOPEN.name())) {
Logger.d(d, "ignoring creative info details from Max, adFormat = " + str4 + ", creativeId = " + str2 + ", placementId = " + str);
} else if (str2 == null || str3 == null) {
} else {
if (str4.equals(BrandSafetyUtils.k)) {
adFormatType = BrandSafetyEvent.AdFormatType.INTER;
creativeInfo = ak.get(str2);
} else if (str4.equals(BrandSafetyUtils.l)) {
adFormatType = BrandSafetyEvent.AdFormatType.REWARD;
creativeInfo = ak.get(str2);
} else if (str4.equals(BrandSafetyUtils.n) || str4.equals(BrandSafetyUtils.o)) {
adFormatType = BrandSafetyEvent.AdFormatType.BANNER;
creativeInfo = al.get(str + "_" + str3 + "_" + com.safedk.android.utils.h.i);
} else if (str4.equals(BrandSafetyUtils.p)) {
adFormatType = BrandSafetyEvent.AdFormatType.MREC;
creativeInfo = al.get(str + "_" + str3 + "_" + com.safedk.android.utils.h.i);
} else {
adFormatType = null;
creativeInfo = null;
}
if (adFormatType == null || creativeInfo == null) {
Logger.d(d, "failed to update CI details from Max, creative id: " + str2 + ", ad format: " + str4 + ", ad format type: " + adFormatType + ", CI: " + creativeInfo);
return;
}
creativeInfo.o(adFormatType.name());
Logger.d(d, "update CI details from Max, creative id: " + str2 + ", ID: " + creativeInfo.J() + ", placement id: " + creativeInfo.D() + ", ad format type: " + adFormatType);
}
}
@Override
public boolean a() {
return false;
}
@Override
public AdNetworkDiscovery.WebViewResourceMatchingMethod b() {
return AdNetworkDiscovery.WebViewResourceMatchingMethod.WEBVIEW_LOOKUP;
}
@Override
public String b(Object obj) {
return null;
}
@Override
public String b(String str, String str2) {
String n = com.safedk.android.utils.l.n(str2);
Logger.d(d, "get ad id from resource started, resource: " + str2 + ", resource key: " + n);
if (am.containsKey(n)) {
CreativeInfo creativeInfo = am.get(n);
com.safedk.android.utils.l.b(d, "get ad id from resource - CI identified, # of CIs: " + am.size() + ", CI: " + creativeInfo.toString());
return creativeInfo.J();
}
return null;
}
@Override
protected List<CreativeInfo> b(String str, String str2, Map<String, List<String>> map, c.a aVar) {
com.safedk.android.utils.l.b(d, "generate info started, url: " + str + ", event id: " + (aVar == null ? "" : aVar.f9317a) + ", buffer: " + str2);
if (com.safedk.android.utils.l.s(str2)) {
if (r(str2)) {
Logger.d(d, "generate info - InMobi prefetch");
return c(str, str2, map, aVar);
}
return f(str, str2);
}
Logger.d(d, "generate info - InMobi pubContent, url: " + str);
InMobiCreativeInfo inMobiCreativeInfo = (InMobiCreativeInfo) aj.remove(str);
if (inMobiCreativeInfo != null) {
return a(str, str2, inMobiCreativeInfo, "");
}
Logger.d(d, "generate info - not a valid JSON string");
return new ArrayList();
}
@Override
public boolean b(String str) {
if (str.contains(J)) {
Logger.d(d, "should follow output stream returned true for url " + str);
return true;
}
return false;
}
@Override
public boolean b(String str, Bundle bundle) {
String B2 = com.safedk.android.utils.l.B(str);
boolean containsKey = aj.containsKey(B2);
if (containsKey && bundle != null) {
bundle.putString(CreativeInfoManager.f9261a, "text/html");
bundle.putString(CreativeInfoManager.f9262b, "UTF-8");
}
VastAdTagUri vastAdTagUri = new VastAdTagUri(B2);
boolean z2 = this.n.containsKey(vastAdTagUri) || g.c.contains(vastAdTagUri) || ai.containsKey(B2);
if (B2.contains("action=skip-btn-clicked")) {
Logger.d(d, "video skipped event identified: " + B2);
CreativeInfoManager.onVideoCompleted(com.safedk.android.utils.h.i, null);
}
if (B2.contains(J) || containsKey || z2) {
Logger.d(d, "should follow input stream returned true for: " + B2);
return true;
}
return false;
}
@Override
public int c(String str) {
return 0;
}
@Override
public Set<String> c() {
Set<String> c2 = super.c();
c2.add("$TS");
return c2;
}
@Override
public void c(View view) {
b(view, "onClick");
}
@Override
public void c(String str, String str2) {
}
@Override
public String d(String str, String str2) {
String c2;
String c3;
Logger.d(d, "handle on request sent url: " + str + ", content: " + str2);
String c4 = com.safedk.android.utils.l.c(str + "?" + str2, M);
if (c4 == null || (c2 = com.safedk.android.utils.l.c(str + "?" + str2, N)) == null) {
return null;
}
if (c2.equals("banner") && (c3 = com.safedk.android.utils.l.c(str + "?" + str2, L)) != null && c3.contains("x")) {
String[] split = c3.split("x");
int parseInt = Integer.parseInt(split[0]);
int parseInt2 = Integer.parseInt(split[1]);
if (parseInt != 0 && parseInt2 != 0 && com.safedk.android.utils.l.b(parseInt, parseInt2)) {
c2 = H;
Logger.d(d, "handle on request sent - adtype is MREC : mkAdSlot is " + c3);
}
}
Logger.d(d, "adding to placement id to ad type list - size: " + an.size() + ", placement id: " + c4 + ", ad type: " + c2);
an.put(c4, c2);
return null;
}
@Override
public void d(View view) {
b(view, "onSource");
}
@Override
public String f() {
return I;
}
@Override
public boolean f(String str) {
Logger.d(d, "should ignore redirect url started. url: " + str);
if (str.contains(F)) {
Logger.d(d, "should ignore redirect url - tracking url detected");
return true;
}
return false;
}
@Override
public List<String> g() {
List<String> g2 = super.g();
g2.add(af);
return g2;
}
@Override
public void i() {
Logger.d(d, "clear old CIs started");
super.i();
com.safedk.android.utils.f.a(ak, "InMobiDiscovery:creativeToIdMap", false, k());
com.safedk.android.utils.f.a(al, "InMobiDiscovery:bannerCreativeToIdMap", false, k());
com.safedk.android.utils.f.a(am, "InMobiDiscovery:creativeToUrlMap", false, k());
com.safedk.android.utils.f.a(aj, "InMobiDiscovery:pubContentUrlsToFollow", false, k());
}
@Override
protected boolean k(String str) {
String n = com.safedk.android.utils.l.n(str);
Logger.d(d, "should follow get url key: " + n);
return str.contains(J) || am.containsKey(n);
}
}