小源钱包 v1.0.0版本的 MD5 值为:2fddb51fa9867693f901004082511bea

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


package com.efs.sdk.base.core.controller;

import android.content.IntentFilter;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.os.Process;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Pair;
import android.webkit.ValueCallback;
import com.efs.sdk.base.BuildConfig;
import com.efs.sdk.base.EfsReporter;
import com.efs.sdk.base.core.c.f;
import com.efs.sdk.base.core.config.GlobalEnvStruct;
import com.efs.sdk.base.core.config.a.c;
import com.efs.sdk.base.core.config.b;
import com.efs.sdk.base.core.controller.a.a;
import com.efs.sdk.base.core.e.d;
import com.efs.sdk.base.core.f.f;
import com.efs.sdk.base.core.util.Log;
import com.efs.sdk.base.core.util.NetworkUtil;
import com.efs.sdk.base.core.util.PackageUtil;
import com.efs.sdk.base.core.util.ProcessUtil;
import com.efs.sdk.base.core.util.concurrent.WorkThreadUtil;
import com.efs.sdk.base.http.HttpResponse;
import com.efs.sdk.base.protocol.ILogProtocol;
import com.umeng.umcrash.UMCrash;
import java.io.File;
import java.util.HashMap;
import java.util.Locale;
import java.util.TimeZone;
public class ControllerCenter implements Handler.Callback {
    private static GlobalEnvStruct f8030h;
    private int f8031a = 0;
    private final int f8032b = 0;
    private final int f8033c = 1;
    private final int f8034d = 2;
    private final int f8035e = 3;
    private volatile boolean f8036f = false;
    private a f8037g;
    private Handler f8038i;

    public ControllerCenter(EfsReporter.Builder builder) {
        f8030h = builder.getGlobalEnvStruct();
        Handler handler = new Handler(com.efs.sdk.base.core.util.concurrent.a.f8104a.getLooper(), this);
        this.f8038i = handler;
        handler.sendEmptyMessage(0);
    }

    private void a() {
        if (this.f8037g == null) {
            this.f8037g = new a();
        }
        try {
            IntentFilter intentFilter = new IntentFilter();
            intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
            f8030h.mAppContext.registerReceiver(this.f8037g, intentFilter);
        } catch (Throwable th) {
            Log.w("efs.base", "register network change receiver error", th);
            int i10 = this.f8031a + 1;
            this.f8031a = i10;
            if (i10 < 3) {
                this.f8038i.sendEmptyMessageDelayed(3, 6000L);
            }
        }
    }

    static void a(ILogProtocol iLogProtocol) {
        for (ValueCallback<Pair<Message, Message>> valueCallback : getGlobalEnvStruct().getCallback(9)) {
            HashMap hashMap = new HashMap(4);
            hashMap.put("log_type", iLogProtocol.getLogType());
            hashMap.put("log_data", iLogProtocol.generateString());
            hashMap.put("link_key", iLogProtocol.getLinkKey());
            hashMap.put("link_id", iLogProtocol.getLinkId());
            Message obtain = Message.obtain(null, 9, hashMap);
            Message obtain2 = Message.obtain();
            valueCallback.onReceiveValue(new Pair<>(obtain, obtain2));
            obtain.recycle();
            obtain2.recycle();
        }
    }

    private void b(final ILogProtocol iLogProtocol) {
        if (iLogProtocol == null) {
            return;
        }
        WorkThreadUtil.submit(new Runnable() {
            @Override
            public final void run() {
                try {
                    iLogProtocol.insertGlobal(b.a.a().f8027a);
                    if (!"wa".equalsIgnoreCase(iLogProtocol.getLogType())) {
                        ControllerCenter.a(iLogProtocol);
                    }
                    if (ControllerCenter.getGlobalEnvStruct().isEnableSendLog()) {
                        final com.efs.sdk.base.core.d.b a10 = com.efs.sdk.base.core.d.b.a(iLogProtocol);
                        final d a11 = d.a.a();
                        WorkThreadUtil.submit(new Runnable() {
                            @Override
                            public final void run() {
                                a11.f8058a.a(a10);
                            }
                        });
                    }
                } catch (Throwable th) {
                    Log.e("efs.base", "log send error", th);
                }
            }
        });
    }

    public static GlobalEnvStruct getGlobalEnvStruct() {
        return f8030h;
    }

    @Override
    public boolean handleMessage(Message message) {
        boolean isIntl;
        String str;
        f a10;
        String[] networkAccessMode;
        com.efs.sdk.base.core.config.a aVar;
        String str2;
        int i10 = message.what;
        if (i10 == 0) {
            b a11 = b.a.a();
            com.efs.sdk.base.core.config.a aVar2 = new com.efs.sdk.base.core.config.a();
            a11.f8027a = aVar2;
            aVar2.a("appid", getGlobalEnvStruct().getAppid());
            int myPid = ProcessUtil.myPid();
            a11.f8027a.a("pid", Integer.valueOf(myPid));
            a11.f8027a.a("ps", ProcessUtil.getProcessName(myPid));
            String a12 = com.efs.sdk.base.core.util.d.a(a11.f8028b);
            a11.f8027a.a("wid", a12);
            if (TextUtils.isEmpty(getGlobalEnvStruct().getUid())) {
                a11.f8027a.a("uid", a12);
            } else {
                a11.f8027a.a("uid", getGlobalEnvStruct().getUid());
            }
            com.efs.sdk.base.core.config.a aVar3 = a11.f8027a;
            com.efs.sdk.base.core.a.a.a();
            aVar3.a("stime", Long.valueOf(com.efs.sdk.base.core.a.a.b() - Process.getElapsedCpuTime()));
            a11.f8027a.a("pkg", PackageUtil.getPackageName(a11.f8028b));
            a11.f8027a.a("ver", PackageUtil.getAppVersionName(a11.f8028b));
            a11.f8027a.a("vcode", PackageUtil.getAppVersionCode(a11.f8028b));
            a11.f8027a.a("sdk_ver", BuildConfig.VERSION_NAME);
            a11.f8027a.a("brand", Build.BRAND.toLowerCase());
            com.efs.sdk.base.core.config.a aVar4 = a11.f8027a;
            String str3 = Build.MODEL;
            aVar4.a("model", str3 == null ? "unknown" : str3.replace(" ", "-").replace("_", "-").toLowerCase());
            a11.f8027a.a("build_model", str3);
            DisplayMetrics displayMetrics = a11.f8028b.getResources().getDisplayMetrics();
            a11.f8027a.a("dsp_w", Integer.valueOf(displayMetrics.widthPixels));
            a11.f8027a.a("dsp_h", Integer.valueOf(displayMetrics.heightPixels));
            a11.f8027a.a("fr", "android");
            a11.f8027a.a("rom", Build.VERSION.RELEASE);
            a11.f8027a.a("sdk", Integer.valueOf(Build.VERSION.SDK_INT));
            a11.f8027a.a("lang", Locale.getDefault().getLanguage());
            a11.f8027a.a("tzone", TimeZone.getDefault().getID());
            a11.f8027a.a("net", NetworkUtil.getNetworkType(a11.f8028b));
            try {
                networkAccessMode = NetworkUtil.getNetworkAccessMode(a11.f8028b);
            } catch (Throwable th) {
                th.printStackTrace();
            }
            if ("Wi-Fi".equals(networkAccessMode[0])) {
                aVar = a11.f8027a;
                str2 = NetworkUtil.NETWORK_TYPE_WIFI;
            } else if ("2G/3G".equals(networkAccessMode[0])) {
                a11.f8027a.a(UMCrash.KEY_HEADER_ACCESS, "2G/3G");
                if (!"".equals(networkAccessMode[1])) {
                    a11.f8027a.a(UMCrash.KEY_HEADER_ACCESS_SUBTYPE, networkAccessMode[1]);
                }
                a11.f8027a.a(UMCrash.KEY_HEADER_NETWORK_TYPE, Integer.valueOf(NetworkUtil.getNetworkTypeUmeng(a11.f8028b)));
                f.a.a();
                c.a().b();
                a();
                com.efs.sdk.base.core.f.f a13 = f.a.a();
                isIntl = f8030h.isIntl();
                com.efs.sdk.base.core.f.c cVar = a13.f8075a;
                if (isIntl) {
                    cVar.f8067a = "https://errnewlog.umeng.com/api/crashsdk/logcollect";
                    str = "28ef1713347d";
                } else {
                    cVar.f8067a = "https://errnewlogos.umeng.com/api/crashsdk/logcollect";
                    str = "4ea4e41a3993";
                }
                cVar.f8068b = str;
                a13.f8076b = this;
                a13.f8077c.f8062a = this;
                a13.f8078d.f8062a = this;
                this.f8036f = true;
                com.efs.sdk.base.core.c.d.a().sendEmptyMessageDelayed(0, f8030h.getLogSendDelayMills());
                a10 = f.a.a();
                if (a10.f8076b != null && getGlobalEnvStruct().isEnableWaStat()) {
                    a10.f8076b.send(new com.efs.sdk.base.core.f.b("efs_core", "pvuv", a10.f8075a.f8069c));
                }
            } else {
                aVar = a11.f8027a;
                str2 = "unknow";
            }
            aVar.a(UMCrash.KEY_HEADER_ACCESS, str2);
            if (!"".equals(networkAccessMode[1])) {
            }
            a11.f8027a.a(UMCrash.KEY_HEADER_NETWORK_TYPE, Integer.valueOf(NetworkUtil.getNetworkTypeUmeng(a11.f8028b)));
            f.a.a();
            c.a().b();
            a();
            com.efs.sdk.base.core.f.f a132 = f.a.a();
            isIntl = f8030h.isIntl();
            com.efs.sdk.base.core.f.c cVar2 = a132.f8075a;
            if (isIntl) {
            }
            cVar2.f8068b = str;
            a132.f8076b = this;
            a132.f8077c.f8062a = this;
            a132.f8078d.f8062a = this;
            this.f8036f = true;
            com.efs.sdk.base.core.c.d.a().sendEmptyMessageDelayed(0, f8030h.getLogSendDelayMills());
            a10 = f.a.a();
            if (a10.f8076b != null) {
                a10.f8076b.send(new com.efs.sdk.base.core.f.b("efs_core", "pvuv", a10.f8075a.f8069c));
            }
        } else if (i10 == 1) {
            Object obj = message.obj;
            if (obj != null && (obj instanceof ILogProtocol)) {
                b((ILogProtocol) obj);
            }
        } else if (i10 == 3) {
            a();
        }
        return true;
    }

    public void send(ILogProtocol iLogProtocol) {
        if (this.f8036f) {
            b(iLogProtocol);
            return;
        }
        Message obtain = Message.obtain();
        obtain.what = 1;
        obtain.obj = iLogProtocol;
        this.f8038i.sendMessage(obtain);
    }

    public HttpResponse sendSyncImmediately(String str, int i10, String str2, boolean z10, File file) {
        com.efs.sdk.base.core.d.b bVar = new com.efs.sdk.base.core.d.b(str, (byte) 2);
        bVar.b(1);
        bVar.f8051d = file;
        bVar.a(str2);
        bVar.a(i10);
        bVar.f8049b.f8053b = z10;
        bVar.c();
        d.a.a().f8058a.a(bVar);
        return bVar.f8049b.f8054c;
    }
}