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

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


package com.b;

import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.util.SparseArray;
import java.util.ArrayList;
import java.util.List;
import org.cocos2dx.lib.BuildConfig;
import org.json.JSONArray;
import org.json.JSONObject;
public final class dp {
    public SparseArray<Long> f571a = new SparseArray<>();
    public int b = -1;
    public long c = 0;
    String[] d = {"ol", "cl", "gl", "ha", "bs", "ds"};
    public int e = -1;
    public long f = -1;
    private static List<ab> i = new ArrayList();
    private static JSONArray j = null;
    static com.amap.api.location.a g = null;
    static boolean h = false;

    public static void a(long j2, long j3) {
        try {
            if (h) {
                return;
            }
            StringBuffer stringBuffer = new StringBuffer();
            stringBuffer.append("gpsTime:");
            stringBuffer.append(dr.a(j2, "yyyy-MM-dd HH:mm:ss.SSS"));
            stringBuffer.append(",");
            stringBuffer.append("sysTime:");
            stringBuffer.append(dr.a(j3, "yyyy-MM-dd HH:mm:ss.SSS"));
            stringBuffer.append(",");
            long u = dk.u();
            String a2 = 0 != u ? dr.a(u, "yyyy-MM-dd HH:mm:ss.SSS") : "0";
            stringBuffer.append("serverTime:");
            stringBuffer.append(a2);
            a("checkgpstime", stringBuffer.toString());
            if (0 != u && Math.abs(j2 - u) < 31536000000L) {
                stringBuffer.append(", correctError");
                a("checkgpstimeerror", stringBuffer.toString());
            }
            stringBuffer.delete(0, stringBuffer.length());
            h = true;
        } catch (Throwable unused) {
        }
    }

    public static synchronized void a(Context context) {
        synchronized (dp.class) {
            if (context != null) {
                try {
                    if (dk.a()) {
                        if (i != null && i.size() > 0) {
                            ArrayList arrayList = new ArrayList();
                            arrayList.addAll(i);
                            ac.b(arrayList, context);
                            i.clear();
                        }
                        f(context);
                    }
                } catch (Throwable th) {
                    dl.a(th, "ReportUtil", "destroy");
                }
            }
        }
    }

    public static void a(Context context, int i2, int i3, long j2, long j3) {
        if (i2 == -1 || i3 == -1 || context == null) {
            return;
        }
        try {
            if (dk.a()) {
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("param_int_first", i2);
                jSONObject.put("param_int_second", i3);
                jSONObject.put("param_long_first", j2);
                jSONObject.put("param_long_second", j3);
                a(context, "O012", jSONObject);
            }
        } catch (Throwable th) {
            try {
                dl.a(th, "ReportUtil", "applyStatisticsEx");
            } catch (Throwable th2) {
                dl.a(th2, "ReportUtil", "reportServiceAliveTime");
            }
        }
    }

    public static void a(Context context, long j2, boolean z) {
        if (context != null) {
            try {
                if (dk.a()) {
                    int intValue = Long.valueOf(j2).intValue();
                    String str = z ? "domestic" : "abroad";
                    if (context != null && dk.a()) {
                        JSONObject jSONObject = new JSONObject();
                        if (!TextUtils.isEmpty(str)) {
                            jSONObject.put("param_string_first", str);
                        }
                        if (!TextUtils.isEmpty(null)) {
                            jSONObject.put("param_string_second", (Object) null);
                        }
                        if (intValue != Integer.MAX_VALUE) {
                            jSONObject.put("param_int_first", intValue);
                        }
                        a(context, "O015", jSONObject);
                    }
                }
            } catch (Throwable th) {
                dl.a(th, "ReportUtil", "reportGPSLocUseTime");
            }
        }
    }

    public static synchronized void a(Context context, com.amap.api.location.a aVar) {
        int i2;
        synchronized (dp.class) {
            try {
                if (dr.a(aVar)) {
                    boolean z = false;
                    switch (aVar.a()) {
                        case 1:
                            i2 = 0;
                            z = true;
                            break;
                        case 2:
                        case 4:
                            i2 = 1;
                            z = true;
                            break;
                        case 3:
                        case 5:
                        case 6:
                        case 7:
                        default:
                            i2 = 0;
                            break;
                        case 8:
                            i2 = 3;
                            z = true;
                            break;
                        case 9:
                            i2 = 2;
                            z = true;
                            break;
                    }
                    if (z) {
                        int c = dk.c();
                        if (c != 0) {
                            if (i2 == 0) {
                                if (c == 2) {
                                    return;
                                }
                            } else if (c == 1) {
                                return;
                            }
                        }
                        if (j == null) {
                            j = new JSONArray();
                        }
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("lon", dr.b(aVar.getLongitude()));
                        jSONObject.put("lat", dr.b(aVar.getLatitude()));
                        jSONObject.put("type", i2);
                        jSONObject.put("timestamp", dr.a());
                        if (aVar.y().equalsIgnoreCase("WGS84")) {
                            jSONObject.put("coordType", 1);
                        } else {
                            jSONObject.put("coordType", 2);
                        }
                        if (i2 == 0) {
                            JSONObject jSONObject2 = new JSONObject();
                            jSONObject2.put("accuracy", dr.c(aVar.getAccuracy()));
                            jSONObject2.put("altitude", dr.c(aVar.getAltitude()));
                            jSONObject2.put("bearing", dr.c(aVar.getBearing()));
                            jSONObject2.put("speed", dr.c(aVar.getSpeed()));
                            jSONObject.put("extension", jSONObject2);
                        }
                        JSONArray put = j.put(jSONObject);
                        j = put;
                        if (put.length() >= dk.b()) {
                            f(context);
                        }
                    }
                }
            } catch (Throwable th) {
                dl.a(th, "ReportUtil", "recordOfflineLocLog");
            }
        }
    }

    public static void a(Context context, com.amap.api.location.a aVar, cn cnVar) {
        boolean z;
        String str;
        String str2;
        if (aVar == null) {
            return;
        }
        try {
            if (!"gps".equalsIgnoreCase(aVar.getProvider()) && aVar.a() != 1) {
                int i2 = 0;
                if (!dr.a(aVar)) {
                    z = "http://abroad.apilocate.amap.com/mobile/binary".equals(dl.f569a);
                }
                String str3 = z ? "abroad" : "domestic";
                if (aVar.c() != 0) {
                    int c = aVar.c();
                    if (c != 11) {
                        switch (c) {
                            case 4:
                            case 5:
                            case 6:
                                break;
                            default:
                                str2 = "cache";
                                break;
                        }
                    }
                    str2 = "net";
                } else {
                    switch (aVar.a()) {
                        case 5:
                        case 6:
                            str = "net";
                            break;
                        default:
                            str = "cache";
                            break;
                    }
                    str2 = str;
                    i2 = 1;
                }
                int c2 = aVar.c();
                if (context != null && dk.a()) {
                    JSONObject jSONObject = new JSONObject();
                    if (!TextUtils.isEmpty(str2)) {
                        jSONObject.put("param_string_first", str2);
                    }
                    if (!TextUtils.isEmpty(str3)) {
                        jSONObject.put("param_string_second", str3);
                    }
                    if (i2 != Integer.MAX_VALUE) {
                        jSONObject.put("param_int_first", i2);
                    }
                    if (c2 != Integer.MAX_VALUE) {
                        jSONObject.put("param_int_second", c2);
                    }
                    if (cnVar != null) {
                        if (!TextUtils.isEmpty(cnVar.d())) {
                            jSONObject.put("dns", cnVar.d());
                        }
                        if (!TextUtils.isEmpty(cnVar.e())) {
                            jSONObject.put("domain", cnVar.e());
                        }
                        if (!TextUtils.isEmpty(cnVar.f())) {
                            jSONObject.put("type", cnVar.f());
                        }
                        if (!TextUtils.isEmpty(cnVar.g())) {
                            jSONObject.put("reason", cnVar.g());
                        }
                        if (!TextUtils.isEmpty(cnVar.c())) {
                            jSONObject.put("ip", cnVar.c());
                        }
                        if (!TextUtils.isEmpty(cnVar.b())) {
                            jSONObject.put("stack", cnVar.b());
                        }
                        if (cnVar.h() > 0) {
                            jSONObject.put("ctime", String.valueOf(cnVar.h()));
                        }
                        if (cnVar.a() > 0) {
                            jSONObject.put("ntime", String.valueOf(cnVar.a()));
                        }
                    }
                    a(context, "O016", jSONObject);
                }
            }
        } catch (Throwable th) {
            dl.a(th, "ReportUtil", "reportBatting");
        }
    }

    public static synchronized void a(Context context, String str, JSONObject jSONObject) {
        synchronized (dp.class) {
            if (context != null) {
                try {
                    if (dk.a()) {
                        ab abVar = new ab(context, "loc", "5.2.0", str);
                        if (jSONObject != null) {
                            abVar.a(jSONObject.toString());
                        }
                        i.add(abVar);
                        if (i.size() >= 30) {
                            ArrayList arrayList = new ArrayList();
                            arrayList.addAll(i);
                            ac.b(arrayList, context);
                            i.clear();
                        }
                    }
                } catch (Throwable th) {
                    dl.a(th, "ReportUtil", "applyStatistics");
                }
            }
        }
    }

    public static void a(com.amap.api.location.a aVar, com.amap.api.location.a aVar2) {
        try {
            if (g == null) {
                if (!dr.a(aVar)) {
                    g = aVar2;
                    return;
                }
                g = aVar.clone();
            }
            if (dr.a(g) && dr.a(aVar2)) {
                com.amap.api.location.a clone = aVar2.clone();
                if (g.a() != 1 && g.a() != 9 && !"gps".equalsIgnoreCase(g.getProvider()) && g.a() != 7 && clone.a() != 1 && clone.a() != 9 && !"gps".equalsIgnoreCase(clone.getProvider()) && clone.a() != 7) {
                    long abs = Math.abs(clone.getTime() - g.getTime()) / 1000;
                    if (abs <= 0) {
                        abs = 1;
                    }
                    if (abs <= 1800) {
                        float a2 = dr.a(g, clone);
                        float f = a2 / ((float) abs);
                        if (a2 > 30000.0f && f > 1000.0f) {
                            StringBuilder sb = new StringBuilder();
                            sb.append(g.getLatitude());
                            sb.append(",");
                            sb.append(g.getLongitude());
                            sb.append(",");
                            sb.append(g.getAccuracy());
                            sb.append(",");
                            sb.append(g.a());
                            sb.append(",");
                            if (aVar.getTime() != 0) {
                                sb.append(dr.a(g.getTime(), "yyyyMMdd_HH:mm:ss:SS"));
                            } else {
                                sb.append(g.getTime());
                            }
                            sb.append("#");
                            sb.append(clone.getLatitude());
                            sb.append(",");
                            sb.append(clone.getLongitude());
                            sb.append(",");
                            sb.append(clone.getAccuracy());
                            sb.append(",");
                            sb.append(clone.a());
                            sb.append(",");
                            if (clone.getTime() != 0) {
                                sb.append(dr.a(clone.getTime(), "yyyyMMdd_HH:mm:ss:SS"));
                            } else {
                                sb.append(clone.getTime());
                            }
                            a("bigshiftstatistics", sb.toString());
                            sb.delete(0, sb.length());
                        }
                    }
                }
                g = clone;
            }
        } catch (Throwable unused) {
        }
    }

    public static void a(String str, int i2) {
        String valueOf = String.valueOf(i2);
        String str2 = BuildConfig.FLAVOR;
        switch (i2) {
            case 2011:
                str2 = "ContextIsNull";
                break;
            case 2021:
                str2 = "OnlyMainWifi";
                break;
            case 2022:
                str2 = "OnlyOneWifiButNotMain";
                break;
            case 2031:
                str2 = "CreateApsReqException";
                break;
            case 2041:
                str2 = "ResponseResultIsNull";
                break;
            case 2051:
                str2 = "NeedLoginNetWork\t";
                break;
            case 2052:
                str2 = "MaybeIntercepted";
                break;
            case 2053:
                str2 = "DecryptResponseException";
                break;
            case 2054:
                str2 = "ParserDataException";
                break;
            case 2061:
                str2 = "ServerRetypeError";
                break;
            case 2062:
                str2 = "ServerLocFail";
                break;
            case 2081:
                str2 = "LocalLocException";
                break;
            case 2091:
                str2 = "InitException";
                break;
            case 2101:
                str2 = "BindAPSServiceException";
                break;
            case 2102:
                str2 = "AuthClientScodeFail";
                break;
            case 2103:
                str2 = "NotConfigAPSService";
                break;
            case 2111:
                str2 = "ErrorCgiInfo";
                break;
            case 2121:
                str2 = "NotLocPermission";
                break;
            case 2131:
                str2 = "NoCgiOAndWifiInfo";
                break;
            case 2132:
                str2 = "AirPlaneModeAndWifiOff";
                break;
            case 2133:
                str2 = "NoCgiAndWifiOff";
                break;
            case 2141:
                str2 = "NoEnoughStatellites";
                break;
            case 2151:
                str2 = "MaybeMockNetLoc";
                break;
            case 2152:
                str2 = "MaybeMockGPSLoc";
                break;
        }
        a(str, valueOf, str2);
    }

    public static void a(String str, String str2) {
        try {
            b.b(dl.c(), str2, str);
        } catch (Throwable th) {
            dl.a(th, "ReportUtil", "reportLog");
        }
    }

    public static void a(String str, String str2, String str3) {
        try {
            b.a(dl.c(), "/mobile/binary", str3, str, str2);
        } catch (Throwable unused) {
        }
    }

    public static void a(String str, Throwable th) {
        try {
            if (th instanceof dz) {
                b.a(dl.c(), str, (dz) th);
            }
        } catch (Throwable unused) {
        }
    }

    private static void f(Context context) {
        try {
            if (j == null || j.length() <= 0) {
                return;
            }
            aa.a(new z(context, dl.c(), j.toString()), context);
            j = null;
        } catch (Throwable th) {
            dl.a(th, "ReportUtil", "writeOfflineLocLog");
        }
    }

    public final void a(Context context, int i2) {
        try {
            if (this.b == i2) {
                return;
            }
            if (this.b != -1 && this.b != i2) {
                this.f571a.append(this.b, Long.valueOf((dr.b() - this.c) + this.f571a.get(this.b, 0L).longValue()));
            }
            this.c = dr.b() - dq.a(context, "pref1", this.d[i2], 0L);
            this.b = i2;
        } catch (Throwable th) {
            dl.a(th, "ReportUtil", "setLocationType");
        }
    }

    public final void a(Context context, com.amap.api.location.c cVar) {
        int i2;
        try {
            switch (cVar.h()) {
                case Battery_Saving:
                    i2 = 4;
                    break;
                case Device_Sensors:
                    i2 = 5;
                    break;
                case Hight_Accuracy:
                    i2 = 3;
                    break;
                default:
                    i2 = -1;
                    break;
            }
            if (this.e == i2) {
                return;
            }
            if (this.e != -1 && this.e != i2) {
                this.f571a.append(this.e, Long.valueOf((dr.b() - this.f) + this.f571a.get(this.e, 0L).longValue()));
            }
            this.f = dr.b() - dq.a(context, "pref1", this.d[i2], 0L);
            this.e = i2;
        } catch (Throwable th) {
            dl.a(th, "ReportUtil", "setLocationMode");
        }
    }

    public final void b(Context context) {
        try {
            long b = dr.b() - this.c;
            if (this.b != -1) {
                this.f571a.append(this.b, Long.valueOf(b + this.f571a.get(this.b, 0L).longValue()));
            }
            long b2 = dr.b() - this.f;
            if (this.e != -1) {
                this.f571a.append(this.e, Long.valueOf(b2 + this.f571a.get(this.e, 0L).longValue()));
            }
            SharedPreferences.Editor a2 = dq.a(context, "pref1");
            for (int i2 = 0; i2 < this.d.length; i2++) {
                long longValue = this.f571a.get(i2, 0L).longValue();
                if (longValue > 0 && longValue > dq.a(context, "pref1", this.d[i2], 0L)) {
                    dq.a(a2, this.d[i2], longValue);
                }
            }
            dq.a(a2);
        } catch (Throwable th) {
            dl.a(th, "ReportUtil", "saveLocationTypeAndMode");
        }
    }

    public final int c(Context context) {
        try {
            long a2 = dq.a(context, "pref1", this.d[2], 0L);
            long a3 = dq.a(context, "pref1", this.d[0], 0L);
            long a4 = dq.a(context, "pref1", this.d[1], 0L);
            if (a2 == 0 && a3 == 0 && a4 == 0) {
                return -1;
            }
            long j2 = a3 - a2;
            long j3 = a4 - a2;
            return a2 > j2 ? a2 > j3 ? 2 : 1 : j2 > j3 ? 0 : 1;
        } catch (Throwable unused) {
            return -1;
        }
    }

    public final int d(Context context) {
        try {
            long a2 = dq.a(context, "pref1", this.d[3], 0L);
            long a3 = dq.a(context, "pref1", this.d[4], 0L);
            long a4 = dq.a(context, "pref1", this.d[5], 0L);
            if (a2 == 0 && a3 == 0 && a4 == 0) {
                return -1;
            }
            return a2 > a3 ? a2 > a4 ? 3 : 5 : a3 > a4 ? 4 : 5;
        } catch (Throwable unused) {
            return -1;
        }
    }

    public final void e(Context context) {
        try {
            SharedPreferences.Editor a2 = dq.a(context, "pref1");
            for (int i2 = 0; i2 < this.d.length; i2++) {
                dq.a(a2, this.d[i2], 0L);
            }
            dq.a(a2);
        } catch (Throwable unused) {
        }
    }
}