AI Chat v1.1.8版本的 MD5 值为:1bcdce875f86738c8cfbf1e5f4064353

以下内容为反编译后的 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.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.aa;
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.x;
import com.mbridge.msdk.out.Frame;
import com.mbridge.msdk.out.MBridgeSDKFactory;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
public class b {
    private static volatile 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 a = 1;
    public final int b = 2;
    public final int c = 3;
    public final int f1548d = 4;
    public final int e = 5;
    public final int f = 6;
    private boolean q = false;
    private AtomicBoolean r = null;
    private FastKV s = null;
    public Handler g = new Handler(Looper.getMainLooper()) {
        @Override
        public final void handleMessage(Message message) {
            List list;
            try {
                int i = message.what;
                if (i == 2) {
                    Object obj = message.obj;
                    if (!(obj instanceof List) || (list = (List) 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 bool = Boolean.FALSE;
                        if (i2 == list.size() - 1) {
                            bool = Boolean.TRUE;
                        }
                        dVar.a(kVar, bool);
                    }
                } else if (i == 3) {
                    File file = (File) message.obj;
                    if (file != null) {
                        String a = v.a(file);
                        if (TextUtils.isEmpty(a)) {
                            return;
                        }
                        String[] split = a.split("====");
                        if (split.length > 0) {
                            new d(b.this.i).a(split[0], file);
                        }
                    }
                } else 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);
                    } else {
                        new d(b.this.i, 0).a("click_duration", str, (String) null, (Frame) null);
                    }
                } else 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);
                    } else {
                        new d(b.this.i, 0).a(com.anythink.expressad.foundation.g.a.az, str2, (String) null, (Frame) null);
                    }
                } else 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();
                    }
                } else {
                    Object obj2 = message.obj;
                    if (obj2 == null || !(obj2 instanceof String)) {
                        return;
                    }
                    String str3 = (String) obj2;
                    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(com.anythink.expressad.foundation.g.a.aD, str3, (String) null, (Frame) null);
                    }
                }
            } catch (Exception e) {
                x.d("SDKController", e.getMessage());
            }
        }
    };

    private b() {
    }

    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) {
            x.b("SDKController", th.getMessage(), th);
        }
    }

    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;
    }

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

    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> a;
                com.mbridge.msdk.foundation.db.d a2;
                com.mbridge.msdk.foundation.db.k a3;
                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) {
                        a = m.a(g.a(context)).a(5);
                        if (a != null && a.size() > 0) {
                            Message obtainMessage = b.this.g.obtainMessage();
                            obtainMessage.what = 2;
                            obtainMessage.obj = a;
                            b.this.g.sendMessage(obtainMessage);
                        }
                        g a4 = g.a(b.this.i);
                        a2 = com.mbridge.msdk.foundation.db.d.a(a4);
                        if (a2.a() >= 20) {
                            String a5 = com.mbridge.msdk.foundation.entity.d.a(a2.a(20));
                            Message obtain = Message.obtain();
                            obtain.obj = a5;
                            obtain.what = 4;
                            b.this.g.sendMessage(obtain);
                        }
                        a3 = com.mbridge.msdk.foundation.db.k.a(a4);
                        if (a3.a() > 20) {
                            List<com.mbridge.msdk.foundation.entity.g> a6 = a3.a(20);
                            if (a6 != null && a6.size() > 0) {
                                StringBuffer stringBuffer = new StringBuffer();
                                for (com.mbridge.msdk.foundation.entity.g gVar : a6) {
                                    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;
                    }
                    a = null;
                    if (a != null) {
                        Message obtainMessage2 = b.this.g.obtainMessage();
                        obtainMessage2.what = 2;
                        obtainMessage2.obj = a;
                        b.this.g.sendMessage(obtainMessage2);
                    }
                    g a42 = g.a(b.this.i);
                    a2 = com.mbridge.msdk.foundation.db.d.a(a42);
                    if (a2.a() >= 20) {
                    }
                    a3 = com.mbridge.msdk.foundation.db.k.a(a42);
                    if (a3.a() > 20) {
                    }
                    String b2 = e.b(c.MBRIDGE_CRASH_INFO);
                    file = new File(b2);
                    if (file.exists()) {
                    }
                } catch (Exception e) {
                    x.d("SDKController", e.getMessage());
                }
            }
        }).start();
    }

    public final void a(Map map, final Context context) {
        String str;
        String str2;
        List<com.mbridge.msdk.foundation.entity.a> b;
        Object newInstance;
        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;
            }
            t.n(context);
            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<?> cls = Class.forName("com.mbridge.msdk.interstitialvideo.out.MBInterstitialVideoHandler");
                            if (this.i != null && (newInstance = cls.getConstructor(String.class, String.class).newInstance("", aVar.b())) != null) {
                                cls.getMethod("loadFormSelfFilling", new Class[0]).invoke(newInstance, new Object[0]);
                            }
                        } else if (aVar.a() == 94) {
                            Class<?> cls2 = Class.forName("com.mbridge.msdk.out.MBRewardVideoHandler");
                            Object newInstance2 = cls2.getConstructor(String.class, String.class).newInstance("", aVar.b());
                            if (newInstance2 != null) {
                                cls2.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 {
                jd7.a(applicationContext);
                if (!jd7.b()) {
                    new d(applicationContext, 0).a("", "", "", "", "activate om failed");
                }
            } catch (IllegalArgumentException e2) {
                x.b("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), r.b(com.anythink.expressad.foundation.h.v.a)).build();
                    } catch (Exception unused2) {
                        this.s = null;
                    }
                }
                FastKV fastKV = this.s;
                if (fastKV != null) {
                    try {
                        str = fastKV.getString(r.b(com.anythink.expressad.foundation.g.a.cj), "");
                        try {
                            str3 = this.s.getString(r.b(com.anythink.expressad.foundation.g.a.cm), "");
                        } 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("c");
                    }
                    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(r.b(com.anythink.expressad.foundation.g.a.cj), com.mbridge.msdk.foundation.same.a.l);
                                this.s.putString(r.b(com.anythink.expressad.foundation.g.a.cm), 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("c", com.mbridge.msdk.foundation.same.a.m);
                    }
                } else {
                    SharedPreferences sharedPreferences = applicationContext2.getSharedPreferences(r.b(com.anythink.expressad.foundation.h.v.a), 0);
                    if (sharedPreferences != null) {
                        str3 = sharedPreferences.getString(r.b(com.anythink.expressad.foundation.g.a.cj), "");
                        str2 = sharedPreferences.getString(r.b(com.anythink.expressad.foundation.g.a.cm), "");
                    } 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("c");
                    }
                    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(r.b(com.anythink.expressad.foundation.g.a.cj), com.mbridge.msdk.foundation.same.a.l);
                            edit.putString(r.b(com.anythink.expressad.foundation.g.a.cm), 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("c", com.mbridge.msdk.foundation.same.a.m);
                    }
                }
            } catch (Throwable th3) {
                x.b("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) {
                x.d("SDKController", e3.getMessage());
            }
            c();
            aa.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() {
                        t.m(context);
                    }
                }, h2);
            }
        }
    }

    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 {
                Map<String, Object> map2 = this.t;
                if (map2 != null && map2.size() > 0 && this.t.containsKey(MBridgeConstans.PROPERTIES_LAYOUT_TYPE) && ((Integer) this.t.get(MBridgeConstans.PROPERTIES_LAYOUT_TYPE)).intValue() == 0) {
                    Map<String, Object> map3 = 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(), map3, Integer.valueOf(i2));
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }

    public static void a(b bVar, String str) {
        if (com.mbridge.msdk.c.b.a() == null) {
            return;
        }
        com.mbridge.msdk.c.b a = com.mbridge.msdk.c.b.a();
        if (a != null) {
            com.mbridge.msdk.c.a b = a.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().f1583d = b.A();
                    com.mbridge.msdk.foundation.same.net.f.d.a().f();
                }
            } else {
                MBridgeConstans.OMID_JS_SERVICE_URL = com.anythink.expressad.d.a.b.df;
                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();
        }
    }
}