QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

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


package com.tencent.mtt.lightwindow;

import MTT.AdActionInfo;
import MTT.AdReportActionInfo;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.webkit.ValueCallback;
import android.widget.TextView;
import com.huawei.hms.framework.common.ContainerUtils;
import com.tencent.common.manifest.AppManifest;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.ui.widget.QBWebImageView;
import com.tencent.mtt.base.webview.QBWebView;
import com.tencent.mtt.base.webview.WebExtension;
import com.tencent.mtt.base.webview.common.QBBrowserClient;
import com.tencent.mtt.base.webview.common.QBWebResourceRequest;
import com.tencent.mtt.base.webview.common.QBWebViewClient;
import com.tencent.mtt.base.wup.WUPRequest;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.lightwindow.WebPageFrame;
import com.tencent.mtt.lightwindow.framwork.IPageCtrl;
import com.tencent.mtt.lightwindow.framwork.LightWindowBuilder;
import com.tencent.mtt.lightwindow.framwork.WindowClient;
import com.tencent.mtt.lightwindow.framwork.WindowController;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.log.plugin.useraction.WebActionListener;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import java.util.ArrayList;
import java.util.Iterator;
import qb.a.e;
import qb.a.g;
import qb.a.h;

public class CooperativeCallWindow implements View.OnClickListener, WebPageFrame.WebPageLoadingCallback, WindowClient {
    private static String p = "!function(g,d,t,e,v,n,s){if(g.gdt)return;v=g.gdt=function(){v.tk?v.tk.apply(v,arguments):v.queue.push(arguments)};v.sv='1.0';v.bt=2;v.queue=[];n=d.createElement(t);n.async=!0;n.src=e;s=d.getElementsByTagName(t)[0];s.parentNode.insertBefore(n,s);}(window,document,\"script\",\"//qzonestyle.gtimg.cn/qzone/biz/gdt/dmp/user-action/gdtevent.min.js\");gdt(\"init\",\"%s\");gdt(\"track\",\"PAGE_VIEW\")";

    public String f66989a;

    LightWindowBuilder f66991c;

    public WebPageFrame f66992d;
    public String i;
    public String j;
    private AdReportActionInfo k = null;
    private AdReportActionInfo l = null;

    WindowController f66990b = null;
    boolean e = true;
    boolean f = true;
    Bundle g = null;
    public Object h = null;
    private boolean m = false;
    private boolean n = false;
    private boolean o = false;

    private QBWebViewClient a(final LightWindowBuilder lightWindowBuilder) {
        return new QBWebViewClient() {

            long f66993a = 0;

            @Override
            public void onPageFinished(QBWebView qBWebView, String str) {
                LightWindowBuilder lightWindowBuilder2;
                if (qBWebView == null || !TextUtils.isEmpty(qBWebView.getTitle()) || (lightWindowBuilder2 = lightWindowBuilder) == null) {
                    return;
                }
                View f = lightWindowBuilder2.f();
                if (f instanceof TextView) {
                    ((TextView) f).setText(MttResources.l(h.f85888a));
                }
            }

            @Override
            public boolean shouldOverrideUrlLoading(QBWebView qBWebView, QBWebResourceRequest qBWebResourceRequest) {
                if (!qBWebResourceRequest.d()) {
                    return false;
                }
                long currentTimeMillis = System.currentTimeMillis();
                if (currentTimeMillis - this.f66993a <= 150) {
                    return false;
                }
                if (CooperativeCallWindow.this.k != null) {
                    AdActionInfo adActionInfo = new AdActionInfo();
                    adActionInfo.eAction = 22;
                    adActionInfo.sActionValue = qBWebResourceRequest.a().toString();
                    CooperativeCallWindow.this.k.vAdActionInfo.add(adActionInfo);
                }
                if (CooperativeCallWindow.this.l != null) {
                    AdActionInfo adActionInfo2 = new AdActionInfo();
                    adActionInfo2.eAction = 22;
                    adActionInfo2.sActionValue = qBWebResourceRequest.a().toString();
                    CooperativeCallWindow.this.l.vAdActionInfo.add(adActionInfo2);
                }
                this.f66993a = currentTimeMillis;
                return false;
            }

            @Override
            public boolean shouldOverrideUrlLoading(QBWebView qBWebView, String str) {
                CooperativeCallWindow.this.a(str);
                WebExtension webExtension = (WebExtension) AppManifest.getInstance().queryExtension(WebExtension.class, null);
                return webExtension != null ? webExtension.onLightWindowShouldOverrideUrlLoading(qBWebView, str) : super.shouldOverrideUrlLoading(qBWebView, str);
            }
        };
    }

    private void a(Bundle bundle) {
        boolean z;
        String string = bundle.getString("need_share", "");
        if (TextUtils.isEmpty(string)) {
            z = bundle.getBoolean("need_share", true);
        } else {
            if (!string.equals("false")) {
                this.f = true;
                return;
            }
            z = false;
        }
        this.f = z;
    }

    private void b(String str) {
        AdReportActionInfo adReportActionInfo = this.l;
        if (adReportActionInfo != null) {
            boolean z = false;
            Iterator<AdActionInfo> it = adReportActionInfo.vAdActionInfo.iterator();
            while (it.hasNext()) {
                AdActionInfo next = it.next();
                if (next.eAction == 56) {
                    z = true;
                    next.sActionValue += ContainerUtils.FIELD_DELIMITER + str + ContainerUtils.KEY_VALUE_DELIMITER + System.currentTimeMillis();
                }
            }
            if (z) {
                return;
            }
            AdActionInfo adActionInfo = new AdActionInfo();
            adActionInfo.eAction = 56;
            adActionInfo.sActionValue = str + ContainerUtils.KEY_VALUE_DELIMITER + System.currentTimeMillis();
            this.l.vAdActionInfo.add(adActionInfo);
        }
    }

    private void c(String str) {
        if (this.f66992d.c()) {
            this.f66992d.a();
        } else {
            d(str);
        }
    }

    private void d(String str) {
        String str2;
        if (str.equals("back_from_left_button")) {
            if (this.g.getString("BackType", "0").equals("1")) {
                l();
                str2 = "GGBFQ02";
            } else {
                str2 = "GGBFQ06";
            }
        } else if (!str.equals("back_from_hardware")) {
            if (str.equals("back_from_extra_button")) {
                str2 = "GGBFQ03";
            }
            this.f66990b.closeWindow();
        } else if (this.g.getString("BackHardType", "0").equals("1")) {
            l();
            str2 = "GGBFQ05";
        } else {
            str2 = "GGBFQ04";
        }
        e(str2);
        this.f66990b.closeWindow();
    }

    private void e(String str) {
        if ("tbsAd".equals(this.g.getString("fromWhere", ""))) {
            StatManager.b().c(str);
        }
    }

    private AdReportActionInfo f(String str) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        AdReportActionInfo adReportActionInfo = new AdReportActionInfo();
        adReportActionInfo.sAdsStatCommInfo = str;
        adReportActionInfo.vAdActionInfo = new ArrayList<>();
        return adReportActionInfo;
    }

    private void j() {
        String str;
        if (TextUtils.isEmpty(this.i)) {
            return;
        }
        QBWebImageView h = this.f66991c.h();
        h.setOnClickListener(this);
        h.setVisibility(0);
        String string = this.g.getString("linktype");
        int parseInt = string != null ? Integer.parseInt(string) : -1;
        if (parseInt == 0) {
            str = "https://res.imtt.qq.com/life/column/img/gouwuzanding3x.png";
        } else if (parseInt == 1) {
            str = "https://res.imtt.qq.com/life/column/img/gamezanding3x.png";
        } else if (parseInt != 2) {
            return;
        } else {
            str = "https://res.imtt.qq.com/life/column/img/softwarezanding3x.png";
        }
        h.setUrl(str);
    }

    private void k() {
        if ("tbsAd".equals(this.g.getString("fromWhere", ""))) {
            String string = this.g.getString("guid", "");
            if (!TextUtils.isEmpty(string)) {
                LightWindowUtils.a(string);
            }
            StatManager.b().c("GGBFQ01");
        }
    }

    private void l() {
        UrlParams urlParams = new UrlParams("qb://home/feeds?tabId=1&refresh=1&forceTop=1");
        urlParams.b(33);
        LightWindowUtils.a(urlParams, this.f66990b.getContainer());
    }

    private void m() {
        WebExtension webExtension = (WebExtension) AppManifest.getInstance().queryExtension(WebExtension.class, null);
        if (webExtension != null) {
            webExtension.onLightwindowStartShare(this, this.k);
            webExtension.onLightwindowStartShare(this, this.l);
        }
        LightWindowUtils.a(this.f66992d, this.f66990b.getContainer(), this.g, false, this.h);
    }

    @Override
    public View a(WindowController windowController, LightWindowBuilder lightWindowBuilder, Bundle bundle) {
        this.g = bundle;
        this.f66990b = windowController;
        this.f66989a = bundle.getString("PosID");
        String string = bundle.getString("adtitle", null);
        this.k = f(this.g.getString("aid"));
        this.l = f(this.g.getString("nfa_aid"));
        if (this.k != null) {
            AdActionInfo adActionInfo = new AdActionInfo();
            adActionInfo.eAction = 16;
            this.k.vAdActionInfo.add(adActionInfo);
        }
        if (this.l != null) {
            AdActionInfo adActionInfo2 = new AdActionInfo();
            adActionInfo2.eAction = 16;
            this.l.vAdActionInfo.add(adActionInfo2);
            b("adct");
        }
        this.f66991c = lightWindowBuilder;
        this.e = bundle.getBoolean("need_skin", true);
        a(bundle);
        this.f66992d = LightWindowUtils.a(windowController, lightWindowBuilder, this.e, Boolean.valueOf(bundle.getString("force_x5core")).booleanValue()).a(bundle).a(bundle.getString("entry_url"));
        this.f66992d.setWebPageLoadingCallback(this);
        this.f66992d.a(a(lightWindowBuilder));
        this.f66992d.a(new QBBrowserClient());
        this.f66992d.f();
        this.f66992d.e();
        this.f66991c.a(new QBResHolder()).a((IPageCtrl) this.f66992d).a(string, e.f85871a, string == null).a(this).a((View) this.f66992d);
        this.i = UrlUtils.decode(this.g.getString("linkto"));
        View b2 = this.f66991c.b();
        if (b2 != null) {
            b2.setOnClickListener(this);
        }
        j();
        if (this.f) {
            this.f66991c.a(g.Q);
        }
        this.j = bundle.getString("BackTitle", "");
        if (!TextUtils.isEmpty(this.j)) {
            this.f66991c.a(this.j);
        }
        k();
        return this.f66991c.g();
    }

    @Override
    public void a() {
        WebExtension webExtension = (WebExtension) AppManifest.getInstance().queryExtension(WebExtension.class, null);
        if (webExtension != null) {
            webExtension.onLightWindowStart();
        }
    }

    @Override
    public void a(int i) {
        if (i < 100) {
            this.o = false;
        }
        if (i < 100 || this.l == null || this.o) {
            return;
        }
        b("hrt");
        this.o = true;
    }

    @Override
    public void a(Intent intent) {
    }

    public void a(QBWebView qBWebView, String str) {
        String string = this.g.getString("nocoid");
        if (!TextUtils.isEmpty(string)) {
            qBWebView.evaluateJavascript("javascript:" + String.format(p, string), new ValueCallback<String>() {
                @Override
                public void onReceiveValue(String str2) {
                }
            });
        }
        if (this.k != null && !this.m) {
            AdActionInfo adActionInfo = new AdActionInfo();
            adActionInfo.eAction = 3;
            adActionInfo.sActionValue = "1";
            this.k.vAdActionInfo.add(adActionInfo);
            this.m = true;
        }
        if (this.l != null && !this.n) {
            AdActionInfo adActionInfo2 = new AdActionInfo();
            adActionInfo2.eAction = 3;
            adActionInfo2.sActionValue = "1";
            this.l.vAdActionInfo.add(adActionInfo2);
            this.n = true;
        }
        if (this.l != null) {
            b("brt");
        }
        Logs.a("loadUrl", (Object) str);
        WebActionListener.a(qBWebView);
    }

    protected void a(String str) {
        WebPageFrame webPageFrame = this.f66992d;
        if (webPageFrame != null) {
            webPageFrame.setOverrideUrl(str);
        }
    }

    @Override
    public void b() {
        WebExtension webExtension = (WebExtension) AppManifest.getInstance().queryExtension(WebExtension.class, null);
        if (webExtension != null && this.k != null) {
            WUPRequest wUPRequest = new WUPRequest();
            wUPRequest.setServerName("AdsStat");
            wUPRequest.setFuncName("reportAdActionInfo");
            webExtension.onLightWindowStop(this.k, wUPRequest);
        }
        if (webExtension == null || this.l == null) {
            return;
        }
        b("lpct");
        if (this.l.vAdActionInfo != null) {
            Iterator<AdActionInfo> it = this.l.vAdActionInfo.iterator();
            while (it.hasNext()) {
                it.next();
            }
        }
        WUPRequest wUPRequest2 = new WUPRequest();
        wUPRequest2.setServerName("AdsStatNFA");
        wUPRequest2.setFuncName("reportAdActionInfo");
        webExtension.onLightWindowStop(this.l, wUPRequest2);
    }

    @Override
    public void c() {
        c("back_from_hardware");
    }

    public void d() {
        if (this.k != null) {
            AdActionInfo adActionInfo = new AdActionInfo();
            adActionInfo.eAction = 8;
            adActionInfo.sActionValue = "1";
            this.k.vAdActionInfo.add(adActionInfo);
        }
        if (this.l != null) {
            AdActionInfo adActionInfo2 = new AdActionInfo();
            adActionInfo2.eAction = 8;
            adActionInfo2.sActionValue = "1";
            this.l.vAdActionInfo.add(adActionInfo2);
        }
    }

    @Override
    public void e() {
    }

    @Override
    public void f() {
    }

    @Override
    public void g() {
    }

    @Override
    public void h() {
    }

    @Override
    public void i() {
        if (this.l != null) {
            b("lplt");
        }
    }

    @Override
    public void onClick(View view) {
        StatManager b2;
        String str;
        EventCollector.getInstance().onViewClickedBefore(view);
        if (view == this.f66991c.e()) {
            m();
            b2 = StatManager.b();
            str = "AGNG2";
        } else {
            if (view != this.f66991c.a()) {
                if (view == this.f66991c.b()) {
                    d("back_from_left_button");
                } else if (view == this.f66991c.c()) {
                    new UrlParams(this.i).e();
                    b2 = StatManager.b();
                    str = "CNSP01";
                } else if (view == this.f66991c.d()) {
                    d("back_from_extra_button");
                }
                EventCollector.getInstance().onViewClicked(view);
            }
            c("back_from_left_button");
            b2 = StatManager.b();
            str = "AGNG1";
        }
        b2.c(str);
        EventCollector.getInstance().onViewClicked(view);
    }
}