奈斯漫画.apk(点击下载) / 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.d;
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.NetworkUtil;
import com.efs.sdk.base.core.util.PackageUtil;
import com.efs.sdk.base.core.util.e;
import com.efs.sdk.base.core.util.f;
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;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.lang3.StringUtils;

public class ControllerCenter implements Handler.Callback {
    private static GlobalEnvStruct h;
    private int a = 0;
    private final int b = 0;
    private final int c = 1;
    private final int d = 2;
    private final int e = 3;
    private volatile boolean f = false;
    private a g;
    private Handler i;

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

    public boolean handleMessage(Message message) {
        String str;
        int i2 = message.what;
        if (i2 == 0) {
            b a2 = b.a.a();
            a2.a = new com.efs.sdk.base.core.config.a();
            a2.a.a("appid", getGlobalEnvStruct().getAppid());
            int a3 = e.a();
            a2.a.a("pid", Integer.valueOf(a3));
            a2.a.a("ps", e.a(a3));
            String a4 = f.a(a2.b);
            a2.a.a("wid", a4);
            if (TextUtils.isEmpty(getGlobalEnvStruct().getUid())) {
                a2.a.a("uid", a4);
            } else {
                a2.a.a("uid", getGlobalEnvStruct().getUid());
            }
            com.efs.sdk.base.core.config.a aVar = a2.a;
            com.efs.sdk.base.core.a.a.a();
            aVar.a("stime", Long.valueOf(com.efs.sdk.base.core.a.a.b() - Process.getElapsedCpuTime()));
            a2.a.a("pkg", PackageUtil.getPackageName(a2.b));
            a2.a.a("ver", PackageUtil.getAppVersionName(a2.b));
            a2.a.a("vcode", PackageUtil.getAppVersionCode(a2.b));
            a2.a.a("sdk_ver", BuildConfig.VERSION_NAME);
            a2.a.a("brand", Build.BRAND.toLowerCase());
            com.efs.sdk.base.core.config.a aVar2 = a2.a;
            if (Build.MODEL == null) {
                str = "unknown";
            } else {
                str = Build.MODEL.replace(StringUtils.SPACE, HelpFormatter.DEFAULT_OPT_PREFIX).replace("_", HelpFormatter.DEFAULT_OPT_PREFIX).toLowerCase();
            }
            aVar2.a("model", str);
            a2.a.a("build_model", Build.MODEL);
            DisplayMetrics displayMetrics = a2.b.getResources().getDisplayMetrics();
            a2.a.a("dsp_w", Integer.valueOf(displayMetrics.widthPixels));
            a2.a.a("dsp_h", Integer.valueOf(displayMetrics.heightPixels));
            a2.a.a("fr", "android");
            a2.a.a("rom", Build.VERSION.RELEASE);
            a2.a.a("sdk", Integer.valueOf(Build.VERSION.SDK_INT));
            a2.a.a("lang", Locale.getDefault().getLanguage());
            a2.a.a("tzone", TimeZone.getDefault().getID());
            a2.a.a("net", NetworkUtil.getNetworkType(a2.b));
            try {
                String[] networkAccessMode = NetworkUtil.getNetworkAccessMode(a2.b);
                if ("Wi-Fi".equals(networkAccessMode[0])) {
                    a2.a.a(UMCrash.KEY_HEADER_ACCESS, NetworkUtil.NETWORK_TYPE_WIFI);
                } else if ("2G/3G".equals(networkAccessMode[0])) {
                    a2.a.a(UMCrash.KEY_HEADER_ACCESS, "2G/3G");
                } else {
                    a2.a.a(UMCrash.KEY_HEADER_ACCESS, "unknow");
                }
                if (!"".equals(networkAccessMode[1])) {
                    a2.a.a(UMCrash.KEY_HEADER_ACCESS_SUBTYPE, networkAccessMode[1]);
                }
                a2.a.a(UMCrash.KEY_HEADER_NETWORK_TYPE, Integer.valueOf(NetworkUtil.getNetworkTypeUmeng(a2.b)));
            } catch (Throwable th) {
                th.printStackTrace();
            }
            f.a.a();
            c.a().b();
            a();
            com.efs.sdk.base.core.f.f a5 = f.a.a();
            boolean isIntl = h.isIntl();
            com.efs.sdk.base.core.f.c cVar = a5.a;
            if (isIntl) {
                cVar.a = "https://errlogos.umeng.com/api/crashsdk/logcollect";
                cVar.b = "4ea4e41a3993";
            } else {
                cVar.a = "https://errlog.umeng.com/api/crashsdk/logcollect";
                cVar.b = "28ef1713347d";
            }
            a5.b = this;
            a5.c.a = a5.b;
            a5.d.a = a5.b;
            this.f = true;
            d.a().sendEmptyMessageDelayed(0, h.getLogSendDelayMills());
            com.efs.sdk.base.core.f.f a6 = f.a.a();
            if (a6.b != null && getGlobalEnvStruct().isEnableWaStat()) {
                a6.b.send(new com.efs.sdk.base.core.f.b("efs_core", "pvuv", a6.a.c));
            }
        } else if (i2 == 1) {
            Object obj = message.obj;
            if (obj != null && (obj instanceof ILogProtocol)) {
                b((ILogProtocol) obj);
            }
        } else if (i2 == 3) {
            a();
        }
        return true;
    }

    public static GlobalEnvStruct getGlobalEnvStruct() {
        return h;
    }

    private void a() {
        if (this.g == null) {
            this.g = new a();
        }
        try {
            IntentFilter intentFilter = new IntentFilter();
            intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
            h.mAppContext.registerReceiver(this.g, intentFilter);
        } catch (Throwable th) {
            com.efs.sdk.base.core.util.d.a("efs.base", "register network change receiver error", th);
            int i2 = this.a + 1;
            this.a = i2;
            if (i2 < 3) {
                this.i.sendEmptyMessageDelayed(3, 6000);
            }
        }
    }

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

    private void b(final ILogProtocol iLogProtocol) {
        if (iLogProtocol != null) {
            com.efs.sdk.base.core.util.a.d.a(new Runnable() {
                /* class com.efs.sdk.base.core.controller.ControllerCenter.AnonymousClass1 */

                public final void run() {
                    try {
                        iLogProtocol.insertGlobal(b.a.a().a);
                        if (!"wa".equalsIgnoreCase(iLogProtocol.getLogType())) {
                            ControllerCenter.a(iLogProtocol);
                        }
                        if (ControllerCenter.getGlobalEnvStruct().isEnableSendLog()) {
                            com.efs.sdk.base.core.util.a.d.a(
                            /*  JADX ERROR: Method code generation error
                                jadx.core.utils.exceptions.CodegenException: Error generate insn: 0x0039: INVOKE  
                                  (wrap: com.efs.sdk.base.core.e.d$1 : 0x0036: CONSTRUCTOR  (r2v1 com.efs.sdk.base.core.e.d$1) = 
                                  (wrap: com.efs.sdk.base.core.e.d : 0x0030: INVOKE  (r1v5 com.efs.sdk.base.core.e.d) =  type: STATIC call: com.efs.sdk.base.core.e.d.a.a():com.efs.sdk.base.core.e.d)
                                  (wrap: com.efs.sdk.base.core.d.b : 0x002c: INVOKE  (r0v7 com.efs.sdk.base.core.d.b) = 
                                  (wrap: com.efs.sdk.base.protocol.ILogProtocol : 0x002a: IGET  (r0v6 com.efs.sdk.base.protocol.ILogProtocol) = (r3v0 'this' com.efs.sdk.base.core.controller.ControllerCenter$1 A[IMMUTABLE_TYPE, THIS]) com.efs.sdk.base.core.controller.ControllerCenter.1.a com.efs.sdk.base.protocol.ILogProtocol)
                                 type: STATIC call: com.efs.sdk.base.core.d.b.a(com.efs.sdk.base.protocol.ILogProtocol):com.efs.sdk.base.core.d.b)
                                 call: com.efs.sdk.base.core.e.d.1.<init>(com.efs.sdk.base.core.e.d, com.efs.sdk.base.core.d.b):void type: CONSTRUCTOR)
                                 type: STATIC call: com.efs.sdk.base.core.util.a.d.a(java.lang.Runnable):java.util.concurrent.Future in method: com.efs.sdk.base.core.controller.ControllerCenter.1.run():void, file: classes.dex
                                	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:255)
                                	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:217)
                                	at jadx.core.codegen.RegionGen.makeSimpleBlock(RegionGen.java:110)
                                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:56)
                                	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93)
                                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59)
                                	at jadx.core.codegen.RegionGen.makeRegionIndent(RegionGen.java:99)
                                	at jadx.core.codegen.RegionGen.makeIf(RegionGen.java:143)
                                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:63)
                                	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93)
                                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59)
                                	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93)
                                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59)
                                	at jadx.core.codegen.RegionGen.makeRegionIndent(RegionGen.java:99)
                                	at jadx.core.codegen.RegionGen.makeTryCatch(RegionGen.java:306)
                                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:69)
                                	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93)
                                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59)
                                	at jadx.core.codegen.MethodGen.addRegionInsns(MethodGen.java:244)
                                	at jadx.core.codegen.MethodGen.addInstructions(MethodGen.java:237)
                                	at jadx.core.codegen.ClassGen.addMethodCode(ClassGen.java:342)
                                	at jadx.core.codegen.ClassGen.addMethod(ClassGen.java:295)
                                	at jadx.core.codegen.ClassGen.lambda$addInnerClsAndMethods$2(ClassGen.java:264)
                                	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
                                	at java.util.ArrayList.forEach(ArrayList.java:1259)
                                	at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:390)
                                	at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
                                Caused by: jadx.core.utils.exceptions.CodegenException: Error generate insn: 0x0036: CONSTRUCTOR  (r2v1 com.efs.sdk.base.core.e.d$1) = 
                                  (wrap: com.efs.sdk.base.core.e.d : 0x0030: INVOKE  (r1v5 com.efs.sdk.base.core.e.d) =  type: STATIC call: com.efs.sdk.base.core.e.d.a.a():com.efs.sdk.base.core.e.d)
                                  (wrap: com.efs.sdk.base.core.d.b : 0x002c: INVOKE  (r0v7 com.efs.sdk.base.core.d.b) = 
                                  (wrap: com.efs.sdk.base.protocol.ILogProtocol : 0x002a: IGET  (r0v6 com.efs.sdk.base.protocol.ILogProtocol) = (r3v0 'this' com.efs.sdk.base.core.controller.ControllerCenter$1 A[IMMUTABLE_TYPE, THIS]) com.efs.sdk.base.core.controller.ControllerCenter.1.a com.efs.sdk.base.protocol.ILogProtocol)
                                 type: STATIC call: com.efs.sdk.base.core.d.b.a(com.efs.sdk.base.protocol.ILogProtocol):com.efs.sdk.base.core.d.b)
                                 call: com.efs.sdk.base.core.e.d.1.<init>(com.efs.sdk.base.core.e.d, com.efs.sdk.base.core.d.b):void type: CONSTRUCTOR in method: com.efs.sdk.base.core.controller.ControllerCenter.1.run():void, file: classes.dex
                                	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:255)
                                	at jadx.core.codegen.InsnGen.addWrappedArg(InsnGen.java:119)
                                	at jadx.core.codegen.InsnGen.addArg(InsnGen.java:103)
                                	at jadx.core.codegen.InsnGen.generateMethodArguments(InsnGen.java:806)
                                	at jadx.core.codegen.InsnGen.makeInvoke(InsnGen.java:746)
                                	at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:367)
                                	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:249)
                                	... 26 more
                                Caused by: jadx.core.utils.exceptions.JadxRuntimeException: Expected class to be processed at this point, class: com.efs.sdk.base.core.e.d, state: GENERATED_AND_UNLOADED
                                	at jadx.core.dex.nodes.ClassNode.ensureProcessed(ClassNode.java:215)
                                	at jadx.core.codegen.InsnGen.makeConstructor(InsnGen.java:630)
                                	at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:363)
                                	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:230)
                                	... 32 more
                                */
                            /*
                                this = this;
                                com.efs.sdk.base.protocol.ILogProtocol r0 = r2     // Catch:{ all -> 0x003d }
                                com.efs.sdk.base.core.config.b r1 = com.efs.sdk.base.core.config.b.a.a()     // Catch:{ all -> 0x003d }
                                com.efs.sdk.base.core.config.a r1 = r1.a     // Catch:{ all -> 0x003d }
                                r0.insertGlobal(r1)     // Catch:{ all -> 0x003d }
                                java.lang.String r0 = "wa"
                                com.efs.sdk.base.protocol.ILogProtocol r1 = r2     // Catch:{ all -> 0x003d }
                                java.lang.String r1 = r1.getLogType()     // Catch:{ all -> 0x003d }
                                boolean r0 = r0.equalsIgnoreCase(r1)     // Catch:{ all -> 0x003d }
                                if (r0 != 0) goto L_0x001f
                                com.efs.sdk.base.protocol.ILogProtocol r0 = r2     // Catch:{ all -> 0x003d }
                                com.efs.sdk.base.core.controller.ControllerCenter.a(r0)     // Catch:{ all -> 0x003d }
                            L_0x001f:
                                com.efs.sdk.base.core.config.GlobalEnvStruct r0 = com.efs.sdk.base.core.controller.ControllerCenter.getGlobalEnvStruct()     // Catch:{ all -> 0x003d }
                                boolean r0 = r0.isEnableSendLog()     // Catch:{ all -> 0x003d }
                                if (r0 != 0) goto L_0x002a
                                return
                            L_0x002a:
                                com.efs.sdk.base.protocol.ILogProtocol r0 = r2     // Catch:{ all -> 0x003d }
                                com.efs.sdk.base.core.d.b r0 = com.efs.sdk.base.core.d.b.a(r0)     // Catch:{ all -> 0x003d }
                                com.efs.sdk.base.core.e.d r1 = com.efs.sdk.base.core.e.d.a.a()     // Catch:{ all -> 0x003d }
                                com.efs.sdk.base.core.e.d$1 r2 = new com.efs.sdk.base.core.e.d$1     // Catch:{ all -> 0x003d }
                                r2.<init>(r0)     // Catch:{ all -> 0x003d }
                                com.efs.sdk.base.core.util.a.d.a(r2)     // Catch:{ all -> 0x003d }
                                return
                            L_0x003d:
                                r0 = move-exception
                                java.lang.String r1 = "efs.base"
                                java.lang.String r2 = "log send error"
                                com.efs.sdk.base.core.util.d.b(r1, r2, r0)
                                return
                            */
                            throw new UnsupportedOperationException("Method not decompiled: com.efs.sdk.base.core.controller.ControllerCenter.AnonymousClass1.run():void");
                        }
                    });
                }
            }

            public HttpResponse sendSyncImmediately(String str, int i2, String str2, boolean z, 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.d = file;
                bVar.a(str2);
                bVar.a(i2);
                bVar.b.b = z;
                bVar.c();
                d.a.a().a.a(bVar);
                return bVar.b.c;
            }

            static /* synthetic */ 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();
                }
            }
        }