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

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


package com.mbridge.msdk.mbbanner.common.bridge;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Base64;
import b.a.f.b;
import com.appsflyer.ServerParameters;
import com.google.android.exoplayer2.text.ttml.TtmlNode;
import com.mbridge.msdk.c.f;
import com.mbridge.msdk.foundation.db.j;
import com.mbridge.msdk.foundation.db.o;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.entity.m;
import com.mbridge.msdk.foundation.tools.ad;
import com.mbridge.msdk.foundation.tools.ae;
import com.mbridge.msdk.foundation.tools.d;
import com.mbridge.msdk.foundation.tools.v;
import com.mbridge.msdk.foundation.tools.z;
import com.mbridge.msdk.mbsignalcommon.windvane.g;
import com.safedk.android.analytics.brandsafety.BrandSafetyUtils;
import com.safedk.android.utils.Logger;
import com.safedk.android.utils.h;
import java.io.File;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.pubnative.lite.sdk.analytics.Reporting;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public final class a extends com.mbridge.msdk.mbsignalcommon.communication.a {
    private WeakReference<Context> f7842b;
    private List<CampaignEx> c;
    private String d;
    private String e;
    private int f;
    private com.mbridge.msdk.mbbanner.common.b.a g;
    private BannerExpandDialog h;
    private boolean i = false;

    public a(Context context, String str, String str2) {
        this.d = str;
        this.e = str2;
        this.f7842b = new WeakReference<>(context);
    }

    private static void a(Object obj, JSONObject jSONObject) {
        String str;
        String str2;
        String str3;
        String str4;
        String str5;
        int i;
        String str6;
        ?? jSONObject2 = new JSONObject();
        String str7 = "message";
        String str8 = b.f70a;
        int i2 = 1;
        if (jSONObject == null) {
            try {
                jSONObject2.put(b.f70a, 1);
                jSONObject2.put("message", "params is null");
                g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2));
                return;
            } catch (JSONException e) {
                z.a("BannerSignalCommunicationImpl", e.getMessage());
                return;
            }
        }
        try {
            jSONObject2.put(b.f70a, 0);
            jSONObject2.put("message", "");
            JSONArray jSONArray = jSONObject.getJSONArray("resource");
            if (jSONArray == null || jSONArray.length() <= 0) {
                str3 = "message";
                str2 = b.f70a;
                str = 1;
                try {
                    try {
                        jSONObject2.put(str2, 1);
                        str4 = str3;
                    } catch (Throwable th) {
                        th = th;
                        try {
                            jSONObject2.put(str2, 1);
                            jSONObject2.put(str, th.getLocalizedMessage());
                            g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2));
                            return;
                        } catch (JSONException e2) {
                            z.a("BannerSignalCommunicationImpl", e2.getMessage());
                            return;
                        }
                    }
                } catch (JSONException e3) {
                    e = e3;
                    str4 = str3;
                } catch (Throwable th2) {
                    th = th2;
                    str = str3;
                    jSONObject2.put(str2, 1);
                    jSONObject2.put(str, th.getLocalizedMessage());
                    g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2));
                    return;
                }
                try {
                    jSONObject2.put(str4, "resource is null");
                    g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2));
                    str = str4;
                } catch (JSONException e4) {
                    e = e4;
                    z.a("BannerSignalCommunicationImpl", e.getMessage());
                    str = str4;
                    return;
                }
                return;
            }
            ?? jSONArray2 = new JSONArray();
            int length = jSONArray.length();
            int i3 = 0;
            while (i3 < length) {
                JSONObject jSONObject3 = jSONArray.getJSONObject(i3);
                String optString = jSONObject3.optString("ref", "");
                int i4 = jSONObject3.getInt("type");
                ?? jSONObject4 = new JSONObject();
                JSONArray jSONArray3 = jSONArray;
                if (i4 != i2 || TextUtils.isEmpty(optString)) {
                    str3 = str7;
                    str5 = str8;
                    i = length;
                    if (i4 == 2 && !TextUtils.isEmpty(optString)) {
                        JSONObject jSONObject5 = new JSONObject();
                        jSONObject5.put("type", 2);
                        jSONObject5.put("path", com.mbridge.msdk.videocommon.download.g.a().a(optString) == null ? "" : com.mbridge.msdk.videocommon.download.g.a().b(optString));
                        jSONObject4.put(optString, jSONObject5);
                        jSONArray2.put(jSONObject4);
                    } else if (i4 == 3 && !TextUtils.isEmpty(optString)) {
                        File file = new File(optString);
                        if (file.exists() && file.isFile() && file.canRead()) {
                            z.a("BannerSignalCommunicationImpl", "getFileInfo Mraid file " + optString);
                            str6 = "file:////" + optString;
                        } else {
                            str6 = "";
                        }
                        JSONObject jSONObject6 = new JSONObject();
                        jSONObject6.put("type", 3);
                        jSONObject6.put("path", str6);
                        jSONObject4.put(optString, jSONObject6);
                        jSONArray2.put(jSONObject4);
                    } else if (i4 == 4 && !TextUtils.isEmpty(optString)) {
                        JSONObject jSONObject7 = new JSONObject();
                        jSONObject7.put("type", 4);
                        jSONObject7.put("path", ad.a(optString) == null ? "" : ad.a(optString));
                        jSONObject4.put(optString, jSONObject7);
                        jSONArray2.put(jSONObject4);
                    }
                } else {
                    JSONObject jSONObject8 = new JSONObject();
                    m a2 = o.a(com.mbridge.msdk.foundation.db.g.a(com.mbridge.msdk.foundation.controller.a.d().f())).a(optString);
                    if (a2 != null) {
                        i = length;
                        z.a("BannerSignalCommunicationImpl", "VideoBean not null");
                        jSONObject8.put("type", 1);
                        str3 = str7;
                        try {
                            jSONObject8.put("videoDataLength", a2.c());
                            String e5 = a2.e();
                            str5 = str8;
                            if (TextUtils.isEmpty(e5)) {
                                try {
                                    z.a("BannerSignalCommunicationImpl", "VideoPath null");
                                    jSONObject8.put("path", "");
                                    jSONObject8.put("path4Web", "");
                                } catch (Throwable th3) {
                                    th = th3;
                                    str = str3;
                                    str2 = str5;
                                    jSONObject2.put(str2, 1);
                                    jSONObject2.put(str, th.getLocalizedMessage());
                                    g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2));
                                    return;
                                }
                            } else {
                                z.a("BannerSignalCommunicationImpl", "VideoPath not null");
                                jSONObject8.put("path", e5);
                                jSONObject8.put("path4Web", e5);
                            }
                            if (a2.d() == 5) {
                                jSONObject8.put("downloaded", 1);
                            } else {
                                jSONObject8.put("downloaded", 0);
                            }
                            jSONObject4.put(optString, jSONObject8);
                            jSONArray2.put(jSONObject4);
                        } catch (Throwable th4) {
                            th = th4;
                            str2 = str8;
                            str = str3;
                            jSONObject2.put(str2, 1);
                            jSONObject2.put(str, th.getLocalizedMessage());
                            g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2));
                            return;
                        }
                    } else {
                        str3 = str7;
                        str5 = str8;
                        i = length;
                        z.a("BannerSignalCommunicationImpl", "VideoBean null");
                    }
                }
                i3++;
                jSONArray = jSONArray3;
                length = i;
                str7 = str3;
                str8 = str5;
                i2 = 1;
            }
            str3 = str7;
            str5 = str8;
            jSONObject2.put("resource", jSONArray2);
            g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2));
        } catch (Throwable th5) {
            th = th5;
            str = str7;
            str2 = str8;
        }
    }

    public static void safedk_Context_startActivity_97cb3195734cf5c9cc3418feeafa6dd6(Context context, Intent intent) {
        Logger.d("SafeDK-Special|SafeDK: Call> Landroid/content/Context;->startActivity(Landroid/content/Intent;)V");
        if (intent == null) {
            return;
        }
        BrandSafetyUtils.detectAdClick(intent, h.o);
        context.startActivity(intent);
    }

    public final void a() {
        if (this.g != null) {
            this.g = null;
        }
        if (this.h != null) {
            this.h = null;
        }
    }

    public final void a(int i) {
        this.f = i;
    }

    public final void a(com.mbridge.msdk.mbbanner.common.b.a aVar) {
        if (aVar != null) {
            this.g = aVar;
        }
    }

    @Override
    public final void a(Object obj, String str) {
        try {
            JSONObject jSONObject = new JSONObject();
            d dVar = new d(com.mbridge.msdk.foundation.controller.a.d().f());
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("dev_close_state", this.f);
            jSONObject.put("sdkSetting", jSONObject2);
            jSONObject.put(ServerParameters.DEVICE_KEY, dVar.a());
            jSONObject.put("campaignList", CampaignEx.parseCamplistToJson(this.c));
            f e = com.mbridge.msdk.c.d.a().e(com.mbridge.msdk.foundation.controller.a.d().g(), this.e);
            if (e == null) {
                e = f.d(this.e);
            }
            if (!TextUtils.isEmpty(this.d)) {
                e.g(this.d);
            }
            jSONObject.put("unitSetting", e.t());
            String c = com.mbridge.msdk.c.d.a().c(com.mbridge.msdk.foundation.controller.a.d().g());
            if (!TextUtils.isEmpty(c)) {
                jSONObject.put("appSetting", new JSONObject(c));
            }
            jSONObject.put("sdk_info", com.mbridge.msdk.mbsignalcommon.base.d.f8002a);
            z.d("BannerSignalCommunicationImpl", Reporting.EventType.SDK_INIT + jSONObject.toString());
            g.a().a(obj, Base64.encodeToString(jSONObject.toString().getBytes(), 2));
        } catch (Throwable th) {
            z.b("BannerSignalCommunicationImpl", Reporting.EventType.SDK_INIT, th);
        }
    }

    public final void a(List<CampaignEx> list) {
        this.c = list;
    }

    @Override
    public final void b(Object obj, String str) {
        z.d("BannerSignalCommunicationImpl", "click");
        try {
            if (this.c == null || TextUtils.isEmpty(str)) {
                return;
            }
            CampaignEx parseCampaignWithBackData = CampaignEx.parseCampaignWithBackData(new JSONObject(str).getJSONObject("pt"));
            com.mbridge.msdk.mbbanner.common.b.a aVar = this.g;
            if (aVar != null) {
                aVar.a(parseCampaignWithBackData);
            }
        } catch (Throwable th) {
            z.b("BannerSignalCommunicationImpl", "click", th);
        }
    }

    @Override
    public final void c(Object obj, String str) {
        if (obj != null) {
            try {
                int optInt = new JSONObject(str).optInt("isReady", 1);
                g.a().a(obj, com.mbridge.msdk.mbsignalcommon.communication.b.a(0));
                com.mbridge.msdk.mbbanner.common.b.a aVar = this.g;
                if (aVar != null) {
                    aVar.b(optInt);
                }
            } catch (Throwable th) {
                z.b("BannerSignalCommunicationImpl", "readyStatus", th);
            }
        }
    }

    @Override
    public final void close() {
        z.d("BannerSignalCommunicationImpl", "close");
        try {
            com.mbridge.msdk.mbbanner.common.b.a aVar = this.g;
            if (aVar != null) {
                aVar.a();
            }
        } catch (Throwable th) {
            z.b("BannerSignalCommunicationImpl", "close", th);
        }
    }

    @Override
    public final void d(Object obj, String str) {
        z.d("BannerSignalCommunicationImpl", "toggleCloseBtn");
        try {
            if (TextUtils.isEmpty(str)) {
                return;
            }
            int optInt = new JSONObject(str).optInt("state");
            com.mbridge.msdk.mbbanner.common.b.a aVar = this.g;
            if (aVar != null) {
                aVar.a(optInt);
            }
        } catch (Throwable th) {
            z.b("BannerSignalCommunicationImpl", "toggleCloseBtn", th);
        }
    }

    @Override
    public final void e(Object obj, String str) {
        z.d("BannerSignalCommunicationImpl", "triggerCloseBtn");
        try {
            if (TextUtils.isEmpty(str)) {
                return;
            }
            String optString = new JSONObject(str).optString("state");
            com.mbridge.msdk.mbbanner.common.b.a aVar = this.g;
            if (aVar != null) {
                aVar.a(optString);
            }
            g.a().a(obj, com.mbridge.msdk.mbsignalcommon.communication.b.a(0));
        } catch (Throwable th) {
            z.b("BannerSignalCommunicationImpl", "triggerCloseBtn", th);
            g.a().a(obj, com.mbridge.msdk.mbsignalcommon.communication.b.a(-1));
        }
    }

    @Override
    public final void expand(String str, boolean z) {
        Context context;
        String str2;
        try {
            String str3 = "";
            if (getMraidCampaign() != null) {
                if (TextUtils.isEmpty(getMraidCampaign().getBannerHtml())) {
                    str2 = getMraidCampaign().getBannerUrl();
                } else {
                    str2 = "file:////" + getMraidCampaign().getBannerHtml();
                }
                str3 = str2;
            }
            Bundle bundle = new Bundle();
            if (!TextUtils.isEmpty(str)) {
                str3 = str;
            }
            bundle.putString("url", str3);
            bundle.putBoolean("shouldUseCustomClose", z);
            WeakReference<Context> weakReference = this.f7842b;
            if (weakReference != null && (context = weakReference.get()) != null) {
                BannerExpandDialog bannerExpandDialog = this.h;
                if (bannerExpandDialog != null && bannerExpandDialog.isShowing()) {
                    return;
                }
                BannerExpandDialog bannerExpandDialog2 = new BannerExpandDialog(context, bundle, this.g);
                this.h = bannerExpandDialog2;
                bannerExpandDialog2.setCampaignList(this.e, this.c);
                this.h.show();
            }
            com.mbridge.msdk.mbbanner.common.b.a aVar = this.g;
            if (aVar != null) {
                aVar.a(true);
            }
            com.mbridge.msdk.mbbanner.common.d.a.a(this.e, getMraidCampaign(), str);
        } catch (Throwable th) {
            z.b("BannerSignalCommunicationImpl", "expand", th);
        }
    }

    @Override
    public final CampaignEx getMraidCampaign() {
        List<CampaignEx> list = this.c;
        if (list == null || list.size() <= 0) {
            return null;
        }
        return this.c.get(0);
    }

    @Override
    public final void i(Object obj, String str) {
        z.a("BannerSignalCommunicationImpl", "sendImpressions:" + str);
        try {
            if (TextUtils.isEmpty(str)) {
                return;
            }
            JSONArray jSONArray = new JSONArray(str);
            final ArrayList arrayList = new ArrayList();
            for (int i = 0; i < jSONArray.length(); i++) {
                String string = jSONArray.getString(i);
                for (CampaignEx campaignEx : this.c) {
                    if (campaignEx.getId().equals(string)) {
                        com.mbridge.msdk.foundation.same.a.d.a(this.e, campaignEx, "banner");
                        arrayList.add(string);
                    }
                }
            }
            new Thread(new Runnable() {
                @Override
                public final void run() {
                    try {
                        j a2 = j.a(com.mbridge.msdk.foundation.db.g.a(com.mbridge.msdk.foundation.controller.a.d().f()));
                        Iterator it = arrayList.iterator();
                        while (it.hasNext()) {
                            a2.b((String) it.next());
                        }
                    } catch (Exception e) {
                        z.d("BannerSignalCommunicationImpl", e.getMessage());
                    }
                }
            }).start();
        } catch (Throwable th) {
            z.b("BannerSignalCommunicationImpl", "sendImpressions", th);
        }
    }

    @Override
    public final void j(Object obj, String str) {
        if (TextUtils.isEmpty(str)) {
            com.mbridge.msdk.mbsignalcommon.communication.b.a(obj, "params is empty");
            return;
        }
        try {
            a(obj, new JSONObject(str));
        } catch (Throwable th) {
            z.a("BannerSignalCommunicationImpl", th.getMessage());
        }
    }

    @Override
    public final void k(Object obj, String str) {
        z.a("BannerSignalCommunicationImpl", "reportUrls:" + str);
        if (TextUtils.isEmpty(str)) {
            com.mbridge.msdk.mbsignalcommon.communication.b.a(obj, "params is null");
        } else if (!TextUtils.isEmpty(str)) {
            try {
                JSONArray jSONArray = new JSONArray(str);
                for (int i = 0; i < jSONArray.length(); i++) {
                    JSONObject jSONObject = jSONArray.getJSONObject(i);
                    int optInt = jSONObject.optInt("type");
                    String optString = jSONObject.optString("url");
                    String a2 = ae.a(optString, "&tun=", v.y() + "");
                    int optInt2 = jSONObject.optInt("report");
                    if (optInt2 == 0) {
                        Context f = com.mbridge.msdk.foundation.controller.a.d().f();
                        List<CampaignEx> list = this.c;
                        com.mbridge.msdk.click.a.a(f, list != null ? list.get(0) : null, "", a2, false, optInt != 0);
                    } else {
                        Context f2 = com.mbridge.msdk.foundation.controller.a.d().f();
                        List<CampaignEx> list2 = this.c;
                        com.mbridge.msdk.click.a.a(f2, list2 != null ? list2.get(0) : null, "", a2, false, optInt != 0, optInt2);
                    }
                }
                g.a().a(obj, com.mbridge.msdk.mbsignalcommon.communication.b.a(0));
            } catch (Throwable th) {
                z.b("BannerSignalCommunicationImpl", "reportUrls", th);
            }
        }
    }

    @Override
    public final void open(String str) {
        z.d("BannerSignalCommunicationImpl", TtmlNode.TEXT_EMPHASIS_MARK_OPEN);
        try {
            z.d("BannerSignalCommunicationImpl", str);
            if (this.c.size() > 1) {
                safedk_Context_startActivity_97cb3195734cf5c9cc3418feeafa6dd6(com.mbridge.msdk.foundation.controller.a.d().f(), new Intent("android.intent.action.VIEW", Uri.parse(str)));
                str = null;
            }
            com.mbridge.msdk.mbbanner.common.b.a aVar = this.g;
            if (aVar != null) {
                aVar.a(true, str);
            }
        } catch (Throwable th) {
            z.b("BannerSignalCommunicationImpl", TtmlNode.TEXT_EMPHASIS_MARK_OPEN, th);
        }
    }

    @Override
    public final void unload() {
        close();
    }

    @Override
    public final void useCustomClose(boolean z) {
        int i = z ? 2 : 1;
        try {
            com.mbridge.msdk.mbbanner.common.b.a aVar = this.g;
            if (aVar != null) {
                aVar.a(i);
            }
        } catch (Throwable th) {
            z.b("BannerSignalCommunicationImpl", "useCustomClose", th);
        }
    }
}