Cyber Surfer v5.2.5版本的 MD5 值为:db13c5fce988de393e52d2679f934b22

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


package com.bytedance.sdk.openadsdk.l;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewTreeObserver;
import android.webkit.ValueCallback;
import android.webkit.WebView;
import com.facebook.appevents.internal.ViewHierarchyConstants;
import com.facebook.internal.logging.monitor.MonitorLogServerProtocol;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.mbridge.msdk.mbbid.common.BidResponsedEx;
import com.safedk.android.analytics.brandsafety.creatives.infos.CreativeInfo;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import org.json.JSONObject;
public class g {
    private WeakReference<View> A;
    private e B;
    private com.bytedance.sdk.openadsdk.l.a C;
    private c D;
    private String H;
    private String I;
    private String J;
    private JSONObject L;
    private String M;
    private JSONObject N;
    private float O;
    private int P;
    private int Q;
    private int R;
    private int S;
    private int T;
    private int U;
    private int V;
    private int W;
    private int X;
    private int Y;
    private String Z;
    private boolean aa;
    private boolean ab;
    private boolean ac;
    private boolean ad;
    private String ae;
    private String af;
    private Runnable f3103b;
    private Runnable c;
    private TimerTask e;
    private b f;
    private Context y;
    private WebView z;
    private final Handler f3102a = new Handler(Looper.getMainLooper());
    private Timer d = new Timer();
    private boolean g = true;
    private Set<String> h = new HashSet(Arrays.asList("adInfo", "appInfo", "subscribe_app_ad", "download_app_ad"));
    private String i = null;
    private String j = "embeded_ad";
    private boolean k = true;
    private boolean l = true;
    private boolean m = true;
    private long n = 10;
    private long o = 10;
    private long p = 0;
    private long q = 0;
    private long r = -1;
    private long s = -1;
    private long t = -1;
    private long u = -1;
    private int v = 0;
    private int w = 0;
    private int E = 0;
    private int F = 0;
    private JSONObject G = new JSONObject();
    private Map<String, String> K = new HashMap();
    private boolean ag = false;
    private ViewTreeObserver.OnGlobalLayoutListener ah = new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            try {
                View view = (View) g.this.A.get();
                if (view == null) {
                    return;
                }
                g.this.b(view);
            } catch (Throwable th) {
                f.a("PlayablePlugin", "onSizeChanged error", th);
            }
        }
    };
    private a x = a.MAIN;

    public class AnonymousClass4 extends TimerTask {
        AnonymousClass4() {
        }

        @Override
        public void run() {
            g.this.f3102a.post(new Runnable() {
                @Override
                public void run() {
                    if (g.this.z != null) {
                        g.this.z.evaluateJavascript("javascript:playable_callJS()", new ValueCallback<String>() {
                            @Override
                            public void onReceiveValue(String str) {
                                if (g.this.f != null) {
                                    g.this.f.a(System.currentTimeMillis());
                                }
                            }
                        });
                    }
                }
            });
        }
    }

    public enum a {
        MAIN,
        RIFLE
    }

    private g(Context context, WebView webView, c cVar, com.bytedance.sdk.openadsdk.l.a aVar) {
        this.z = webView;
        h.a(webView);
        a(webView);
        a(context, cVar, aVar);
        x();
    }

    public static g a(Context context, WebView webView, c cVar, com.bytedance.sdk.openadsdk.l.a aVar) {
        if (webView == null || cVar == null || aVar == null) {
            return null;
        }
        return new g(context, webView, cVar, aVar);
    }

    private void a(Context context, c cVar, com.bytedance.sdk.openadsdk.l.a aVar) {
        this.i = UUID.randomUUID().toString();
        this.y = context;
        this.B = new e(this);
        this.C = aVar;
        this.D = cVar;
    }

    private String b(String str, String str2) {
        return String.format("rubeex://playable-lynx?accessKey=%1s&groupId=%2s&cardId=main", str, str2);
    }

    private void b(int i, String str) {
        if (this.C == null || !y()) {
            return;
        }
        this.C.a(i, str);
    }

    public void b(View view) {
        if (view == null) {
            return;
        }
        try {
            if (this.E == view.getWidth() && this.F == view.getHeight()) {
                return;
            }
            this.E = view.getWidth();
            this.F = view.getHeight();
            JSONObject jSONObject = new JSONObject();
            jSONObject.put(ViewHierarchyConstants.DIMENSION_WIDTH_KEY, this.E);
            jSONObject.put(ViewHierarchyConstants.DIMENSION_HEIGHT_KEY, this.F);
            a("resize", jSONObject);
            this.G = jSONObject;
        } catch (Throwable th) {
            f.a("PlayablePlugin", "resetViewDataJsonByView error", th);
        }
    }

    private void d(String str, JSONObject jSONObject) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        if (jSONObject == null) {
            jSONObject = new JSONObject();
        }
        try {
            jSONObject.put("playable_event", str);
            jSONObject.put("playable_ts", System.currentTimeMillis());
            jSONObject.put("playable_viewable", this.ab);
            jSONObject.put("playable_session_id", this.i);
            if (this.x == a.MAIN) {
                jSONObject.put("playable_url", this.M);
            } else {
                jSONObject.put("playable_url", b(this.ae, this.af));
            }
            jSONObject.put("playable_is_prerender", this.ad);
            jSONObject.put("playable_render_type", this.x.ordinal());
            jSONObject.put("playable_sdk_version", "5.2.2");
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("ad_extra_data", jSONObject);
            jSONObject2.put(ViewHierarchyConstants.TAG_KEY, this.j);
            jSONObject2.put("nt", 4);
            jSONObject2.put(MonitorLogServerProtocol.PARAM_CATEGORY, "umeng");
            jSONObject2.put("is_ad_event", "1");
            jSONObject2.put("refer", CreativeInfo.u);
            jSONObject2.put("value", this.L.opt(BidResponsedEx.KEY_CID));
            jSONObject2.put("log_extra", this.L.opt("log_extra"));
            if (this.C == null) {
                f.a("PlayablePlugin", "reportEvent error no impl");
            } else if (this.x == a.MAIN && y()) {
                f.a("PlayablePlugin", "reportEvent by ActionProxy");
                this.C.a("playable_track", jSONObject2);
                this.C.a(jSONObject);
            } else if (this.x == a.MAIN) {
                f.a("PlayablePlugin", "reportEvent error no not playable url");
            } else {
                f.a("PlayablePlugin", "reportEvent by ActionProxy");
                this.C.a("playable_track", jSONObject2);
                this.C.a(jSONObject);
            }
        } catch (Throwable th) {
            f.a("PlayablePlugin", "reportEvent error", th);
        }
    }

    static int h(g gVar) {
        int i = gVar.v;
        gVar.v = i + 1;
        return i;
    }

    static int i(g gVar) {
        int i = gVar.w;
        gVar.w = i + 1;
        return i;
    }

    private void x() {
        this.f = new b(this);
        this.f3103b = new Runnable() {
            @Override
            public void run() {
                if (g.this.l) {
                    g.this.l = false;
                    g.this.f3102a.removeCallbacks(g.this.c);
                    g.this.a(2, "ContainerLoadTimeOut");
                }
            }
        };
        this.c = new Runnable() {
            @Override
            public void run() {
                if (g.this.l) {
                    g.this.l = false;
                    g.this.f3102a.removeCallbacks(g.this.f3103b);
                    g.this.a(3, "JSSDKLoadTimeOut");
                }
            }
        };
        this.e = new AnonymousClass4();
    }

    private boolean y() {
        String str = this.M;
        if (str != null) {
            return str.contains("/union-fe/playable/") || this.M.contains("/union-fe-sg/playable/") || this.M.contains("/union-fe-i18n/playable/");
        }
        return false;
    }

    public Context a() {
        return this.y;
    }

    public g a(String str) {
        this.H = str;
        return this;
    }

    public g a(String str, String str2) {
        this.K.put(str, str2);
        return this;
    }

    public g a(JSONObject jSONObject) {
        this.L = jSONObject;
        return this;
    }

    public g a(boolean z) {
        this.aa = z;
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("endcard_mute", this.aa);
            a("volumeChange", jSONObject);
        } catch (Throwable th) {
            f.a("PlayablePlugin", "setIsMute error", th);
        }
        return this;
    }

    protected void a(int i, String str) {
        b(i, str);
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("playable_code", i);
            jSONObject.put("playable_msg", str);
        } catch (Throwable th) {
            f.a("PlayablePlugin", "reportRenderFatal error", th);
        }
        d("PL_sdk_global_faild", jSONObject);
    }

    public void a(int i, String str, String str2) {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put(IronSourceConstants.EVENTS_ERROR_CODE, i);
            jSONObject.put("description", str);
            jSONObject.put("failingUrl", str2);
        } catch (Throwable th) {
            f.a("PlayablePlugin", "onWebReceivedError error", th);
        }
        d("PL_sdk_html_load_error", jSONObject);
        if (this.l) {
            this.l = false;
            this.f3102a.removeCallbacks(this.f3103b);
            this.f3102a.removeCallbacks(this.c);
            a(1, "ContainerLoadFail");
        }
    }

    public void a(View view) {
        if (view == null) {
            return;
        }
        try {
            this.A = new WeakReference<>(view);
            b(view);
            view.getViewTreeObserver().addOnGlobalLayoutListener(this.ah);
        } catch (Throwable th) {
            f.a("PlayablePlugin", "setViewForScreenSize error", th);
        }
    }

    public void a(String str, JSONObject jSONObject) {
        if (f.a()) {
            StringBuilder sb = new StringBuilder("CALL JS [");
            sb.append(str);
            sb.append("] ");
            sb.append(jSONObject != null ? jSONObject.toString() : "");
            f.a("PlayablePlugin", sb.toString());
        }
        c cVar = this.D;
        if (cVar != null) {
            cVar.a(str, jSONObject);
        }
    }

    public void a(boolean z, String str, int i) {
        if (z) {
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put(IronSourceConstants.EVENTS_ERROR_CODE, i);
                jSONObject.put("failingUrl", str);
            } catch (Throwable th) {
                f.a("PlayablePlugin", "onWebReceivedHttpError error", th);
            }
            d("PL_sdk_html_load_error", jSONObject);
            if (this.l) {
                this.l = false;
                this.f3102a.removeCallbacks(this.f3103b);
                this.f3102a.removeCallbacks(this.c);
                a(1, "ContainerLoadFail");
            }
        }
    }

    public g b(String str) {
        this.I = str;
        return this;
    }

    public g b(boolean z) {
        if (this.ab == z) {
            return this;
        }
        this.ab = z;
        d(z ? "PL_sdk_viewable_true" : "PL_sdk_viewable_false", null);
        if (this.s == -1 && this.ab) {
            this.s = System.currentTimeMillis();
            d("PL_sdk_page_show", null);
        }
        if (this.ab) {
            this.r = System.currentTimeMillis();
        } else if (this.r != -1) {
            long currentTimeMillis = System.currentTimeMillis() - this.r;
            f.a("PlayablePlugin", "playable show time +" + currentTimeMillis);
            this.p = this.p + currentTimeMillis;
            this.r = -1L;
        }
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("viewStatus", this.ab);
            a("viewableChange", jSONObject);
        } catch (Throwable th) {
            f.a("PlayablePlugin", "setViewable error", th);
        }
        return this;
    }

    public Map<String, String> b() {
        return this.K;
    }

    public void b(String str, JSONObject jSONObject) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        d(str, jSONObject);
    }

    public void b(JSONObject jSONObject) {
        if (jSONObject == null || jSONObject.optBoolean("success", true) || !this.l) {
            return;
        }
        this.l = false;
        this.f3102a.removeCallbacks(this.f3103b);
        this.f3102a.removeCallbacks(this.c);
        a(4, "CaseRenderFail");
    }

    public g c(String str) {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("playable_style", str);
            this.N = jSONObject;
        } catch (Throwable th) {
            f.a("PlayablePlugin", "setPlayableStyle error", th);
        }
        return this;
    }

    public g c(boolean z) {
        this.ac = z;
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("send_click", this.ac);
            a("change_playable_click", jSONObject);
        } catch (Throwable th) {
            f.a("PlayablePlugin", "setPlayableClick error", th);
        }
        return this;
    }

    public JSONObject c() {
        return this.N;
    }

    public JSONObject c(String str, JSONObject jSONObject) {
        long currentTimeMillis = System.currentTimeMillis();
        if (f.a()) {
            StringBuilder sb = new StringBuilder("PlayablePlugin JSB-REQ [");
            sb.append(str);
            sb.append("] ");
            sb.append(jSONObject != null ? jSONObject.toString() : "");
            f.a("PlayablePlugin", sb.toString());
        }
        JSONObject a2 = this.B.a(str, jSONObject);
        if (f.a()) {
            StringBuilder sb2 = new StringBuilder("PlayablePlugin JSB-RSP [");
            sb2.append(str);
            sb2.append("] time:");
            sb2.append(System.currentTimeMillis() - currentTimeMillis);
            sb2.append(" ");
            sb2.append(a2 != null ? a2.toString() : "");
            f.a("PlayablePlugin", sb2.toString());
        }
        return a2;
    }

    public void c(JSONObject jSONObject) {
        this.C.d(jSONObject);
    }

    public g d(String str) {
        this.J = str;
        return this;
    }

    public String d() {
        return this.I;
    }

    public void d(JSONObject jSONObject) {
        this.C.e(jSONObject);
    }

    public g e(String str) {
        this.Z = str;
        return this;
    }

    public String e() {
        return this.H;
    }

    public void e(JSONObject jSONObject) {
        this.C.f(jSONObject);
    }

    public g f(String str) {
        if (str != null) {
            try {
                int indexOf = str.indexOf("?");
                if (indexOf != -1) {
                    str = str.substring(0, indexOf);
                }
            } catch (Throwable unused) {
            }
        }
        this.M = str;
        return this;
    }

    public String f() {
        return this.J;
    }

    public String g() {
        return this.Z;
    }

    public void g(String str) {
        JSONObject jSONObject = new JSONObject();
        try {
            this.t = System.currentTimeMillis();
            jSONObject.put("playable_full_url", str);
            long j = this.s;
            jSONObject.put("playable_page_show_duration", j != -1 ? this.t - j : 0L);
        } catch (Throwable th) {
            f.a("PlayablePlugin", "reportUrlLoadStart error", th);
        }
        d("PL_sdk_html_load_start", jSONObject);
        if (this.k && this.x == a.MAIN) {
            this.f3102a.postDelayed(this.f3103b, this.n * 1000);
            this.f3102a.postDelayed(this.c, this.o * 1000);
            this.k = false;
        }
    }

    public void h(String str) {
        b bVar;
        JSONObject jSONObject = new JSONObject();
        try {
            this.u = System.currentTimeMillis();
            jSONObject.put("playable_full_url", str);
            long j = this.t;
            jSONObject.put("playable_html_load_start_duration", j != -1 ? this.u - j : 0L);
        } catch (Throwable th) {
            f.a("PlayablePlugin", "reportUrlLoadFinish error", th);
        }
        d("PL_sdk_html_load_finish", jSONObject);
        this.f3102a.removeCallbacks(this.f3103b);
        if (this.g) {
            this.g = false;
            this.z.evaluateJavascript(w(), new ValueCallback<String>() {
                @Override
                public void onReceiveValue(String str2) {
                    f.a("Playable_CrashMonitor", "load inject js=" + str2);
                }
            });
        }
        try {
            if (this.x == a.MAIN && this.m && (bVar = this.f) != null) {
                this.m = false;
                bVar.a(System.currentTimeMillis());
                this.d.schedule(this.e, 0L, 1500L);
                this.f.a(1000);
            }
        } catch (Throwable th2) {
            f.a("PlayablePlugin", "crashMonitor error", th2);
        }
    }

    public boolean h() {
        return this.aa;
    }

    public void i(String str) {
        this.f3102a.post(new Runnable() {
            @Override
            public void run() {
                g.h(g.this);
            }
        });
    }

    public boolean i() {
        return this.ab;
    }

    public Set<String> j() {
        return this.B.a();
    }

    public void j(String str) {
        this.f3102a.post(new Runnable() {
            @Override
            public void run() {
                g.i(g.this);
            }
        });
    }

    public d k() {
        return this.C.a();
    }

    public com.bytedance.sdk.openadsdk.l.a l() {
        return this.C;
    }

    public JSONObject m() {
        return this.G;
    }

    public JSONObject n() {
        return this.L;
    }

    public JSONObject o() {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("devicePixelRatio", this.O);
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put(ViewHierarchyConstants.DIMENSION_WIDTH_KEY, this.P);
            jSONObject2.put(ViewHierarchyConstants.DIMENSION_HEIGHT_KEY, this.Q);
            jSONObject.put("screen", jSONObject2);
            JSONObject jSONObject3 = new JSONObject();
            jSONObject3.put("x", this.S);
            jSONObject3.put("y", this.R);
            jSONObject3.put(ViewHierarchyConstants.DIMENSION_WIDTH_KEY, this.T);
            jSONObject3.put(ViewHierarchyConstants.DIMENSION_HEIGHT_KEY, this.U);
            jSONObject.put("webview", jSONObject3);
            JSONObject jSONObject4 = new JSONObject();
            jSONObject4.put("x", this.W);
            jSONObject4.put("y", this.V);
            jSONObject4.put(ViewHierarchyConstants.DIMENSION_WIDTH_KEY, this.X);
            jSONObject4.put(ViewHierarchyConstants.DIMENSION_HEIGHT_KEY, this.Y);
            jSONObject.put("visible", jSONObject4);
        } catch (Throwable th) {
            f.a("PlayablePlugin", "getViewport error", th);
        }
        return jSONObject;
    }

    public void p() {
        this.C.b();
    }

    public void q() {
    }

    public void r() {
    }

    public void s() {
        this.f3102a.removeCallbacks(this.f3103b);
        this.f3102a.removeCallbacks(this.c);
    }

    public void t() {
        f.a("Playable_CrashMonitor", "-- Detected that the page is stuck for more than 2s and needs to be reported");
        d("PL_sdk_page_stuck", null);
        Timer timer = this.d;
        if (timer != null) {
            timer.cancel();
        }
    }

    public void u() {
        this.O = 0.0f;
        this.P = 0;
        this.Q = 0;
        this.R = 0;
        this.S = 0;
        this.T = 0;
        this.U = 0;
        this.V = 0;
        this.W = 0;
        this.X = 0;
        this.Y = 0;
    }

    public void v() {
        if (this.ag) {
            return;
        }
        this.ag = true;
        this.q = 0L;
        u();
        try {
            View view = this.A.get();
            if (view != null) {
                view.getViewTreeObserver().removeOnGlobalLayoutListener(this.ah);
            }
        } catch (Throwable unused) {
        }
        try {
            this.B.b();
        } catch (Throwable unused2) {
        }
        try {
            Timer timer = this.d;
            if (timer != null) {
                timer.cancel();
            }
            b bVar = this.f;
            if (bVar != null) {
                bVar.a();
                this.f = null;
            }
        } catch (Throwable th) {
            f.a("Playable_CrashMonitor", "crash -- " + th);
        }
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("playable_all_times", this.v);
            jSONObject.put("playable_hit_times", this.w);
            d("PL_sdk_preload_times", jSONObject);
        } catch (Throwable unused3) {
        }
        try {
            if (this.r != -1) {
                long currentTimeMillis = System.currentTimeMillis() - this.r;
                f.a("PlayablePlugin", "playable show time +" + currentTimeMillis);
                this.p = this.p + currentTimeMillis;
                this.r = -1L;
            }
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("playable_user_play_duration", this.p);
            d("PL_sdk_user_play_duration", jSONObject2);
        } catch (Throwable unused4) {
        }
    }

    public String w() {
        return "function playable_callJS(){return \"Android call the JS method is callJS\";}";
    }
}