Step Record v1.1.5版本的 MD5 值为:5797275f89198878d2f00ee92d534382

以下内容为反编译后的 zSztH.java 源代码,内容仅作参考


package com.chartboost.heliumsdk.impl;

import android.annotation.TargetApi;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.WebViewRenderProcess;
import android.webkit.WebViewRenderProcessClient;
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import com.adjust.sdk.Constants;
import com.anythink.expressad.atsignalcommon.mraid.CallMraidJS;
import com.anythink.expressad.foundation.g.a;
import com.chartboost.heliumsdk.impl.HHHH1;
import com.chartboost.sdk.impl.b0;
import com.vungle.ads.internal.model.AdPayload;
import com.vungle.ads.internal.model.Placement;
import java.util.concurrent.ExecutorService;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlinx.serialization.json.JsonElementBuildersKt;
import kotlinx.serialization.json.JsonObject;
import kotlinx.serialization.json.JsonObjectBuilder;
import kotlinx.serialization.json.internal.AbstractJsonLexerKt;

public final class zSztH extends WebViewClient implements HHHH1 {
    public static final SKHKzK Companion = new SKHKzK(null);
    private static final String TAG = "VungleWebClient";
    private final AdPayload advertisement;
    private boolean collectConsent;
    private HHHH1.t1H1KH1K errorHandler;
    private String gdprAccept;
    private String gdprBody;
    private String gdprDeny;
    private String gdprTitle;
    private Boolean isViewable;
    private WebView loadedWebView;
    private HHHH1.SKHKzK mraidDelegate;
    private final ExecutorService offloadExecutor;
    private final Placement placement;
    private boolean ready;
    private tKtHH webViewObserver;

    public static final class SKHKzK {
        private SKHKzK() {
        }

        public SKHKzK(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }
    }

    @RequiresApi(29)
    public static final class t1H1KH1K extends WebViewRenderProcessClient {
        private HHHH1.t1H1KH1K errorHandler;

        public t1H1KH1K(HHHH1.t1H1KH1K t1h1kh1k) {
            this.errorHandler = t1h1kh1k;
        }

        public final HHHH1.t1H1KH1K getErrorHandler() {
            return this.errorHandler;
        }

        @Override
        public void onRenderProcessResponsive(WebView webView, WebViewRenderProcess webViewRenderProcess) {
            ttHtzKt.tzttS1SS1(webView, "webView");
        }

        @Override
        public void onRenderProcessUnresponsive(WebView webView, WebViewRenderProcess webViewRenderProcess) {
            boolean z;
            ttHtzKt.tzttS1SS1(webView, "webView");
            StringBuilder sb = new StringBuilder("onRenderProcessUnresponsive(Title = ");
            sb.append(webView.getTitle());
            sb.append(", URL = ");
            sb.append(webView.getOriginalUrl());
            sb.append(", (webViewRenderProcess != null) = ");
            if (webViewRenderProcess != null) {
                z = true;
            } else {
                z = false;
            }
            sb.append(z);
            Log.w(zSztH.TAG, sb.toString());
            HHHH1.t1H1KH1K t1h1kh1k = this.errorHandler;
            if (t1h1kh1k != null) {
                t1h1kh1k.onRenderProcessUnresponsive(webView, webViewRenderProcess);
            }
        }

        public final void setErrorHandler(HHHH1.t1H1KH1K t1h1kh1k) {
            this.errorHandler = t1h1kh1k;
        }
    }

    public zSztH(AdPayload adPayload, Placement placement, ExecutorService executorService) {
        ttHtzKt.tzttS1SS1(adPayload, "advertisement");
        ttHtzKt.tzttS1SS1(placement, "placement");
        ttHtzKt.tzttS1SS1(executorService, "offloadExecutor");
        this.advertisement = adPayload;
        this.placement = placement;
        this.offloadExecutor = executorService;
    }

    @VisibleForTesting
    public static void getCollectConsent$vungle_ads_release$annotations() {
    }

    @VisibleForTesting
    public static void getErrorHandler$vungle_ads_release$annotations() {
    }

    @VisibleForTesting
    public static void getGdprAccept$vungle_ads_release$annotations() {
    }

    @VisibleForTesting
    public static void getGdprBody$vungle_ads_release$annotations() {
    }

    @VisibleForTesting
    public static void getGdprDeny$vungle_ads_release$annotations() {
    }

    @VisibleForTesting
    public static void getGdprTitle$vungle_ads_release$annotations() {
    }

    @VisibleForTesting
    public static void getLoadedWebView$vungle_ads_release$annotations() {
    }

    @VisibleForTesting
    public static void getMraidDelegate$vungle_ads_release$annotations() {
    }

    @VisibleForTesting
    public static void getReady$vungle_ads_release$annotations() {
    }

    @VisibleForTesting
    public static void getWebViewObserver$vungle_ads_release$annotations() {
    }

    private final void handleWebViewError(String str, String str2, boolean z) {
        String str3 = str2 + ' ' + str;
        HHHH1.t1H1KH1K t1h1kh1k = this.errorHandler;
        if (t1h1kh1k != null) {
            t1h1kh1k.onReceivedError(str3, z);
        }
    }

    private final boolean isCriticalAsset(String str) {
        boolean z;
        if (str.length() > 0) {
            z = true;
        } else {
            z = false;
        }
        if (!z) {
            return false;
        }
        return this.advertisement.getDownloadableUrls().containsValue(str);
    }

    @VisibleForTesting
    public static void isViewable$vungle_ads_release$annotations() {
    }

    private final void runJavascriptOnWebView(WebView webView, String str) {
        if (webView != null) {
            try {
                webView.evaluateJavascript(str, null);
            } catch (Exception e) {
                com.vungle.ads.SKHKzK.INSTANCE.logError$vungle_ads_release(313, "Evaluate js failed " + e.getLocalizedMessage(), this.placement.getReferenceId(), this.advertisement.getCreativeId(), this.advertisement.eventId());
            }
        }
    }

    public static final void m29shouldOverrideUrlLoading$lambda4$lambda3$lambda2(HHHH1.SKHKzK sKHKzK, String str, JsonObject jsonObject, Handler handler, zSztH zszth, WebView webView) {
        ttHtzKt.tzttS1SS1(sKHKzK, "$it");
        ttHtzKt.tzttS1SS1(str, "$command");
        ttHtzKt.tzttS1SS1(jsonObject, "$args");
        ttHtzKt.tzttS1SS1(handler, "$handler");
        ttHtzKt.tzttS1SS1(zszth, "this$0");
        if (sKHKzK.processCommand(str, jsonObject)) {
            handler.post(new SHHS(14, zszth, webView));
        }
    }

    public static final void m30shouldOverrideUrlLoading$lambda4$lambda3$lambda2$lambda1(zSztH zszth, WebView webView) {
        ttHtzKt.tzttS1SS1(zszth, "this$0");
        zszth.runJavascriptOnWebView(webView, "window.vungle.mraidBridge.notifyCommandComplete()");
    }

    public static void t1H1KH1K(zSztH zszth, WebView webView) {
        m30shouldOverrideUrlLoading$lambda4$lambda3$lambda2$lambda1(zszth, webView);
    }

    public final boolean getCollectConsent$vungle_ads_release() {
        return this.collectConsent;
    }

    public final HHHH1.t1H1KH1K getErrorHandler$vungle_ads_release() {
        return this.errorHandler;
    }

    public final String getGdprAccept$vungle_ads_release() {
        return this.gdprAccept;
    }

    public final String getGdprBody$vungle_ads_release() {
        return this.gdprBody;
    }

    public final String getGdprDeny$vungle_ads_release() {
        return this.gdprDeny;
    }

    public final String getGdprTitle$vungle_ads_release() {
        return this.gdprTitle;
    }

    public final WebView getLoadedWebView$vungle_ads_release() {
        return this.loadedWebView;
    }

    public final HHHH1.SKHKzK getMraidDelegate$vungle_ads_release() {
        return this.mraidDelegate;
    }

    public final boolean getReady$vungle_ads_release() {
        return this.ready;
    }

    public final tKtHH getWebViewObserver$vungle_ads_release() {
        return this.webViewObserver;
    }

    public final Boolean isViewable$vungle_ads_release() {
        return this.isViewable;
    }

    @Override
    public void notifyPropertiesChange(boolean z) {
        WebView webView = this.loadedWebView;
        if (webView != null) {
            JsonObjectBuilder jsonObjectBuilder = new JsonObjectBuilder();
            JsonObjectBuilder jsonObjectBuilder2 = new JsonObjectBuilder();
            JsonElementBuildersKt.put(jsonObjectBuilder2, "width", Integer.valueOf(webView.getWidth()));
            JsonElementBuildersKt.put(jsonObjectBuilder2, "height", Integer.valueOf(webView.getHeight()));
            JsonObject build = jsonObjectBuilder2.build();
            JsonObjectBuilder jsonObjectBuilder3 = new JsonObjectBuilder();
            JsonElementBuildersKt.put(jsonObjectBuilder3, b0.a, (Number) 0);
            JsonElementBuildersKt.put(jsonObjectBuilder3, "y", (Number) 0);
            JsonElementBuildersKt.put(jsonObjectBuilder3, "width", Integer.valueOf(webView.getWidth()));
            JsonElementBuildersKt.put(jsonObjectBuilder3, "height", Integer.valueOf(webView.getHeight()));
            JsonObject build2 = jsonObjectBuilder3.build();
            JsonObjectBuilder jsonObjectBuilder4 = new JsonObjectBuilder();
            Boolean bool = Boolean.FALSE;
            JsonElementBuildersKt.put(jsonObjectBuilder4, "sms", bool);
            JsonElementBuildersKt.put(jsonObjectBuilder4, "tel", bool);
            JsonElementBuildersKt.put(jsonObjectBuilder4, "calendar", bool);
            JsonElementBuildersKt.put(jsonObjectBuilder4, "storePicture", bool);
            JsonElementBuildersKt.put(jsonObjectBuilder4, "inlineVideo", bool);
            JsonObject build3 = jsonObjectBuilder4.build();
            jsonObjectBuilder.put("maxSize", build);
            jsonObjectBuilder.put("screenSize", build);
            jsonObjectBuilder.put("defaultPosition", build2);
            jsonObjectBuilder.put("currentPosition", build2);
            jsonObjectBuilder.put("supports", build3);
            JsonElementBuildersKt.put(jsonObjectBuilder, CallMraidJS.a, this.advertisement.templateType());
            Boolean bool2 = this.isViewable;
            if (bool2 != null) {
                JsonElementBuildersKt.put(jsonObjectBuilder, "isViewable", Boolean.valueOf(bool2.booleanValue()));
            }
            JsonElementBuildersKt.put(jsonObjectBuilder, "os", "android");
            JsonElementBuildersKt.put(jsonObjectBuilder, "osVersion", String.valueOf(Build.VERSION.SDK_INT));
            JsonElementBuildersKt.put(jsonObjectBuilder, "incentivized", this.placement.getIncentivized());
            JsonElementBuildersKt.put(jsonObjectBuilder, "enableBackImmediately", Integer.valueOf(this.advertisement.getShowCloseDelay(this.placement.getIncentivized())));
            JsonElementBuildersKt.put(jsonObjectBuilder, a.i, "1.0");
            if (this.collectConsent) {
                JsonElementBuildersKt.put(jsonObjectBuilder, "consentRequired", Boolean.TRUE);
                JsonElementBuildersKt.put(jsonObjectBuilder, "consentTitleText", this.gdprTitle);
                JsonElementBuildersKt.put(jsonObjectBuilder, "consentBodyText", this.gdprBody);
                JsonElementBuildersKt.put(jsonObjectBuilder, "consentAcceptButtonText", this.gdprAccept);
                JsonElementBuildersKt.put(jsonObjectBuilder, "consentDenyButtonText", this.gdprDeny);
            } else {
                JsonElementBuildersKt.put(jsonObjectBuilder, "consentRequired", bool);
            }
            JsonElementBuildersKt.put(jsonObjectBuilder, "sdkVersion", "7.1.0");
            JsonObject build4 = jsonObjectBuilder.build();
            Log.d(TAG, "loadJs->javascript:window.vungle.mraidBridge.notifyPropertiesChange(" + build4 + AbstractJsonLexerKt.COMMA + z + ')');
            runJavascriptOnWebView(webView, "window.vungle.mraidBridge.notifyPropertiesChange(" + build4 + AbstractJsonLexerKt.COMMA + z + ')');
        }
    }

    @Override
    public void onPageFinished(WebView webView, String str) {
        super.onPageFinished(webView, str);
        if (webView == null) {
            return;
        }
        this.loadedWebView = webView;
        webView.setVisibility(0);
        notifyPropertiesChange(true);
        if (Build.VERSION.SDK_INT >= 29) {
            webView.setWebViewRenderProcessClient(new t1H1KH1K(this.errorHandler));
        }
        tKtHH tkthh = this.webViewObserver;
        if (tkthh != null) {
            tkthh.onPageFinished(webView);
        }
    }

    @Override
    public void onReceivedError(WebView webView, int i, String str, String str2) {
        ttHtzKt.tzttS1SS1(str, "description");
        ttHtzKt.tzttS1SS1(str2, "failingUrl");
        super.onReceivedError(webView, i, str, str2);
    }

    @Override
    public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
        Integer num;
        boolean z;
        super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
        Uri uri = null;
        if (webResourceResponse != null) {
            num = Integer.valueOf(webResourceResponse.getStatusCode());
        } else {
            num = null;
        }
        String valueOf = String.valueOf(num);
        if (webResourceRequest != null) {
            uri = webResourceRequest.getUrl();
        }
        String valueOf2 = String.valueOf(uri);
        boolean z2 = true;
        if (webResourceRequest != null && webResourceRequest.isForMainFrame()) {
            z = true;
        } else {
            z = false;
        }
        Log.e(TAG, "Http Error desc " + valueOf + ' ' + z + " for URL " + valueOf2);
        if (!isCriticalAsset(valueOf2) || !z) {
            z2 = false;
        }
        handleWebViewError(valueOf, valueOf2, z2);
    }

    @Override
    @TargetApi(26)
    public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
        String str;
        Boolean bool;
        StringBuilder sb = new StringBuilder("onRenderProcessGone url: ");
        Boolean bool2 = null;
        if (webView != null) {
            str = webView.getUrl();
        } else {
            str = null;
        }
        sb.append(str);
        sb.append(", did crash: ");
        if (renderProcessGoneDetail != null) {
            bool = Boolean.valueOf(renderProcessGoneDetail.didCrash());
        } else {
            bool = null;
        }
        sb.append(bool);
        Log.w(TAG, sb.toString());
        this.loadedWebView = null;
        HHHH1.t1H1KH1K t1h1kh1k = this.errorHandler;
        if (t1h1kh1k != null) {
            if (renderProcessGoneDetail != null) {
                bool2 = Boolean.valueOf(renderProcessGoneDetail.didCrash());
            }
            return t1h1kh1k.onWebRenderingProcessGone(webView, bool2);
        }
        return super.onRenderProcessGone(webView, renderProcessGoneDetail);
    }

    @Override
    public void setAdVisibility(boolean z) {
        this.isViewable = Boolean.valueOf(z);
        notifyPropertiesChange(false);
    }

    public final void setCollectConsent$vungle_ads_release(boolean z) {
        this.collectConsent = z;
    }

    @Override
    public void setConsentStatus(boolean z, String str, String str2, String str3, String str4) {
        this.collectConsent = z;
        this.gdprTitle = str;
        this.gdprBody = str2;
        this.gdprAccept = str3;
        this.gdprDeny = str4;
    }

    @Override
    public void setErrorHandler(HHHH1.t1H1KH1K t1h1kh1k) {
        ttHtzKt.tzttS1SS1(t1h1kh1k, "errorHandler");
        this.errorHandler = t1h1kh1k;
    }

    public final void setErrorHandler$vungle_ads_release(HHHH1.t1H1KH1K t1h1kh1k) {
        this.errorHandler = t1h1kh1k;
    }

    public final void setGdprAccept$vungle_ads_release(String str) {
        this.gdprAccept = str;
    }

    public final void setGdprBody$vungle_ads_release(String str) {
        this.gdprBody = str;
    }

    public final void setGdprDeny$vungle_ads_release(String str) {
        this.gdprDeny = str;
    }

    public final void setGdprTitle$vungle_ads_release(String str) {
        this.gdprTitle = str;
    }

    public final void setLoadedWebView$vungle_ads_release(WebView webView) {
        this.loadedWebView = webView;
    }

    @Override
    public void setMraidDelegate(HHHH1.SKHKzK sKHKzK) {
        this.mraidDelegate = sKHKzK;
    }

    public final void setMraidDelegate$vungle_ads_release(HHHH1.SKHKzK sKHKzK) {
        this.mraidDelegate = sKHKzK;
    }

    public final void setReady$vungle_ads_release(boolean z) {
        this.ready = z;
    }

    public final void setViewable$vungle_ads_release(Boolean bool) {
        this.isViewable = bool;
    }

    @Override
    public void setWebViewObserver(tKtHH tkthh) {
        this.webViewObserver = tkthh;
    }

    public final void setWebViewObserver$vungle_ads_release(tKtHH tkthh) {
        this.webViewObserver = tkthh;
    }

    @Override
    public boolean shouldOverrideUrlLoading(final WebView webView, String str) {
        boolean z;
        Log.d(TAG, "MRAID Command " + str);
        if (str != null && str.length() != 0) {
            z = false;
        } else {
            z = true;
        }
        if (z) {
            Log.e(TAG, "Invalid URL ");
            return false;
        }
        Uri parse = Uri.parse(str);
        if (parse == null || parse.getScheme() == null) {
            return false;
        }
        String scheme = parse.getScheme();
        if (ttHtzKt.SKHKzK(scheme, "mraid")) {
            final String host = parse.getHost();
            if (host != null) {
                if (ttHtzKt.SKHKzK("propertiesChangeCompleted", host)) {
                    if (!this.ready) {
                        runJavascriptOnWebView(webView, "window.vungle.mraidBridge.notifyReadyEvent(" + this.advertisement.createMRAIDArgs() + ')');
                        this.ready = true;
                    }
                } else {
                    final HHHH1.SKHKzK sKHKzK = this.mraidDelegate;
                    if (sKHKzK != null) {
                        JsonObjectBuilder jsonObjectBuilder = new JsonObjectBuilder();
                        for (String str2 : parse.getQueryParameterNames()) {
                            ttHtzKt.tz(str2, "param");
                            JsonElementBuildersKt.put(jsonObjectBuilder, str2, parse.getQueryParameter(str2));
                        }
                        final JsonObject build = jsonObjectBuilder.build();
                        final Handler handler = new Handler(Looper.getMainLooper());
                        this.offloadExecutor.submit(new Runnable() {
                            @Override
                            public final void run() {
                                zSztH.m29shouldOverrideUrlLoading$lambda4$lambda3$lambda2(HHHH1.SKHKzK.this, host, build, handler, this, webView);
                            }
                        });
                    }
                }
                return true;
            }
        } else if (S1t1HtH.tt11tzSSt("http", scheme, true) || S1t1HtH.tt11tzSSt(Constants.SCHEME, scheme, true)) {
            Log.d(TAG, "Open URL" + str);
            HHHH1.SKHKzK sKHKzK2 = this.mraidDelegate;
            if (sKHKzK2 != null) {
                JsonObjectBuilder jsonObjectBuilder2 = new JsonObjectBuilder();
                JsonElementBuildersKt.put(jsonObjectBuilder2, "url", str);
                sKHKzK2.processCommand("openNonMraid", jsonObjectBuilder2.build());
            }
            return true;
        }
        return false;
    }

    @Override
    public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
        super.onReceivedError(webView, webResourceRequest, webResourceError);
        String valueOf = String.valueOf(webResourceError != null ? webResourceError.getDescription() : null);
        String valueOf2 = String.valueOf(webResourceRequest != null ? webResourceRequest.getUrl() : null);
        boolean z = webResourceRequest != null && webResourceRequest.isForMainFrame();
        Log.e(TAG, "Error desc " + valueOf + ' ' + z + " for URL " + valueOf2);
        handleWebViewError(valueOf, valueOf2, isCriticalAsset(valueOf2) && z);
    }
}