Idle Egg Factory v2.1.5版本的 MD5 值为:7d2ba6677008ca521af0101bb927d72a

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


package com.mbridge.msdk.foundation.controller;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import com.iab.omid.library.mmadbridge.Omid;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.MBridgeSDK;
import com.mbridge.msdk.foundation.controller.a;
import com.mbridge.msdk.foundation.db.g;
import com.mbridge.msdk.foundation.db.m;
import com.mbridge.msdk.foundation.entity.k;
import com.mbridge.msdk.foundation.same.b.c;
import com.mbridge.msdk.foundation.same.b.e;
import com.mbridge.msdk.foundation.same.net.n;
import com.mbridge.msdk.foundation.same.report.d;
import com.mbridge.msdk.foundation.tools.FastKV;
import com.mbridge.msdk.foundation.tools.q;
import com.mbridge.msdk.foundation.tools.r;
import com.mbridge.msdk.foundation.tools.t;
import com.mbridge.msdk.foundation.tools.v;
import com.mbridge.msdk.foundation.tools.y;
import com.mbridge.msdk.out.Frame;
import com.mbridge.msdk.out.MBridgeSDKFactory;
import com.safedk.android.analytics.brandsafety.creatives.discoveries.h;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;

public final class b {
    private static b h;
    private Context i;
    private String j;
    private String k;
    private String l;
    private String m;
    private com.mbridge.msdk.b.a o;
    private String p;
    private Map<String, Object> t;
    private int u;
    private boolean n = false;

    public final int f5908a = 1;
    public final int b = 2;
    public final int c = 3;
    public final int d = 4;
    public final int e = 5;
    public final int f = 6;
    private boolean q = false;
    private AtomicBoolean r = null;
    private FastKV s = null;
    Handler g = new Handler(Looper.getMainLooper()) {
        @Override
        public final void handleMessage(Message message) {
            List list;
            try {
                int i = message.what;
                if (i == 2) {
                    if (!(message.obj instanceof List) || (list = (List) message.obj) == null || list.size() <= 0) {
                        return;
                    }
                    d dVar = new d(b.this.i, 0);
                    for (int i2 = 0; i2 < list.size(); i2++) {
                        k kVar = (k) list.get(i2);
                        boolean z = false;
                        if (i2 == list.size() - 1) {
                            z = true;
                        }
                        dVar.a(kVar, z);
                    }
                    return;
                }
                if (i == 3) {
                    File file = (File) message.obj;
                    if (file != null) {
                        String a2 = t.a(file);
                        if (TextUtils.isEmpty(a2)) {
                            return;
                        }
                        String[] split = a2.split("====");
                        if (split.length > 0) {
                            new d(b.this.i).a(split[0], file);
                            return;
                        }
                        return;
                    }
                    return;
                }
                if (i == 4) {
                    String str = (String) message.obj;
                    if (TextUtils.isEmpty(str)) {
                        return;
                    }
                    if (com.mbridge.msdk.foundation.same.report.b.a().c()) {
                        com.mbridge.msdk.foundation.same.report.b.a().a(str);
                        return;
                    } else {
                        new d(b.this.i, 0).a("click_duration", str, (String) null, (Frame) null);
                        return;
                    }
                }
                if (i == 5) {
                    String str2 = (String) message.obj;
                    if (TextUtils.isEmpty(str2)) {
                        return;
                    }
                    if (com.mbridge.msdk.foundation.same.report.b.a().c()) {
                        com.mbridge.msdk.foundation.same.report.b.a().a(str2);
                        return;
                    } else {
                        new d(b.this.i, 0).a("load_duration", str2, (String) null, (Frame) null);
                        return;
                    }
                }
                if (i != 6) {
                    if (i == 9 && ((com.mbridge.msdk.c.a) message.obj).H() == 1) {
                        com.mbridge.msdk.foundation.same.report.b.a.a(b.this.i).a();
                        return;
                    }
                    return;
                }
                if (message.obj == null || !(message.obj instanceof String)) {
                    return;
                }
                String str3 = (String) message.obj;
                if (TextUtils.isEmpty(str3)) {
                    return;
                }
                if (com.mbridge.msdk.foundation.same.report.b.a().c()) {
                    com.mbridge.msdk.foundation.same.report.b.a().a(str3);
                } else {
                    new d(b.this.i, 0).a("device_data", str3, (String) null, (Frame) null);
                }
            } catch (Exception e) {
                v.d("SDKController", e.getMessage());
            }
        }
    };

    private b() {
    }

    public static synchronized b a() {
        b bVar;
        synchronized (b.class) {
            if (h == null) {
                h = new b();
            }
            bVar = h;
        }
        return bVar;
    }

    public final void a(Map map, final Context context) {
        String str;
        String str2;
        List<com.mbridge.msdk.foundation.entity.a> b;
        Object newInstance;
        Class<?> cls;
        Object newInstance2;
        String str3 = "";
        if (context != null) {
            if (map.containsKey(MBridgeConstans.ID_MBRIDGE_APPID)) {
                this.k = (String) map.get(MBridgeConstans.ID_MBRIDGE_APPID);
            }
            this.i = context.getApplicationContext();
            a.d().b(this.i);
            try {
                String str4 = (String) map.get(MBridgeConstans.ID_MBRIDGE_APPID);
                if (!TextUtils.isEmpty(str4)) {
                    com.mbridge.msdk.foundation.a.a.a.a().a(MBridgeConstans.SDK_APP_ID, str4);
                }
            } catch (Exception e) {
                e.printStackTrace();
            } catch (Throwable th) {
                th.printStackTrace();
            }
            try {
                n.a(this.i);
            } catch (Exception unused) {
            }
            if (this.n) {
                new d(context).a();
                return;
            }
            r.n(context);
            if (map != null) {
                if (map.containsKey(MBridgeConstans.ID_MBRIDGE_APPID)) {
                    this.k = (String) map.get(MBridgeConstans.ID_MBRIDGE_APPID);
                }
                if (map.containsKey(MBridgeConstans.ID_MBRIDGE_APPKEY)) {
                    this.l = (String) map.get(MBridgeConstans.ID_MBRIDGE_APPKEY);
                }
                if (map.containsKey(MBridgeConstans.ID_MBRIDGE_WX_APPID)) {
                    this.m = (String) map.get(MBridgeConstans.ID_MBRIDGE_WX_APPID);
                }
                if (map.containsKey(MBridgeConstans.PACKAGE_NAME_MANIFEST)) {
                    this.p = (String) map.get(MBridgeConstans.PACKAGE_NAME_MANIFEST);
                }
                if (map.containsKey(MBridgeConstans.ID_MBRIDGE_STARTUPCRASH)) {
                    this.j = (String) map.get(MBridgeConstans.ID_MBRIDGE_STARTUPCRASH);
                }
                try {
                    com.mbridge.msdk.c.a b2 = com.mbridge.msdk.c.b.a().b(a.d().g());
                    if (b2 != null && (b = b2.b()) != null && b.size() > 0) {
                        for (com.mbridge.msdk.foundation.entity.a aVar : b) {
                            if (aVar.a() == 287) {
                                Class<?> cls2 = Class.forName("com.mbridge.msdk.interstitialvideo.out.MBInterstitialVideoHandler");
                                if (this.i != null && cls2 != null && (newInstance = cls2.getConstructor(String.class, String.class).newInstance("", aVar.b())) != null) {
                                    cls2.getMethod("loadFormSelfFilling", new Class[0]).invoke(newInstance, new Object[0]);
                                }
                            } else if (aVar.a() == 94 && (cls = Class.forName("com.mbridge.msdk.out.MBRewardVideoHandler")) != null && (newInstance2 = cls.getConstructor(String.class, String.class).newInstance("", aVar.b())) != null) {
                                cls.getMethod("loadFormSelfFilling", new Class[0]).invoke(newInstance2, new Object[0]);
                            }
                        }
                    }
                } catch (Throwable th2) {
                    if (MBridgeConstans.DEBUG) {
                        th2.printStackTrace();
                    }
                }
                a.d().b(this.k);
                a.d().d(this.l);
                a.d().c(this.m);
                a.d().a(this.p);
                a.d().a(new a.b() {
                }, this.g);
                Context applicationContext = this.i.getApplicationContext();
                try {
                    Omid.activate(applicationContext);
                    if (!Omid.isActive()) {
                        new d(applicationContext, 0).a("", "", "", "", "activate om failed");
                    }
                } catch (IllegalArgumentException e2) {
                    v.a("SDKController", e2.getMessage(), e2);
                }
                Context applicationContext2 = this.i.getApplicationContext();
                try {
                    if (d() && this.s == null) {
                        try {
                            this.s = new FastKV.Builder(e.b(c.MBRIDGE_700_CONFIG), q.b("H+tU+FeXHM==")).build();
                        } catch (Exception unused2) {
                            this.s = null;
                        }
                    }
                    if (this.s != null) {
                        try {
                            str = this.s.getString(q.b("H+tU+bfPhM=="), "");
                            try {
                                str3 = this.s.getString(q.b("H+tU+Fz8"), "");
                            } catch (Exception unused3) {
                            }
                        } catch (Exception unused4) {
                            str = "";
                        }
                        if (TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.l) && TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.m)) {
                            com.mbridge.msdk.foundation.same.a.l = com.mbridge.msdk.foundation.a.a.a.a().b("b");
                            com.mbridge.msdk.foundation.same.a.m = com.mbridge.msdk.foundation.a.a.a.a().b(h.r);
                        }
                        if (TextUtils.isEmpty(str) && TextUtils.isEmpty(str3)) {
                            if (!TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.l) || !TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.m)) {
                                try {
                                    this.s.putString(q.b("H+tU+bfPhM=="), com.mbridge.msdk.foundation.same.a.l);
                                    this.s.putString(q.b("H+tU+Fz8"), com.mbridge.msdk.foundation.same.a.m);
                                } catch (Exception unused5) {
                                }
                            }
                        } else {
                            com.mbridge.msdk.foundation.same.a.l = str;
                            com.mbridge.msdk.foundation.same.a.m = str3;
                            com.mbridge.msdk.foundation.a.a.a.a().a("b", com.mbridge.msdk.foundation.same.a.l);
                            com.mbridge.msdk.foundation.a.a.a.a().a(h.r, com.mbridge.msdk.foundation.same.a.m);
                        }
                    } else {
                        SharedPreferences sharedPreferences = applicationContext2.getSharedPreferences(q.b("H+tU+FeXHM=="), 0);
                        if (sharedPreferences != null) {
                            String string = sharedPreferences.getString(q.b("H+tU+bfPhM=="), "");
                            str2 = sharedPreferences.getString(q.b("H+tU+Fz8"), "");
                            str3 = string;
                        } else {
                            str2 = "";
                        }
                        if (TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.l) && TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.m)) {
                            com.mbridge.msdk.foundation.same.a.l = com.mbridge.msdk.foundation.a.a.a.a().b("b");
                            com.mbridge.msdk.foundation.same.a.m = com.mbridge.msdk.foundation.a.a.a.a().b(h.r);
                        }
                        if (TextUtils.isEmpty(str3) && TextUtils.isEmpty(str2)) {
                            if ((!TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.l) || !TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.m)) && sharedPreferences != null) {
                                SharedPreferences.Editor edit = sharedPreferences.edit();
                                edit.putString(q.b("H+tU+bfPhM=="), com.mbridge.msdk.foundation.same.a.l);
                                edit.putString(q.b("H+tU+Fz8"), com.mbridge.msdk.foundation.same.a.m);
                                edit.apply();
                            }
                        } else {
                            com.mbridge.msdk.foundation.same.a.l = str3;
                            com.mbridge.msdk.foundation.same.a.m = str2;
                            com.mbridge.msdk.foundation.a.a.a.a().a("b", com.mbridge.msdk.foundation.same.a.l);
                            com.mbridge.msdk.foundation.a.a.a.a().a(h.r, com.mbridge.msdk.foundation.same.a.m);
                        }
                    }
                } catch (Throwable th3) {
                    v.a("SDKController", th3.getMessage(), th3);
                }
                try {
                    if (MBridgeConstans.INIT_UA_IN) {
                        com.mbridge.msdk.foundation.same.f.b.a().execute(new Runnable() {
                            @Override
                            public final void run() {
                                Looper.prepare();
                                b.this.e();
                                b bVar = b.this;
                                b.a(bVar, bVar.k);
                                Looper.loop();
                            }
                        });
                    } else if (Looper.myLooper() == Looper.getMainLooper()) {
                        com.mbridge.msdk.foundation.same.f.b.a().execute(new Runnable() {
                            @Override
                            public final void run() {
                                Looper.prepare();
                                b.this.e();
                                Looper.loop();
                            }
                        });
                    } else {
                        e();
                    }
                } catch (Exception e3) {
                    v.d("SDKController", e3.getMessage());
                }
                c();
                y.a(this.i);
                this.n = true;
            }
            long h2 = com.mbridge.msdk.c.b.a().g(this.k).h();
            if (h2 != 1300) {
                this.g.postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        r.m(context);
                    }
                }, h2);
            }
        }
    }

    public void e() {
        try {
            Class<?> cls = Class.forName("com.mbridge.msdk.d.b");
            cls.getDeclaredMethod("start", new Class[0]).invoke(cls.getMethod("getInstance", new Class[0]).invoke(null, new Object[0]), new Object[0]);
        } catch (Throwable th) {
            v.a("SDKController", th.getMessage(), th);
        }
    }

    public final void b() {
        Handler handler = this.g;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
        }
    }

    public final void c() {
        new Thread(new Runnable() {
            @Override
            public final void run() {
                List<k> a2;
                com.mbridge.msdk.foundation.db.d a3;
                com.mbridge.msdk.foundation.db.k a4;
                File file;
                try {
                    com.mbridge.msdk.foundation.same.report.c.a.a();
                    Context context = b.this.i;
                    String str = null;
                    if (context != null && m.a(g.a(context)).a() > 0) {
                        a2 = m.a(g.a(context)).a(5);
                        if (a2 != null && a2.size() > 0) {
                            Message obtainMessage = b.this.g.obtainMessage();
                            obtainMessage.what = 2;
                            obtainMessage.obj = a2;
                            b.this.g.sendMessage(obtainMessage);
                        }
                        g a5 = g.a(b.this.i);
                        a3 = com.mbridge.msdk.foundation.db.d.a(a5);
                        if (a3.a() >= 20) {
                            String a6 = com.mbridge.msdk.foundation.entity.d.a(a3.a(20));
                            Message obtain = Message.obtain();
                            obtain.obj = a6;
                            obtain.what = 4;
                            b.this.g.sendMessage(obtain);
                        }
                        a4 = com.mbridge.msdk.foundation.db.k.a(a5);
                        if (a4.a() > 20) {
                            List<com.mbridge.msdk.foundation.entity.g> a7 = a4.a(20);
                            if (a7 != null && a7.size() > 0) {
                                StringBuffer stringBuffer = new StringBuffer();
                                for (com.mbridge.msdk.foundation.entity.g gVar : a7) {
                                    if (com.mbridge.msdk.foundation.controller.authoritycontroller.a.a().a(MBridgeConstans.AUTHORITY_GENERAL_DATA)) {
                                        stringBuffer.append("ad_source_id=" + gVar.b());
                                        stringBuffer.append("&time=" + gVar.c());
                                        stringBuffer.append("&num=" + gVar.d());
                                        stringBuffer.append("&unit_id=" + gVar.e());
                                        stringBuffer.append("&key=2000006");
                                        stringBuffer.append("&fb=" + gVar.f());
                                        stringBuffer.append("&network_str=" + gVar.i());
                                        stringBuffer.append("&network_type=" + gVar.h());
                                    } else {
                                        stringBuffer.append("ad_source_id=" + gVar.b());
                                        stringBuffer.append("&time=" + gVar.c());
                                        stringBuffer.append("&num=" + gVar.d());
                                        stringBuffer.append("&unit_id=" + gVar.e());
                                        stringBuffer.append("&key=2000006");
                                        stringBuffer.append("&fb=" + gVar.f());
                                    }
                                    if (gVar.a() == 1) {
                                        stringBuffer.append("&hb=1");
                                    }
                                    stringBuffer.append("&timeout=" + gVar.g() + "\n");
                                }
                                str = stringBuffer.toString();
                            }
                            Message obtain2 = Message.obtain();
                            obtain2.obj = str;
                            obtain2.what = 5;
                            b.this.g.sendMessage(obtain2);
                        }
                        String b = e.b(c.MBRIDGE_CRASH_INFO);
                        file = new File(b);
                        if (file.exists() || !file.isDirectory() || file.list().length <= 0) {
                            return;
                        }
                        for (String str2 : file.list()) {
                            File file2 = new File(b + "/" + str2);
                            Message obtain3 = Message.obtain();
                            obtain3.obj = file2;
                            obtain3.what = 3;
                            b.this.g.sendMessage(obtain3);
                        }
                        return;
                    }
                    a2 = null;
                    if (a2 != null) {
                        Message obtainMessage2 = b.this.g.obtainMessage();
                        obtainMessage2.what = 2;
                        obtainMessage2.obj = a2;
                        b.this.g.sendMessage(obtainMessage2);
                    }
                    g a52 = g.a(b.this.i);
                    a3 = com.mbridge.msdk.foundation.db.d.a(a52);
                    if (a3.a() >= 20) {
                    }
                    a4 = com.mbridge.msdk.foundation.db.k.a(a52);
                    if (a4.a() > 20) {
                    }
                    String b2 = e.b(c.MBRIDGE_CRASH_INFO);
                    file = new File(b2);
                    if (file.exists()) {
                    }
                } catch (Exception e) {
                    v.d("SDKController", e.getMessage());
                }
            }
        }).start();
    }

    public final void a(Map<String, Object> map, int i) {
        if (MBridgeSDKFactory.getMBridgeSDK().getStatus() != MBridgeSDK.PLUGIN_LOAD_STATUS.COMPLETED) {
            return;
        }
        this.t = map;
        this.u = i;
        a.d().g();
        if (map != null) {
            if (this.o == null) {
                this.o = new com.mbridge.msdk.b.a();
            }
            try {
                if (this.t != null && this.t.size() > 0 && this.t.containsKey(MBridgeConstans.PROPERTIES_LAYOUT_TYPE) && ((Integer) this.t.get(MBridgeConstans.PROPERTIES_LAYOUT_TYPE)).intValue() == 0) {
                    Map<String, Object> map2 = this.t;
                    int i2 = this.u;
                    try {
                        Class<?> cls = Class.forName("com.mbridge.msdk.mbnative.e.a");
                        cls.getMethod("preload", Map.class, Integer.TYPE).invoke(cls.newInstance(), map2, Integer.valueOf(i2));
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }

    public final boolean d() {
        Context context = this.i;
        if (context != null && this.r == null) {
            int i = context.getSharedPreferences("mb_optimization_setting", 0).getInt("use_thread_pool", 0);
            AtomicBoolean atomicBoolean = new AtomicBoolean(true);
            this.r = atomicBoolean;
            atomicBoolean.set(i == 0);
        }
        AtomicBoolean atomicBoolean2 = this.r;
        if (atomicBoolean2 != null) {
            return atomicBoolean2.get();
        }
        return true;
    }

    static void a(b bVar, String str) {
        if (com.mbridge.msdk.c.b.a() == null) {
            return;
        }
        com.mbridge.msdk.c.b a2 = com.mbridge.msdk.c.b.a();
        if (a2 != null) {
            com.mbridge.msdk.c.a b = a2.b(str);
            if (b != null) {
                MBridgeConstans.OMID_JS_SERVICE_URL = b.at();
                MBridgeConstans.OMID_JS_H5_URL = b.as();
                if (!TextUtils.isEmpty(b.z())) {
                    com.mbridge.msdk.foundation.same.net.f.d.a().c = b.z();
                    com.mbridge.msdk.foundation.same.net.f.d.a().e();
                }
                if (!TextUtils.isEmpty(b.A())) {
                    com.mbridge.msdk.foundation.same.net.f.d.a().d = b.A();
                    com.mbridge.msdk.foundation.same.net.f.d.a().f();
                }
            } else {
                MBridgeConstans.OMID_JS_SERVICE_URL = "https://cdn-adn-https.rayjump.com/cdn-adn/v2/portal/19/08/20/11/06/5d5b63cb457e2.js";
                MBridgeConstans.OMID_JS_H5_URL = "https://mtg-native.rayjump.com/omsdk/omsdkjs_common_js.txt";
            }
        }
        if (com.mbridge.msdk.c.b.a().a(str) && com.mbridge.msdk.c.b.a().a(str, 1, (String) null)) {
            new com.mbridge.msdk.c.c().a(bVar.i, str, bVar.l);
        } else {
            new d(bVar.i).a();
        }
    }
}