Heroes III HD v1.1.6版本的 MD5 值为:99ed52e2d6b85487933b8dc8c0440b36

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


package com.flurry.sdk;

import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.os.Bundle;
import android.os.SystemClock;
import com.flurry.android.impl.analytics.FlurryAnalyticsModule;
import com.flurry.sdk.cu;
import com.flurry.sdk.dj;
import com.flurry.sdk.dn;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.atomic.AtomicInteger;
import obfuse.NPStringFog;
public class dg implements dj.b, dn.a {
    private Location D;
    private boolean E;
    private String F;
    private byte G;
    private long H;
    private long I;
    private boolean L;
    private int M;
    private int O;
    private int P;
    private Map<String, List<String>> R;
    private dj S;
    private int T;
    private final String k;
    private String l;
    private WeakReference<Context> m;
    private List<de> o;
    private boolean q;
    private long r;
    private AdvertisingIdClient.Info t;
    private byte[] u;
    private String v;
    private long w;
    private long x;
    private long y;
    private long z;
    private static final String g = dg.class.getSimpleName();
    static int a = 100;
    static int b = 10;
    static int c = 1000;
    static int d = 160000;
    static int e = 50;
    static int f = 20;
    private final AtomicInteger h = new AtomicInteger(0);
    private final AtomicInteger i = new AtomicInteger(0);
    private final AtomicInteger j = new AtomicInteger(0);
    private File n = null;
    private final Map<Cdo, ByteBuffer> p = new HashMap();
    private List<de> s = new ArrayList();
    private String A = NPStringFog.decode("");
    private String B = NPStringFog.decode("");
    private byte C = -1;
    private final Map<String, cu.a> J = new HashMap();
    private final List<cy> K = new ArrayList();
    private final List<cx> N = new ArrayList();
    private final cv Q = new cv();
    private boolean U = false;

    Map<String, List<String>> a() {
        return this.R;
    }

    public void a(fc fcVar) {
        dl.a().c(fcVar);
    }

    public void b() {
        this.q = true;
    }

    public dg(String str) {
        el.a(4, g, NPStringFog.decode("2D0208001A0809025200151A41280D12170017501E041D120E0A1C"));
        this.k = str;
        this.m = new WeakReference<>(null);
    }

    private void u() {
        dn a2 = dm.a();
        this.G = ((Byte) a2.a(NPStringFog.decode("291503050B13"))).byteValue();
        a2.a(NPStringFog.decode("291503050B13"), (dn.a) this);
        el.a(4, g, NPStringFog.decode("071E04153D0413111B00171E4D4E26020B160B024D5C4E") + ((int) this.G));
        this.F = (String) a2.a(NPStringFog.decode("3B0308132705"));
        a2.a(NPStringFog.decode("3B0308132705"), (dn.a) this);
        el.a(4, g, NPStringFog.decode("071E04153D0413111B00171E4D4E3414000027144D5C4E") + this.F);
        this.E = ((Boolean) a2.a(NPStringFog.decode("221F0A241804091101"))).booleanValue();
        a2.a(NPStringFog.decode("221F0A241804091101"), (dn.a) this);
        el.a(4, g, NPStringFog.decode("071E04153D0413111B00171E4D4E2D080237181503151D415A45") + this.E);
        this.H = ((Long) a2.a(NPStringFog.decode("2F1708"))).longValue();
        a2.a(NPStringFog.decode("2F1708"), (dn.a) this);
        el.a(4, g, NPStringFog.decode("071E04153D0413111B00171E4D4E230E170606340C150B415A45") + this.H);
        this.I = ((Long) a2.a(NPStringFog.decode("2D1F0315070F1200210B031E08010F2A0C1E02191E"))).longValue();
        a2.a(NPStringFog.decode("2D1F0315070F1200210B031E08010F2A0C1E02191E"), (dn.a) this);
        el.a(4, g, NPStringFog.decode("071E04153D0413111B00171E4D4E22080B06071E18043D0414161B011E2008020D0E16525350") + this.I);
    }

    @Override
    public void a(String str, Object obj) {
        if (str.equals(NPStringFog.decode("291503050B13"))) {
            this.G = ((Byte) obj).byteValue();
            el.a(4, g, NPStringFog.decode("011E3E041A150E0B153B0009001A044B45350B1E09041C415A45") + ((int) this.G));
        } else if (str.equals(NPStringFog.decode("3B0308132705"))) {
            this.F = (String) obj;
            el.a(4, g, NPStringFog.decode("011E3E041A150E0B153B0009001A044B45271D151F280A415A45") + this.F);
        } else if (str.equals(NPStringFog.decode("221F0A241804091101"))) {
            this.E = ((Boolean) obj).booleanValue();
            el.a(4, g, NPStringFog.decode("011E3E041A150E0B153B0009001A044B453E011728170B0F1316525350") + this.E);
        } else if (str.equals(NPStringFog.decode("2F1708"))) {
            this.H = ((Long) obj).longValue();
            el.a(4, g, NPStringFog.decode("011E3E041A150E0B153B0009001A044B4530070219090A001300525350") + this.H);
        } else if (str.equals(NPStringFog.decode("2D1F0315070F1200210B031E08010F2A0C1E02191E"))) {
            this.I = ((Long) obj).longValue();
            el.a(4, g, NPStringFog.decode("011E3E041A150E0B153B0009001A044B4531011E190800140236171D03040E002C0E091E07034D5C4E") + this.I);
        } else {
            el.a(6, g, NPStringFog.decode("011E3E041A150E0B153B0009001A04470C1C1A151F0F0F0D4700001C1F1F40"));
        }
    }

    public synchronized void a(Context context) {
        el.a(4, g, NPStringFog.decode("271E041507000B0C08071E0A41000410453402051F1317411400011D19020F4E160E111A4E13020F1A041F1148") + context);
        this.m = new WeakReference<>(context);
        this.S = new dj(this);
        this.n = context.getFileStreamPath(F());
        this.l = dy.a();
        this.y = -1L;
        this.O = 0;
        this.B = TimeZone.getDefault().getID();
        this.A = Locale.getDefault().getLanguage() + NPStringFog.decode("31") + Locale.getDefault().getCountry();
        this.L = true;
        this.M = 0;
        this.P = 0;
        this.R = d(context);
        u();
        long elapsedRealtime = SystemClock.elapsedRealtime();
        this.w = System.currentTimeMillis();
        this.x = elapsedRealtime;
        a(new fc() {
            @Override
            public void a() {
                dg.this.t = dt.a();
            }
        });
        a(new fc() {
            @Override
            public void a() {
                dg.this.u = dv.a();
            }
        });
        a(new fc() {
            @Override
            public void a() {
                dg.this.v = dx.a();
            }
        });
        a(new fc() {
            @Override
            public void a() {
                dg.this.C();
            }
        });
        a(new fc() {
            @Override
            public void a() {
                dg.this.v();
            }
        });
        em.a().a(this, context);
        this.U = true;
    }

    public synchronized void b(Context context) {
        if (this.U) {
            el.d(g, NPStringFog.decode("3D040C131A411400011D19020F4E160E111A4E13020F1A041F11484E") + context + NPStringFog.decode("4E13021400155D") + g());
            this.m = new WeakReference<>(context);
            if (this.S.b()) {
                this.S.a();
            }
            D();
            dw.a().c();
            this.D = dw.a().f();
            em.a().b(this, context);
        }
    }

    public synchronized void c(Context context) {
        if (this.U) {
            em.a().c(this, context);
            this.D = dw.a().f();
            z();
            E();
            el.d(g, NPStringFog.decode("2B1E09411D0414161B011E4D1607150F4511011E190416155D45") + context + NPStringFog.decode("4E13021400155D") + g());
            this.y = SystemClock.elapsedRealtime() - this.x;
            a(this.y);
            w();
            if (g() == 0) {
                this.S.a(this.I);
            }
        }
    }

    public synchronized void c() {
        if (this.U) {
            el.d(g, NPStringFog.decode("2819030002081D00521D151E12070E09"));
            if (this.S.b()) {
                this.S.a();
            }
            if (g() != 0) {
                el.a(6, g, NPStringFog.decode("3D151E12070E094505070405410F110E2E1717505041") + j() + NPStringFog.decode("4E070C124E040901170A501A09070D0245150B043E041D120E0A1C2D1F180F1A494E451B1D50030E1A4157"));
            }
            this.T = 0;
            x();
            em.a().a(this);
            a(new fc() {
                @Override
                public void a() {
                    di.a().a(dg.this.j());
                }
            });
            dm.a().b(NPStringFog.decode("291503050B13"), (dn.a) this);
            dm.a().b(NPStringFog.decode("3B0308132705"), (dn.a) this);
            dm.a().b(NPStringFog.decode("2F1708"), (dn.a) this);
            dm.a().b(NPStringFog.decode("221F0A241804091101"), (dn.a) this);
            dm.a().b(NPStringFog.decode("2D1F0315070F1200210B031E08010F2A0C1E02191E"), (dn.a) this);
        }
    }

    private Map<String, List<String>> d(Context context) {
        Bundle extras;
        if (!(context instanceof Activity) || (extras = ((Activity) context).getIntent().getExtras()) == null) {
            return null;
        }
        el.a(3, g, NPStringFog.decode("2211180F0D09472A021A19020F1D4125101C0A1C084107124715000B03080F1A41") + extras.toString());
        HashMap hashMap = new HashMap();
        for (String str : extras.keySet()) {
            if (str != null) {
                Object obj = extras.get(str);
                String obj2 = obj != null ? obj.toString() : NPStringFog.decode("0005010D");
                hashMap.put(str, new ArrayList(Arrays.asList(obj2)));
                el.a(3, g, NPStringFog.decode("2211180F0D09470A021A19020F1D412C000B5450") + str + NPStringFog.decode("405024151D4111041E1B155741") + obj2);
            }
        }
        return hashMap;
    }

    public void v() {
        try {
            if (this.v != null) {
                el.a(3, g, NPStringFog.decode("281519020604034502061F03044E0803"));
                a(Cdo.a, ByteBuffer.wrap(this.v.getBytes()));
            }
            if (this.u != null) {
                el.a(3, g, NPStringFog.decode("28151902060403451A0F0305040A412E283727"));
                a(Cdo.b, ByteBuffer.wrap(this.u));
            }
            if (this.t != null) {
                el.a(3, g, NPStringFog.decode("2815190206040345130A0608131A08140C1C09500405"));
                a(Cdo.c, ByteBuffer.wrap(this.t.getId().getBytes()));
            }
            A();
        } catch (Throwable th) {
            el.a(6, g, NPStringFog.decode(""), th);
        }
    }

    private synchronized void a(long j) {
        for (cy cyVar : this.K) {
            if (cyVar.a() && !cyVar.b()) {
                cyVar.a(j);
            }
        }
    }

    private void w() {
        a(new fc() {
            @Override
            public void a() {
                de d2 = dg.this.d();
                dg.this.s.clear();
                dg.this.s.add(d2);
                dg.this.B();
            }
        });
    }

    private void x() {
        a(new fc() {
            @Override
            public void a() {
                dg.this.y();
            }
        });
    }

    public void y() {
        boolean z;
        try {
            synchronized (this) {
                z = this.s.size() > 0;
            }
            if (z) {
                A();
            }
        } catch (Throwable th) {
            el.a(6, g, NPStringFog.decode(""), th);
        }
    }

    private void z() {
        a(new fc() {
            @Override
            public void a() {
                dw.a().d();
            }
        });
    }

    synchronized de d() {
        de deVar;
        df dfVar = new df();
        dfVar.a(this.l);
        dfVar.a(this.w);
        dfVar.b(this.y);
        dfVar.c(this.z);
        dfVar.b(k());
        dfVar.c(l());
        dfVar.a((int) this.C);
        dfVar.d(h());
        dfVar.a(this.D);
        dfVar.b(f());
        dfVar.a(this.G);
        dfVar.a(Long.valueOf(this.H));
        dfVar.a(t());
        dfVar.a(r());
        dfVar.a(this.L);
        dfVar.b(s());
        dfVar.c(this.O);
        try {
            deVar = new de(dfVar);
        } catch (IOException e2) {
            e2.printStackTrace();
            deVar = null;
        }
        if (deVar == null) {
            el.d(g, NPStringFog.decode("20151A411D0414161B011E4D130B110817064E070C1200461345111C150C150B05"));
        }
        return deVar;
    }

    public synchronized void e() {
        this.P++;
    }

    int f() {
        return this.P;
    }

    public synchronized void a(String str, Map<String, String> map, boolean z) {
        long elapsedRealtime = SystemClock.elapsedRealtime() - this.x;
        String a2 = fb.a(str);
        if (a2.length() != 0) {
            cu.a aVar = this.J.get(a2);
            if (aVar == null) {
                if (this.J.size() < a) {
                    cu.a aVar2 = new cu.a();
                    aVar2.a = 1;
                    this.J.put(a2, aVar2);
                    el.d(g, NPStringFog.decode("2B06080F1A41040A0700044D121A001511170A4A4D") + a2);
                } else {
                    el.d(g, NPStringFog.decode("3A1F02410300091C520A190B070B13020B064E151B040015144B522B06080F1A41090A064E13021400150201484E") + a2);
                }
            } else {
                aVar.a++;
                el.d(g, NPStringFog.decode("2B06080F1A41040A0700044D08000215001F0B1E19040A5B47") + a2);
            }
            if (this.E && this.K.size() < c && this.M < d) {
                Map<String, String> emptyMap = map == null ? Collections.emptyMap() : map;
                if (emptyMap.size() > b) {
                    el.d(g, NPStringFog.decode("2311152418040911220F020C0C1D41021D110B1509040A5B47") + emptyMap.size());
                } else {
                    cy cyVar = new cy(G(), a2, emptyMap, elapsedRealtime, z);
                    if (cyVar.d() + this.M <= d) {
                        this.K.add(cyVar);
                        this.M = cyVar.d() + this.M;
                    } else {
                        this.M = d;
                        this.L = false;
                        el.d(g, NPStringFog.decode("2B06080F1A412B0A154E03041B0B41021D110B1509040A4F472B1D4E1D02130B4102131700044D050B15060C1E1D50010E090602015C"));
                    }
                }
            } else {
                this.L = false;
            }
        }
    }

    public synchronized void a(String str, Map<String, String> map) {
        Iterator<cy> it = this.K.iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            cy next = it.next();
            if (next.a(str)) {
                break;
            }
        }
    }

    public synchronized void a(String str, String str2, String str3, Throwable th) {
        boolean z;
        cx cxVar;
        int i = 0;
        synchronized (this) {
            if (str != null) {
                if (NPStringFog.decode("1B1E0E001B060F11").equals(str)) {
                    z = true;
                    this.O++;
                    if (this.N.size() >= e) {
                        this.N.add(new cx(H(), Long.valueOf(System.currentTimeMillis()).longValue(), str, str2, str3, th));
                        el.d(g, NPStringFog.decode("2B021F0E1C410B0A150915095B4E") + cxVar.c());
                    } else if (z) {
                        while (true) {
                            int i2 = i;
                            if (i2 >= this.N.size()) {
                                break;
                            }
                            cx cxVar2 = this.N.get(i2);
                            if (cxVar2.c() == null || NPStringFog.decode("1B1E0E001B060F11").equals(cxVar2.c())) {
                                i = i2 + 1;
                            } else {
                                this.N.set(i2, new cx(H(), Long.valueOf(System.currentTimeMillis()).longValue(), str, str2, str3, th));
                                break;
                            }
                        }
                    } else {
                        el.d(g, NPStringFog.decode("231115410B13150A001D50010E090602015C4E3E0241030E1500520B021F0E1C1247091D0917080540"));
                    }
                }
            }
            z = false;
            this.O++;
            if (this.N.size() >= e) {
            }
        }
    }

    private void A() {
        try {
            el.a(3, g, NPStringFog.decode("091503041C00130C1C09500C060B0F1345000B0002131A"));
            cz czVar = new cz(this.k, this.l, this.q, o(), this.r, this.w, this.s, p(), this.Q.a(false), a(), cu.a().b(), System.currentTimeMillis());
            this.o = new ArrayList(this.s);
            if (czVar != null && czVar.a() != null) {
                el.a(3, g, NPStringFog.decode("091503041C001300164E020811011313451D08501E08140447") + czVar.a().length + NPStringFog.decode("4E0704150641") + this.s.size() + NPStringFog.decode("4E020811011313165C"));
                a(czVar.a());
                this.s.removeAll(this.o);
                this.o = null;
                B();
            } else {
                el.d(g, NPStringFog.decode("2B021F0E1C4100001C0B020C15070F0045000B0002131A"));
            }
        } catch (Throwable th) {
            el.a(6, g, NPStringFog.decode(""), th);
        }
    }

    private void a(byte[] bArr) {
        FlurryAnalyticsModule.getInstance().a().b(bArr, this.k, NPStringFog.decode("") + dk.a().b());
    }

    public synchronized void B() {
        if (!fa.a(this.n)) {
            el.d(g, NPStringFog.decode("2B021F0E1C411700001D191E15070F0045000B0002131A5B47061D1B1C0941000E1345111C150C150B41030C000B13190E1C18"));
        } else {
            try {
                DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream(this.n));
                dh dhVar = new dh();
                dhVar.a(this.q);
                dhVar.a(this.r);
                dhVar.a(this.s);
                dhVar.a(dataOutputStream, this.k, i());
            } catch (Exception e2) {
                el.b(g, NPStringFog.decode("2B021F0E1C41140404071E0A411E0415161B1D04080F1A410304060F"), e2);
            }
        }
    }

    public synchronized void C() {
        DataInputStream dataInputStream;
        FileInputStream fileInputStream;
        boolean z;
        FileInputStream fileInputStream2 = null;
        synchronized (this) {
            el.a(4, g, NPStringFog.decode("221F0C05070F0045020B021E081D15020B064E140C150F5B47") + this.n.getAbsolutePath());
            if (this.n.exists()) {
                try {
                    fileInputStream = new FileInputStream(this.n);
                    try {
                        dataInputStream = new DataInputStream(fileInputStream);
                        try {
                            dh dhVar = new dh();
                            dhVar.a(dataInputStream, this.k);
                            this.q = dhVar.a();
                            this.r = dhVar.c();
                            this.s = dhVar.b();
                            z = true;
                            fb.a(dataInputStream);
                            fb.a(fileInputStream);
                        } catch (Exception e2) {
                            e = e2;
                            fileInputStream2 = fileInputStream;
                            try {
                                el.b(g, NPStringFog.decode("2B021F0E1C410B0A130A1903064E110217010703190400154701131A11"), e);
                                fb.a(dataInputStream);
                                fb.a(fileInputStream2);
                                z = false;
                                if (!z) {
                                }
                                if (!z) {
                                }
                            } catch (Throwable th) {
                                th = th;
                                fileInputStream = fileInputStream2;
                                fb.a(dataInputStream);
                                fb.a(fileInputStream);
                                throw th;
                            }
                        } catch (Throwable th2) {
                            th = th2;
                            fb.a(dataInputStream);
                            fb.a(fileInputStream);
                            throw th;
                        }
                    } catch (Exception e3) {
                        e = e3;
                        dataInputStream = null;
                        fileInputStream2 = fileInputStream;
                    } catch (Throwable th3) {
                        th = th3;
                        dataInputStream = null;
                    }
                } catch (Exception e4) {
                    e = e4;
                    dataInputStream = null;
                } catch (Throwable th4) {
                    th = th4;
                    dataInputStream = null;
                    fileInputStream = null;
                }
                if (!z) {
                    el.a(3, g, NPStringFog.decode("2A1501041A080902520F17080F1A4104041106154D07070D02"));
                    this.n.delete();
                }
            } else {
                el.a(4, g, NPStringFog.decode("2F17080F1A4104041106154D07070D02451601151E0F491547000A0703194F"));
                z = false;
            }
            if (!z) {
                this.q = false;
                this.r = this.w;
            }
        }
    }

    private void D() {
        this.T++;
    }

    private void E() {
        if (this.T > 0) {
            this.T--;
        }
    }

    public int g() {
        return this.T;
    }

    private String F() {
        return NPStringFog.decode("401601141C131E04150B1E194F") + Integer.toString(this.k.hashCode(), 16);
    }

    private int G() {
        return this.h.incrementAndGet();
    }

    private int H() {
        return this.i.incrementAndGet();
    }

    String h() {
        return this.F == null ? NPStringFog.decode("") : this.F;
    }

    public String i() {
        return this.v;
    }

    public String j() {
        return this.k;
    }

    public String k() {
        return this.A;
    }

    public String l() {
        return this.B;
    }

    public long m() {
        return this.w;
    }

    public long n() {
        return this.x;
    }

    public boolean o() {
        return this.t == null || !this.t.isLimitAdTrackingEnabled();
    }

    private void a(Cdo cdo, ByteBuffer byteBuffer) {
        synchronized (this.p) {
            this.p.put(cdo, byteBuffer);
        }
    }

    public Map<Cdo, ByteBuffer> p() {
        return new HashMap(this.p);
    }

    @Override
    public void q() {
        c();
    }

    List<cy> r() {
        return this.K;
    }

    List<cx> s() {
        return this.N;
    }

    Map<String, cu.a> t() {
        return this.J;
    }
}