MD5 校验值:63e534d8efee12c91b8e626b68b614ab
p1.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.adivery.sdk; import android.content.Context; import android.graphics.Bitmap; import android.net.Uri; import android.os.Build; import android.view.ViewGroup; import android.view.ViewParent; import android.webkit.ConsoleMessage; import android.webkit.JavascriptInterface; import android.webkit.RenderProcessGoneDetail; import android.webkit.WebChromeClient; import android.webkit.WebResourceError; import android.webkit.WebResourceRequest; import android.webkit.WebResourceResponse; import android.webkit.WebView; import android.webkit.WebViewClient; import androidx.constraintlayout.widget.ConstraintLayout; import com.adivery.sdk.a2; import com.google.android.gms.common.internal.ImagesContract; import com.google.firebase.messaging.Constants; import java.io.File; import java.io.InputStream; import kotlin.Deprecated; import kotlin.Metadata; import kotlin.jvm.internal.Intrinsics; import org.json.JSONException; @Metadata(d1 = {"\u0000^\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\r\b\u0007\u0018\u00002\u00020\u00012\u00020\u0002:\u0003,-.B\u001b\b\u0016\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\n\u0010\u0005\u001a\u0006\u0012\u0002\b\u00030\u0006¢\u0006\u0002\u0010\u0007B9\b\u0001\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\n\u0010\u0005\u001a\u0006\u0012\u0002\b\u00030\u0006\u0012\b\u0010\b\u001a\u0004\u0018\u00010\t\u0012\b\u0010\n\u001a\u0004\u0018\u00010\u000b\u0012\b\u0010\f\u001a\u0004\u0018\u00010\r¢\u0006\u0002\u0010\u000eJ\u0016\u0010!\u001a\u00020\"2\u0006\u0010#\u001a\u00020\u000b2\u0006\u0010$\u001a\u00020\u000bJ\b\u0010%\u001a\u00020\"H\u0014J\u0006\u0010&\u001a\u00020\"J\b\u0010'\u001a\u00020\"H\u0014J\b\u0010(\u001a\u00020\"H\u0016J\b\u0010)\u001a\u00020\"H\u0016J\u000e\u0010*\u001a\u00020\"2\u0006\u0010+\u001a\u00020\rR\u0010\u0010\b\u001a\u0004\u0018\u00010\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0010X\u0082\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\u0005\u001a\u0006\u0012\u0002\b\u00030\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0010X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0012\u001a\u00020\u000bX\u0082D¢\u0006\u0002\n\u0000R\u001a\u0010\u0013\u001a\u00020\u0014X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0015\u0010\u0016\"\u0004\b\u0017\u0010\u0018R\u0010\u0010\u0019\u001a\u0004\u0018\u00010\u001aX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u001b\u001a\u00020\u001cX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u001d\u001a\u00020\u0010X\u0082\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\u001e\u001a\u00060\u001fR\u00020\u0000X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010 \u001a\u00020\u0010X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006/"}, d2 = {"Lcom/adivery/sdk/networks/adivery/AdSandbox;", "Lcom/adivery/sdk/networks/adivery/WebView;", "Lcom/adivery/sdk/networks/adivery/VisibilityTracker$VisibilityChangeCallback;", "context", "Landroid/content/Context;", "adObject", "Lcom/adivery/sdk/networks/adivery/AdObject;", "(Landroid/content/Context;Lcom/adivery/sdk/networks/adivery/AdObject;)V", "activityCallbacks", "Lcom/adivery/sdk/networks/adivery/AdSandbox$AdSandboxActivityCallbacks;", "appName", "", "iconStream", "Ljava/io/InputStream;", "(Landroid/content/Context;Lcom/adivery/sdk/networks/adivery/AdObject;Lcom/adivery/sdk/networks/adivery/AdSandbox$AdSandboxActivityCallbacks;Ljava/lang/String;Ljava/io/InputStream;)V", "adInitialized", "", "adRewarded", "appIconUrl", "assetLoader", "Lcom/adivery/sdk/networks/adivery/cache/WebViewAssetLoader;", "getAssetLoader", "()Lcom/adivery/sdk/networks/adivery/cache/WebViewAssetLoader;", "setAssetLoader", "(Lcom/adivery/sdk/networks/adivery/cache/WebViewAssetLoader;)V", "callback", "Lcom/adivery/sdk/AdiveryCallback;", "eventManager", "Lcom/adivery/sdk/EventManager;", "isCloseCalled", "sandboxInterface", "Lcom/adivery/sdk/networks/adivery/AdSandbox$AdSandboxInterface;", "viewShown", "invokeJavascriptMethod", "", "className", "methodName", "onAttachedToWindow", "onBackPressed", "onDetachedFromWindow", "onViewShown", "onViewTrackingFinished", "setAppIconRes", "inputStream", "AdSandboxActivityCallbacks", "AdSandboxChromeClient", "AdSandboxInterface", "sdk_release"}, k = 1, mv = {1, 6, 0}, xi = ConstraintLayout.LayoutParams.Table.LAYOUT_CONSTRAINT_VERTICAL_CHAINSTYLE) public final class p1 extends b2 implements a2.b { public final o1<?> c; public final b d; public final String e; public final AdiveryCallback f; public boolean g; public boolean h; public boolean i; public boolean j; public final EventManager k; public e2 l; public d m; @Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\b`\u0018\u00002\u00020\u0001J\b\u0010\u0002\u001a\u00020\u0003H&¨\u0006\u0004"}, d2 = {"Lcom/adivery/sdk/networks/adivery/AdSandbox$AdSandboxActivityCallbacks;", "", "onAdClosed", "", "sdk_release"}, k = 1, mv = {1, 6, 0}, xi = ConstraintLayout.LayoutParams.Table.LAYOUT_CONSTRAINT_VERTICAL_CHAINSTYLE) public interface b { void a(); } @Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u0011\n\u0002\b\f\b\u0082\u0004\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u001d\u0010\t\u001a\u00020\n2\u000e\u0010\u000b\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00040\fH\u0007¢\u0006\u0002\u0010\rJ\u0010\u0010\u000e\u001a\u00020\n2\u0006\u0010\u000f\u001a\u00020\u0004H\u0007J\b\u0010\u0010\u001a\u00020\nH\u0007J\b\u0010\u0011\u001a\u00020\nH\u0007J\b\u0010\u0012\u001a\u00020\nH\u0007J\b\u0010\u0013\u001a\u00020\nH\u0007J\b\u0010\u0014\u001a\u00020\nH\u0007J\b\u0010\u0015\u001a\u00020\nH\u0007J\u0012\u0010\u0016\u001a\u00020\n2\b\u0010\u0017\u001a\u0004\u0018\u00010\u0004H\u0007R\u0011\u0010\u0003\u001a\u00020\u00048G¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006R\u0011\u0010\u0007\u001a\u00020\u00048G¢\u0006\u0006\u001a\u0004\b\b\u0010\u0006¨\u0006\u0018"}, d2 = {"Lcom/adivery/sdk/networks/adivery/AdSandbox$AdSandboxInterface;", "", "(Lcom/adivery/sdk/networks/adivery/AdSandbox;)V", "config", "", "getConfig", "()Ljava/lang/String;", "media", "getMedia", "callTrackers", "", "urls", "", "([Ljava/lang/String;)V", "launchAndroidIntent", "configString", "onAdClicked", "onAdClosed", "onAdInitialized", "onAdRewarded", "onAdShown", "openLandingUrl", "openUrl", ImagesContract.URL, "sdk_release"}, k = 1, mv = {1, 6, 0}, xi = ConstraintLayout.LayoutParams.Table.LAYOUT_CONSTRAINT_VERTICAL_CHAINSTYLE) public final class d { public d() { } @JavascriptInterface public final void callTrackers(String[] urls) { Intrinsics.checkNotNullParameter(urls, "urls"); for (String str : urls) { EventManager eventManager = p1.this.k; Intrinsics.checkNotNull(str); eventManager.b(str); } } @JavascriptInterface public final String getConfig() { String jSONObject = p1.this.c.getD().toString(); Intrinsics.checkNotNullExpressionValue(jSONObject, "adObject.config.toString()"); return jSONObject; } @JavascriptInterface public final String getMedia() { String jSONObject = p1.this.c.getC().toString(); Intrinsics.checkNotNullExpressionValue(jSONObject, "adObject.media.toString()"); return jSONObject; } @JavascriptInterface public final void launchAndroidIntent(String configString) { Intrinsics.checkNotNullParameter(configString, "configString"); Context context = p1.this.getContext(); Intrinsics.checkNotNullExpressionValue(context, "context"); e1.a(context, configString); } @JavascriptInterface public final void onAdClicked() { AdiveryCallback adiveryCallback = p1.this.f; if (adiveryCallback != null) { adiveryCallback.onAdClicked(); } } @JavascriptInterface public final void onAdClosed() { p1.this.j = true; AdiveryCallback adiveryCallback = p1.this.f; if (adiveryCallback instanceof AdiveryInterstitialCallback) { ((AdiveryInterstitialCallback) p1.this.f).a(); b bVar = p1.this.d; if (bVar != null) { bVar.a(); return; } return; } if (adiveryCallback instanceof AdiveryRewardedCallback) { ((AdiveryRewardedCallback) p1.this.f).a(p1.this.i); b bVar2 = p1.this.d; if (bVar2 != null) { bVar2.a(); return; } return; } if (adiveryCallback instanceof AppOpenCallback) { ((AppOpenCallback) p1.this.f).a(); b bVar3 = p1.this.d; if (bVar3 != null) { bVar3.a(); } } } @JavascriptInterface public final void onAdInitialized() { p1.this.g = true; if (p1.this.h) { p1.this.b(); } } @JavascriptInterface public final void onAdRewarded() { p1.this.i = true; } @JavascriptInterface public final void onAdShown() { if (p1.this.f instanceof AdiveryFullscreenCallback) { ((AdiveryFullscreenCallback) p1.this.f).onAdShown(); } } @JavascriptInterface public final void openLandingUrl() { u1 e = p1.this.c.getE(); Context context = p1.this.getContext(); Intrinsics.checkNotNullExpressionValue(context, "context"); e.a(context); } @JavascriptInterface public final void openUrl(String url) { Context context = p1.this.getContext(); Intrinsics.checkNotNullExpressionValue(context, "context"); e1.b(context, url); } } public p1(Context context, o1<?> adObject, b bVar, String str, InputStream inputStream) { super(context); Intrinsics.checkNotNullParameter(context, "context"); Intrinsics.checkNotNullParameter(adObject, "adObject"); this.c = adObject; this.d = bVar; this.e = "https://cdn.adivery.com/media/app.jpg"; this.f = adObject.b(); this.k = new EventManager(); this.l = new e2(); if (str != null && str.length() > 0) { try { adObject.getD().put("app_name", str); } catch (JSONException unused) { } } if (inputStream != null) { setAppIconRes(inputStream); } setWebChromeClient(new c()); setWebViewClient(new a()); d dVar = new d(); this.m = dVar; addJavascriptInterface(dVar, "Environment"); loadUrl(this.c.getB()); } public final e2 getL() { return this.l; } @Override public void onAttachedToWindow() { super.onAttachedToWindow(); if (this.h) { return; } a2.a.a(this, 1000L, 0.9f, this); } @Override public void onDetachedFromWindow() { super.onDetachedFromWindow(); a2.a.a(this); } public final void setAppIconRes(InputStream inputStream) { Intrinsics.checkNotNullParameter(inputStream, "inputStream"); try { this.c.getC().put("app_icon", this.e); } catch (JSONException unused) { Logger.a.a("AdSandbox: failed to send app_icon to web-view"); } this.l.a(this.e, inputStream); } public final void setAssetLoader(e2 e2Var) { Intrinsics.checkNotNullParameter(e2Var, "<set-?>"); this.l = e2Var; } @Metadata(d1 = {"\u0000E\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0018\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u0007H\u0016J \u0010\b\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\fH\u0017J(\u0010\b\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u00072\u0006\u0010\u0010\u001a\u00020\u0007H\u0017J\u001c\u0010\u0011\u001a\u00020\u00122\b\u0010\u0004\u001a\u0004\u0018\u00010\u00052\b\u0010\u0013\u001a\u0004\u0018\u00010\u0014H\u0016J\u001a\u0010\u0015\u001a\u0004\u0018\u00010\u00162\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\t\u001a\u00020\nH\u0017J\u001a\u0010\u0015\u001a\u0004\u0018\u00010\u00162\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u0007H\u0017¨\u0006\u0017"}, d2 = {"com/adivery/sdk/networks/adivery/AdSandbox$1", "Landroid/webkit/WebViewClient;", "onPageFinished", "", "view", "Landroid/webkit/WebView;", ImagesContract.URL, "", "onReceivedError", "request", "Landroid/webkit/WebResourceRequest;", Constants.IPC_BUNDLE_KEY_SEND_ERROR, "Landroid/webkit/WebResourceError;", "errorCode", "", "description", "failingUrl", "onRenderProcessGone", "", "detail", "Landroid/webkit/RenderProcessGoneDetail;", "shouldInterceptRequest", "Landroid/webkit/WebResourceResponse;", "sdk_release"}, k = 1, mv = {1, 6, 0}, xi = ConstraintLayout.LayoutParams.Table.LAYOUT_CONSTRAINT_VERTICAL_CHAINSTYLE) public static final class a extends WebViewClient { public a() { } @Override public void onPageFinished(WebView view, String url) { Intrinsics.checkNotNullParameter(view, "view"); Intrinsics.checkNotNullParameter(url, "url"); super.onPageFinished(view, url); } @Override @Deprecated(message = "Deprecated in Java") public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Intrinsics.checkNotNullParameter(view, "view"); Intrinsics.checkNotNullParameter(description, "description"); Intrinsics.checkNotNullParameter(failingUrl, "failingUrl"); super.onReceivedError(view, errorCode, description, failingUrl); Logger.a.c("Failed to load Url in WebView: " + description + ", Url: " + failingUrl); } @Override public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) { if (Build.VERSION.SDK_INT <= 26) { return false; } super.onRenderProcessGone(view, detail); Logger logger = Logger.a; StringBuilder sb = new StringBuilder("webView crash "); sb.append(detail != null ? detail.didCrash() : false); logger.b(sb.toString()); if (view == null || !(view.getParent() instanceof ViewGroup)) { return true; } AdiveryCallback adiveryCallback = p1.this.f; if (adiveryCallback != null) { adiveryCallback.onAdShowFailed("Internal error"); } ViewParent parent = view.getParent(); if (parent != null) { ((ViewGroup) parent).removeView(view); view.destroy(); b bVar = p1.this.d; if (bVar == null) { return true; } bVar.a(); return true; } throw new NullPointerException("null cannot be cast to non-null type android.view.ViewGroup"); } @Override public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) { Intrinsics.checkNotNullParameter(view, "view"); Intrinsics.checkNotNullParameter(request, "request"); e2 l = p1.this.getL(); Uri url = request.getUrl(); Intrinsics.checkNotNullExpressionValue(url, "request.url"); WebResourceResponse a = l.a(url); return a == null ? super.shouldInterceptRequest(view, request) : a; } @Override public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { int errorCode; CharSequence description; Intrinsics.checkNotNullParameter(view, "view"); Intrinsics.checkNotNullParameter(request, "request"); Intrinsics.checkNotNullParameter(error, "error"); errorCode = error.getErrorCode(); description = error.getDescription(); String obj = description.toString(); String uri = request.getUrl().toString(); Intrinsics.checkNotNullExpressionValue(uri, "request.url.toString()"); onReceivedError(view, errorCode, obj, uri); } @Override @Deprecated(message = "Deprecated in Java") public WebResourceResponse shouldInterceptRequest(WebView view, String url) { Intrinsics.checkNotNullParameter(view, "view"); Intrinsics.checkNotNullParameter(url, "url"); WebResourceResponse b = p1.this.getL().b(url); return b == null ? super.shouldInterceptRequest(view, url) : b; } } public final void d() { a("Sandbox", "onBackPressed"); } @Override public void a() { a2.a.a(this); } @Override public void b() { this.h = true; if (this.g) { a("Sandbox", "onViewShown"); } } public final void a(String className, String methodName) { Intrinsics.checkNotNullParameter(className, "className"); Intrinsics.checkNotNullParameter(methodName, "methodName"); a("javascript:window." + className + '.' + methodName + "();"); } @Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\b\u0002\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\n\u0010\u0003\u001a\u0004\u0018\u00010\u0004H\u0016J\u0012\u0010\u0005\u001a\u00020\u00062\b\u0010\u0007\u001a\u0004\u0018\u00010\bH\u0016J \u0010\u0005\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000bH\u0017¨\u0006\u000f"}, d2 = {"Lcom/adivery/sdk/networks/adivery/AdSandbox$AdSandboxChromeClient;", "Landroid/webkit/WebChromeClient;", "()V", "getDefaultVideoPoster", "Landroid/graphics/Bitmap;", "onConsoleMessage", "", "consoleMessage", "Landroid/webkit/ConsoleMessage;", "", "message", "", "lineNumber", "", "sourceID", "sdk_release"}, k = 1, mv = {1, 6, 0}, xi = ConstraintLayout.LayoutParams.Table.LAYOUT_CONSTRAINT_VERTICAL_CHAINSTYLE) public static final class c extends WebChromeClient { @Override public Bitmap getDefaultVideoPoster() { return Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); } @Override public boolean onConsoleMessage(ConsoleMessage consoleMessage) { if (consoleMessage != null && consoleMessage.messageLevel() == ConsoleMessage.MessageLevel.ERROR) { Logger.a.b(consoleMessage.lineNumber() + ": " + consoleMessage.message()); } return super.onConsoleMessage(consoleMessage); } @Override @Deprecated(message = "Deprecated in Java") public void onConsoleMessage(String message, int lineNumber, String sourceID) { File file; Intrinsics.checkNotNullParameter(message, "message"); Intrinsics.checkNotNullParameter(sourceID, "sourceID"); try { file = new File(sourceID); } catch (Exception e) { Logger.a.b("Could not handle sourceId", e); file = null; } if (file != null) { Intrinsics.checkNotNullExpressionValue(file.getName(), "tmp.name"); } } } public p1(Context context, o1<?> adObject) { this(context, adObject, null, null, null); Intrinsics.checkNotNullParameter(context, "context"); Intrinsics.checkNotNullParameter(adObject, "adObject"); } }