湘游汇 v1.0版本的 MD5 值为:85338391d88b5d57da66e240ece801c7

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


package com.tencent.c.a;

import android.content.Context;
import java.lang.Thread;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import org.cocos2dx.lib.BuildConfig;
import org.json.JSONException;
import org.json.JSONObject;
public class f {
    private static com.tencent.c.a.a.g d;
    private static volatile Map<com.tencent.c.a.b.c, Long> e = new ConcurrentHashMap();
    private static volatile Map<String, Properties> f = new ConcurrentHashMap();
    private static volatile Map<Integer, Integer> g = new ConcurrentHashMap(10);
    private static volatile long h = 0;
    private static volatile long i = 0;
    private static volatile long j = 0;
    private static String k = BuildConfig.FLAVOR;
    private static volatile int l = 0;
    private static volatile String m = BuildConfig.FLAVOR;
    private static volatile String n = BuildConfig.FLAVOR;
    private static Map<String, Long> o = new ConcurrentHashMap();
    private static Map<String, Long> p = new ConcurrentHashMap();
    private static com.tencent.c.a.a.b q = com.tencent.c.a.a.n.b();
    private static Thread.UncaughtExceptionHandler r = null;
    private static volatile boolean s = true;
    static volatile int f779a = 0;
    static volatile long b = 0;
    private static Context t = null;
    static volatile long c = 0;

    public static int a(Context context, boolean z, g gVar) {
        long currentTimeMillis = System.currentTimeMillis();
        boolean z2 = z && currentTimeMillis - i >= ((long) c.d());
        i = currentTimeMillis;
        if (j == 0) {
            j = com.tencent.c.a.a.n.c();
        }
        if (currentTimeMillis >= j) {
            j = com.tencent.c.a.a.n.c();
            if (s.a(context).b(context).d() != 1) {
                s.a(context).b(context).a(1);
            }
            c.c(0);
            f779a = 0;
            k = com.tencent.c.a.a.n.a(0);
            z2 = true;
        }
        String str = k;
        if (com.tencent.c.a.a.n.a(gVar)) {
            str = gVar.c() + k;
        }
        if (!p.containsKey(str)) {
            z2 = true;
        }
        if (z2) {
            if (com.tencent.c.a.a.n.a(gVar)) {
                a(context, gVar);
            } else if (c.p() < c.n()) {
                com.tencent.c.a.a.n.u(context);
                a(context, (g) null);
            } else {
                q.f("Exceed StatConfig.getMaxDaySessionNumbers().");
            }
            p.put(str, 1L);
        }
        if (s) {
            f(context);
            s = false;
        }
        return l;
    }

    public static Context a(Context context) {
        return context != null ? context : t;
    }

    public static void a(Context context, int i2) {
        com.tencent.c.a.a.b bVar;
        String str;
        if (c.c()) {
            if (c.b()) {
                com.tencent.c.a.a.b bVar2 = q;
                bVar2.b("commitEvents, maxNumber=" + i2);
            }
            Context a2 = a(context);
            if (a2 == null) {
                bVar = q;
                str = "The Context of StatService.commitEvents() can not be null!";
            } else if (i2 >= -1 && i2 != 0) {
                if (h.a(t).f() && d(a2) != null) {
                    d.a(new i(a2, i2));
                    return;
                }
                return;
            } else {
                bVar = q;
                str = "The maxNumber of StatService.commitEvents() should be -1 or bigger than 0.";
            }
            bVar.e(str);
        }
    }

    static void a(Context context, g gVar) {
        if (d(context) != null) {
            if (c.b()) {
                q.h("start new session.");
            }
            if (gVar == null || l == 0) {
                l = com.tencent.c.a.a.n.a();
            }
            c.b(0);
            c.o();
            new o(new com.tencent.c.a.b.h(context, l, b(), gVar)).a();
        }
    }

    public static void a(Context context, String str, Properties properties, g gVar) {
        com.tencent.c.a.a.b bVar;
        String str2;
        if (c.c()) {
            Context a2 = a(context);
            if (a2 == null) {
                bVar = q;
                str2 = "The Context of StatService.trackCustomEvent() can not be null!";
            } else if (!a(str)) {
                com.tencent.c.a.b.c cVar = new com.tencent.c.a.b.c(str, null, properties);
                if (d(a2) != null) {
                    d.a(new ap(a2, gVar, cVar));
                    return;
                }
                return;
            } else {
                bVar = q;
                str2 = "The event_id of StatService.trackCustomEvent() can not be null or empty.";
            }
            bVar.e(str2);
        }
    }

    public static void a(Context context, Throwable th) {
        if (c.c()) {
            Context a2 = a(context);
            if (a2 == null) {
                q.e("The Context of StatService.reportSdkSelfException() can not be null!");
            } else if (d(a2) != null) {
                d.a(new an(a2, th));
            }
        }
    }

    public static boolean a() {
        if (f779a >= 2) {
            b = System.currentTimeMillis();
            return true;
        }
        return false;
    }

    public static boolean a(Context context, String str, String str2, g gVar) {
        try {
            if (!c.c()) {
                q.e("MTA StatService is disable.");
                return false;
            }
            if (c.b()) {
                q.h("MTA SDK version, current: 2.0.4 ,required: " + str2);
            }
            if (context != null && str2 != null) {
                if (com.tencent.c.a.a.n.b("2.0.4") >= com.tencent.c.a.a.n.b(str2)) {
                    String b2 = c.b(context);
                    if (b2 == null || b2.length() == 0) {
                        c.a("-");
                    }
                    if (str != null) {
                        c.a(context, str);
                    }
                    if (d(context) != null) {
                        d.a(new l(context, gVar));
                        return true;
                    }
                    return true;
                }
                q.e(("MTA SDK version conflicted, current: 2.0.4,required: " + str2) + ". please delete the current SDK and download the latest one. official website: http://mta.qq.com/ or http://mta.oa.com/");
                c.a(false);
                return false;
            }
            q.e("Context or mtaSdkVersion in StatService.startStatService() is null, please check it!");
            c.a(false);
            return false;
        } catch (Throwable th) {
            q.b(th);
            return false;
        }
    }

    static boolean a(String str) {
        return str == null || str.length() == 0;
    }

    public static Properties b(String str) {
        return f.get(str);
    }

    static JSONObject b() {
        JSONObject jSONObject = new JSONObject();
        try {
            JSONObject jSONObject2 = new JSONObject();
            if (c.b.d != 0) {
                jSONObject2.put("v", c.b.d);
            }
            jSONObject.put(Integer.toString(c.b.f761a), jSONObject2);
            JSONObject jSONObject3 = new JSONObject();
            if (c.f777a.d != 0) {
                jSONObject3.put("v", c.f777a.d);
            }
            jSONObject.put(Integer.toString(c.f777a.f761a), jSONObject3);
        } catch (JSONException e2) {
            q.b((Throwable) e2);
        }
        return jSONObject;
    }

    static synchronized void b(Context context) {
        synchronized (f.class) {
            if (context == null) {
                return;
            }
            if (d == null) {
                if (!c(context)) {
                    return;
                }
                Context applicationContext = context.getApplicationContext();
                t = applicationContext;
                d = new com.tencent.c.a.a.g();
                k = com.tencent.c.a.a.n.a(0);
                h = System.currentTimeMillis() + c.i;
                d.a(new am(applicationContext));
            }
        }
    }

    public static void c() {
        f779a = 0;
        b = 0L;
    }

    static boolean c(Context context) {
        boolean z;
        long a2 = com.tencent.c.a.a.s.a(context, c.c, 0L);
        long b2 = com.tencent.c.a.a.n.b("2.0.4");
        if (b2 <= a2) {
            com.tencent.c.a.a.b bVar = q;
            bVar.e("MTA is disable for current version:" + b2 + ",wakeup version:" + a2);
            z = false;
        } else {
            z = true;
        }
        long a3 = com.tencent.c.a.a.s.a(context, c.d, 0L);
        if (a3 > System.currentTimeMillis()) {
            com.tencent.c.a.a.b bVar2 = q;
            bVar2.e("MTA is disable for current time:" + System.currentTimeMillis() + ",wakeup time:" + a3);
            z = false;
        }
        c.a(z);
        return z;
    }

    static com.tencent.c.a.a.g d(Context context) {
        if (d == null) {
            synchronized (f.class) {
                if (d == null) {
                    b(context);
                }
            }
        }
        return d;
    }

    public static void d() {
        f779a++;
        b = System.currentTimeMillis();
        g(t);
    }

    public static void e(Context context) {
        if (c.c()) {
            Context a2 = a(context);
            if (a2 == null) {
                q.e("The Context of StatService.sendNetworkDetector() can not be null!");
                return;
            }
            try {
                aj.b(a2).a(new com.tencent.c.a.b.f(a2), new ao());
            } catch (Throwable th) {
                q.b(th);
            }
        }
    }

    public static void f(Context context) {
        if (c.c()) {
            Context a2 = a(context);
            if (a2 == null) {
                q.e("The Context of StatService.testSpeed() can not be null!");
            } else if (d(a2) != null) {
                d.a(new j(a2));
            }
        }
    }

    public static void g(Context context) {
        if (c.c() && c.n > 0) {
            Context a2 = a(context);
            if (a2 == null) {
                q.e("The Context of StatService.testSpeed() can not be null!");
            } else {
                s.a(a2).c();
            }
        }
    }

    public static void h(Context context) {
        c = System.currentTimeMillis() + (c.k() * 60000);
        com.tencent.c.a.a.s.b(context, "last_period_ts", c);
        a(context, -1);
    }
}