atsameip v0.1版本的 MD5 值为:28547cf98b0a2d02acb37969dcfb83e9
以下内容为反编译后的 f.java 源代码,内容仅作参考
package com.appnext.banners;
import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.ConsoleMessage;
import android.webkit.JavascriptInterface;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.appnext.core.AppnextAd;
import com.appnext.core.i;
import com.appnext.core.n;
import com.appnext.core.webview.AppnextWebView;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import java.net.URL;
import java.util.ArrayList;
import java.util.Locale;
import org.json.JSONException;
import org.json.JSONObject;
public class f extends com.appnext.banners.a {
protected WebView webView;
private String adsid = "";
private boolean clicked = false;
private BannerAdData selectedAd = null;
private ArrayList<String> shown = new ArrayList<>();
private Handler handler = new Handler(Looper.getMainLooper());
private Handler refreshHandler = new Handler(Looper.getMainLooper());
protected String getJSurl() {
return "https://cdn.appnext.com/tools/sdk/banner/2.4.3/banner.min.js";
}
protected String getTargetJSurl() {
return "https://cdn.appnext.com/tools/sdk/banner/2.4.3/result.min.js";
}
@Override
public void inflateView(int i, AppnextAd appnextAd) {
try {
if (this.webView != null) {
this.rootView.removeAllViews();
this.webView.destroyDrawingCache();
this.webView.destroy();
}
View inflate = ((LayoutInflater) this.context.getSystemService("layout_inflater")).inflate(getLayout(), this.rootView, false);
WebView webView = new WebView(this.context.getApplicationContext());
this.webView = webView;
((ViewGroup) inflate).addView(webView);
this.webView.getLayoutParams().height = -1;
this.webView.getLayoutParams().width = -1;
this.webView.getSettings().setJavaScriptEnabled(true);
this.webView.getSettings().setAppCacheEnabled(true);
if (Build.VERSION.SDK_INT >= 21) {
this.webView.getSettings().setMixedContentMode(0);
}
if (Build.VERSION.SDK_INT >= 17) {
this.webView.getSettings().setMediaPlaybackRequiresUserGesture(false);
}
this.webView.setWebChromeClient(new WebChromeClient() {
@Override
public final boolean onConsoleMessage(ConsoleMessage consoleMessage) {
StringBuilder sb = new StringBuilder("[");
sb.append(consoleMessage.messageLevel().name());
sb.append(":CONSOLE(");
sb.append(consoleMessage.lineNumber());
sb.append(")] \"");
sb.append(consoleMessage.message());
sb.append("\", source: ");
sb.append(consoleMessage.sourceId());
sb.append(" (");
sb.append(consoleMessage.lineNumber());
sb.append(")");
return true;
}
});
this.webView.setWebViewClient(getWebViewClient());
loadWebview(getJSurl());
AppnextWebView.q(this.context).a(getTargetJSurl(), (AppnextWebView.c) null);
this.webView.addJavascriptInterface(getWebInterface(), "Appnext");
this.rootView.addView(inflate);
} catch (Throwable th) {
com.appnext.base.a.a("JSBannerAdapter$inflateView", th);
}
}
protected int getLayout() {
try {
} catch (Throwable th) {
com.appnext.base.a.a("JSBannerAdapter$getLayout", th);
}
if (getBannerSize().toString().equals(BannerSize.BANNER.toString())) {
return R.layout.apnxt_banner;
}
if (getBannerSize().toString().equals(BannerSize.LARGE_BANNER.toString())) {
return R.layout.apnxt_large_banner;
}
if (getBannerSize().toString().equals(BannerSize.MEDIUM_RECTANGLE.toString())) {
return R.layout.apnxt_medium_rectangle;
}
return R.layout.apnxt_banner;
}
public void loadJS(String str) {
try {
new StringBuilder("loading js ").append(str);
if (this.webView != null) {
this.webView.loadUrl(str);
}
} catch (Throwable th) {
com.appnext.base.a.a("JSBannerAdapter$loadJS", th);
}
}
protected void loadWebview(String str) {
try {
URL url = new URL(str);
this.webView.setBackgroundColor(0);
this.webView.loadDataWithBaseURL(url.getProtocol() + "://" + url.getHost(), "<html ValidateRequest=\"false\" ><body><script src='https://cdn.appnext.com/tools/sdk/banner/2.4.0/banner.min.js'></script></body></html>", null, "UTF-8", null);
} catch (Throwable th) {
com.appnext.base.a.a("JSBannerAdapter$loadWebview", th);
}
}
@Override
public void destroy() {
super.destroy();
try {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
try {
if (f.this.webView != null) {
ViewGroup viewGroup = (ViewGroup) f.this.webView.getParent();
if (viewGroup != null) {
viewGroup.removeView(f.this.webView);
}
f.this.webView.destroyDrawingCache();
f.this.webView.destroy();
}
} catch (Throwable th) {
com.appnext.base.a.a("JSBannerAdapter$destroy", th);
}
}
});
if (this.handler != null) {
this.handler.removeCallbacksAndMessages(null);
}
if (this.refreshHandler != null) {
this.refreshHandler.removeCallbacksAndMessages(null);
}
} catch (Throwable th) {
com.appnext.base.a.a("JSBannerAdapter$destroy", th);
}
}
public boolean isDestroyed() {
return getBannerAd() == null;
}
public JSONObject getConfigParams() throws JSONException {
JSONObject jSONObject = new JSONObject();
jSONObject.put("vid", "2.6.6.473");
jSONObject.put("tid", getBannerAd() == null ? "" : getBannerAd().getTID());
jSONObject.put("auid", getBannerAd() == null ? "" : getBannerAd().getAUID());
jSONObject.put("osid", "100");
jSONObject.put("tem_id", getBannerAd().getTemId(getSelectedAd()));
jSONObject.put("id", getPlacementId());
jSONObject.put("b_title", getButtonText(getSelectedAd()));
jSONObject.put("creative", getCreativeType(getSelectedAd()) == 0 ? "video" : "static");
jSONObject.put("cat", getSelectedAd().getCategories());
jSONObject.put("lockcat", getSelectedAd().getSpecificCategories());
jSONObject.put("pview", d.K().t("pview"));
jSONObject.put("video_length", getAdRequest().getVideoLength());
StringBuilder sb = new StringBuilder();
sb.append(getAdRequest().isMute());
jSONObject.put("mute", sb.toString());
StringBuilder sb2 = new StringBuilder();
sb2.append(getAdRequest().isAutoPlay());
jSONObject.put("auto_play", sb2.toString());
jSONObject.put("remove_poster_on_auto_play", d.K().t("remove_poster_on_auto_play"));
jSONObject.put("remote_auto_play", true);
jSONObject.put("did", this.adsid);
jSONObject.put("devn", com.appnext.core.g.V());
jSONObject.put("dosv", Build.VERSION.SDK_INT);
jSONObject.put("dds", "0");
jSONObject.put("ads_type", "banner");
jSONObject.put("country", getSelectedAd().getCountry());
jSONObject.put("gdpr", i.a(getSelectedAd(), d.K()));
jSONObject.put("lang_settings", new JSONObject(com.appnext.core.a.a.n(this.context).ag()).toString());
String language = getLanguage();
if (language == null || language.equals("")) {
language = Locale.getDefault().getLanguage().toUpperCase();
}
jSONObject.put("lang", language);
return jSONObject;
}
protected String getFallbackScript() {
return new c().D();
}
@Override
protected BannerAdData getSelectedAd() {
try {
if (this.selectedAd == null || (super.getSelectedAd() != null && !super.getSelectedAd().getBannerID().equals(this.selectedAd.getBannerID()))) {
BannerAdData bannerAdData = new BannerAdData(super.getSelectedAd());
this.selectedAd = bannerAdData;
bannerAdData.setImpressionURL(this.selectedAd.getImpressionURL() + "&tem_id=" + getBannerAd().getTemId(this.selectedAd));
BannerAdData bannerAdData2 = this.selectedAd;
bannerAdData2.setAppURL(this.selectedAd.getAppURL() + "&tem_id=" + getBannerAd().getTemId(this.selectedAd));
}
} catch (Throwable th) {
com.appnext.base.a.a("JSBannerAdapter$getSelectedAd", th);
}
return this.selectedAd;
}
@Override
public void onWindowVisibilityChanged(int i) {
if (i == 0) {
try {
if (this.clicked) {
this.clicked = false;
openResultPage(false);
}
} catch (Throwable th) {
com.appnext.base.a.a("JSBannerAdapter$onWindowVisibilityChanged", th);
}
}
}
protected WebViewClient getWebViewClient() {
return new b();
}
protected a getWebInterface() {
return new a();
}
public class a {
@JavascriptInterface
public void destroy(String str) {
}
@JavascriptInterface
public void jsError(String str) {
}
public a() {
}
@JavascriptInterface
public void openStore(String str) {
if (f.this.handler != null) {
f.this.handler.removeCallbacksAndMessages(null);
if (f.this.isDestroyed()) {
return;
}
f.this.handler.post(new Runnable() {
@Override
public final void run() {
try {
if (!f.this.getSelectedAd().getWebview().equals("0")) {
f.this.click();
return;
}
char c = 65535;
if (f.this.getSelectedAd().getRevenueType().equals("cpi")) {
d K = d.K();
String lowerCase = K.t(f.this.getBannerSize().toString() + "_cpiActiveFlow").toLowerCase();
StringBuilder sb = new StringBuilder();
sb.append(f.this.getBannerSize().toString());
sb.append("_cpiActiveFlow ");
sb.append(lowerCase);
switch (lowerCase.hashCode()) {
case 97:
if (lowerCase.equals("a")) {
c = 0;
break;
}
break;
case 98:
if (lowerCase.equals("b")) {
c = 1;
break;
}
break;
case 99:
if (lowerCase.equals("c")) {
c = 2;
break;
}
break;
case 100:
if (lowerCase.equals("d")) {
c = 3;
break;
}
break;
}
if (c == 0) {
f.this.openResultPage(true);
return;
}
if (c == 1) {
f.this.clicked = true;
} else if (c == 2) {
f.this.openResultPage(false);
return;
}
f.this.click();
return;
}
d K2 = d.K();
String lowerCase2 = K2.t(f.this.getBannerSize().toString() + "_cpcActiveFlow").toLowerCase();
StringBuilder sb2 = new StringBuilder();
sb2.append(f.this.getBannerSize().toString());
sb2.append("_cpcActiveFlow ");
sb2.append(lowerCase2);
int hashCode = lowerCase2.hashCode();
if (hashCode != 97) {
if (hashCode == 98 && lowerCase2.equals("b")) {
c = 1;
}
} else if (lowerCase2.equals("a")) {
c = 0;
}
f.this.clicked = true;
f.this.click();
} catch (Throwable unused) {
}
}
});
}
}
@JavascriptInterface
public void openLink(String str) {
if (f.this.isDestroyed()) {
return;
}
f.this.openLink(str);
}
@JavascriptInterface
public void logSTP(String str, String str2) {
com.appnext.core.g.a(f.this.getBannerAd(), f.this.getSelectedAd(), str, str2, d.K());
}
}
public void openResultPage(boolean z) {
Intent intent = new Intent(this.context, BannerActivity.class);
intent.putExtra(IronSourceConstants.EVENTS_PLACEMENT_NAME, getBannerAd().getPlacementID());
intent.putExtra("postback", getBannerAd().getPostback());
intent.putExtra("category", getBannerAd().getCategories());
intent.putExtra("clicked", getSelectedAd().getBannerID());
intent.putExtra("selected", getSelectedAd());
intent.putExtra("size", getBannerSize().toString());
intent.putExtra("shouldClose", z);
intent.setFlags(65536);
this.context.startActivity(intent);
}
public class b extends WebViewClient {
public b() {
}
@Override
public final boolean shouldOverrideUrlLoading(WebView webView, String str) {
if (str == null) {
return false;
}
try {
if (str.startsWith("http")) {
webView.loadUrl(str);
return true;
}
} catch (Throwable th) {
com.appnext.base.a.a("JSBannerAdapter$JSWebViewClient", th);
}
return super.shouldOverrideUrlLoading(webView, str);
}
@Override
public final boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
if (Build.VERSION.SDK_INT < 26 || renderProcessGoneDetail.didCrash()) {
return false;
}
if (webView != null) {
webView.destroy();
return true;
}
return true;
}
@Override
public final void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
try {
f.this.pageFinished();
} catch (Throwable th) {
com.appnext.base.a.a("JSBannerAdapter$JSWebViewClient", th);
}
}
}
public void pageFinished() {
if (isDestroyed()) {
return;
}
n.aa().a(new Runnable() {
@Override
public final void run() {
try {
f.this.adsid = com.appnext.core.g.b(f.this.context, false);
f.this.handler.removeCallbacksAndMessages(null);
f.this.handler.post(new Runnable() {
@Override
public final void run() {
try {
f.this.loadJS("javascript:(function() { try { Appnext.Layout.destroy('internal'); } catch(err){ Appnext.jsError(err.message); }})()");
f fVar = f.this;
fVar.loadJS("javascript:(function() { try { Appnext.setParams(" + f.this.getConfigParams().toString() + "); } catch(err){ Appnext.jsError(err.message); }})()");
f fVar2 = f.this;
fVar2.loadJS("javascript:(function() { try { Appnext.loadBanner(" + new JSONObject(f.this.getSelectedAd().getAdJSON()).toString() + ",'" + f.this.getBannerSize().toString() + "'); } catch(err){ Appnext.jsError(err.message); }})()");
f.this.shown.add(f.this.getSelectedAd().getBannerID());
} catch (Throwable unused) {
}
}
});
} catch (Throwable th) {
com.appnext.base.a.a("JSBannerAdapter$pageFinished", th);
}
}
});
}
private void activateAutoRefresh() {
int i;
d K = d.K();
try {
i = Integer.parseInt(K.t(getBannerSize().toString().toLowerCase() + "_ar"));
} catch (Throwable unused) {
i = 10;
}
if (!Boolean.parseBoolean(K.t("_arFlag")) || i <= 0) {
return;
}
this.refreshHandler.postDelayed(new Runnable() {
@Override
public final void run() {
try {
AppnextAd a2 = com.appnext.banners.b.J().a(f.this.context, f.this.getBannerAd(), f.this.getAds(), f.this.getAdRequest().getCreativeType(), f.this.shown);
if (a2 != null) {
f.this.setSelectedAd(new BannerAdData(a2));
if (Boolean.parseBoolean(d.K().t("impOne"))) {
f.this.setReportedImpression(false);
f.this.impression();
} else if (Boolean.parseBoolean(d.K().t("pview"))) {
f.this.refreshHandler.postDelayed(new Runnable() {
@Override
public final void run() {
f.this.getUserAction().a(f.this.getSelectedAd(), f.this.getSelectedAd().getImpressionURL(), null);
}
}, Integer.parseInt(d.K().t("postpone_vta_sec")) * 1000);
}
f.this.pageFinished();
}
} catch (Throwable th) {
com.appnext.base.a.a("JSBannerAdapter$activateAutoRefresh", th);
}
}
}, i * 1000);
}
@Override
public void impression() {
try {
boolean isReportedImpression = isReportedImpression();
super.impression();
if (isReportedImpression != isReportedImpression()) {
activateAutoRefresh();
}
} catch (Throwable th) {
com.appnext.base.a.a("JSBannerAdapter$impression", th);
}
}
}