智慧考勤 v1.0.28版本的 MD5 值为:12729d810518c958a6eb8d5a86a946dd

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


package com.loc;

import android.content.Context;
import android.text.TextUtils;
import android.util.SparseArray;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClientOption;
import com.autonavi.aps.amapapi.model.AMapLocationServer;
import com.meizu.cloud.pushsdk.notification.model.NotificationStyle;
import com.xiaomi.mipush.sdk.Constants;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
public final class dl {
    public SparseArray<Long> a = new SparseArray<>();
    public int b = -1;
    public long c = 0;
    String[] d = {"ol", "cl", "gl", "ha", NotificationStyle.BASE_STYLE, "ds"};
    public int e = -1;
    public long f = -1;
    private static List<bv> h = new ArrayList();
    private static JSONArray i = null;
    static AMapLocation g = null;

    public static class AnonymousClass1 {
        static final int[] a;

        static {
            int[] iArr = new int[AMapLocationClientOption.AMapLocationMode.values().length];
            a = iArr;
            try {
                iArr[AMapLocationClientOption.AMapLocationMode.Battery_Saving.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[AMapLocationClientOption.AMapLocationMode.Device_Sensors.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[AMapLocationClientOption.AMapLocationMode.Hight_Accuracy.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
        }
    }

    public static void a(Context context) {
        if (context != null) {
            try {
                if (df.o()) {
                    List<bv> list = h;
                    if (list != null && list.size() > 0) {
                        ArrayList arrayList = new ArrayList();
                        arrayList.addAll(h);
                        bw.a(arrayList, context);
                        h.clear();
                    }
                    f(context);
                }
            } catch (Throwable th) {
                dg.a(th, "ReportUtil", "destroy");
            }
        }
    }

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

    public static void a(Context context, long j, boolean z) {
        if (context != null) {
            try {
                if (df.o()) {
                    a(context, "O015", z ? "domestic" : "abroad", null, Long.valueOf(j).intValue(), Integer.MAX_VALUE);
                }
            } catch (Throwable th) {
                dg.a(th, "ReportUtil", "reportGPSLocUseTime");
            }
        }
    }

    public static void a(Context context, AMapLocation aMapLocation) {
        int i2;
        if (aMapLocation == null) {
            return;
        }
        try {
            if (!"GPS".equalsIgnoreCase(aMapLocation.getProvider()) && aMapLocation.getLocationType() != 1) {
                String str = a(aMapLocation) ? "abroad" : "domestic";
                String str2 = "cache";
                if (aMapLocation.getErrorCode() != 0) {
                    int errorCode = aMapLocation.getErrorCode();
                    if (errorCode == 4 || errorCode == 5 || errorCode == 6 || errorCode == 11) {
                        str2 = "net";
                    }
                    i2 = 0;
                } else {
                    int locationType = aMapLocation.getLocationType();
                    if (locationType == 5 || locationType == 6) {
                        str2 = "net";
                    }
                    i2 = 1;
                }
                a(context, "O016", str2, str, i2, Integer.MAX_VALUE);
            }
        } catch (Throwable th) {
            dg.a(th, "ReportUtil", "reportBatting");
        }
    }

    public static void a(Context context, dk dkVar) {
        String str;
        if (context != null) {
            try {
                if (df.o()) {
                    AMapLocationServer c = dkVar.c();
                    if (Cdo.a(c) && !"GPS".equalsIgnoreCase(c.getProvider())) {
                        boolean z = true;
                        if (c.getLocationType() == 1) {
                            return;
                        }
                        int intValue = Long.valueOf(dkVar.b() - dkVar.a()).intValue();
                        int intValue2 = Long.valueOf(c.k()).intValue();
                        int locationType = c.getLocationType();
                        if (locationType == 5 || locationType == 6) {
                            str = "net";
                            z = false;
                        } else {
                            str = "cache";
                        }
                        String str2 = a(c) ? "abroad" : "domestic";
                        if (!z) {
                            a(context, "O014", str2, null, intValue2, intValue);
                        }
                        a(context, "O013", str, str2, intValue, Integer.MAX_VALUE);
                    }
                }
            } catch (Throwable th) {
                dg.a(th, "ReportUtil", "reportLBSLocUseTime");
            }
        }
    }

    public static void a(Context context, String str, int i2) {
        try {
            a(context, "O009", i2, str);
        } catch (Throwable th) {
            dg.a(th, "ReportUtil", "reportDexLoadDexClass");
        }
    }

    private static void a(Context context, String str, int i2, String str2) {
        if (context != null) {
            try {
                if (df.o()) {
                    JSONObject jSONObject = new JSONObject();
                    if (!TextUtils.isEmpty(str2)) {
                        jSONObject.put("param_string_first", str2);
                    }
                    if (i2 != Integer.MAX_VALUE) {
                        jSONObject.put("param_int_first", i2);
                    }
                    a(context, str, jSONObject);
                }
            } catch (Throwable th) {
                dg.a(th, "ReportUtil", "applyStatisticsEx");
            }
        }
    }

    private static void a(Context context, String str, String str2, String str3, int i2, int i3) {
        if (context != null) {
            try {
                if (df.o()) {
                    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 (i3 != Integer.MAX_VALUE) {
                        jSONObject.put("param_int_second", i3);
                    }
                    a(context, str, jSONObject);
                }
            } catch (Throwable th) {
                dg.a(th, "ReportUtil", "applyStatisticsEx");
            }
        }
    }

    private static void a(Context context, String str, JSONObject jSONObject) {
        if (context != null) {
            try {
                if (df.o()) {
                    bv bvVar = new bv(context, "loc", "4.2.0", str);
                    bvVar.a(jSONObject.toString());
                    h.add(bvVar);
                    if (h.size() >= 100) {
                        ArrayList arrayList = new ArrayList();
                        arrayList.addAll(h);
                        bw.a(arrayList, context);
                        h.clear();
                    }
                }
            } catch (Throwable th) {
                dg.a(th, "ReportUtil", "applyStatistics");
            }
        }
    }

    public static void a(AMapLocation aMapLocation, AMapLocation aMapLocation2) {
        try {
            if (g == null) {
                if (!Cdo.a(aMapLocation)) {
                    g = aMapLocation2;
                    return;
                }
                g = aMapLocation.m38clone();
            }
            if (Cdo.a(g) && Cdo.a(aMapLocation2)) {
                AMapLocation m38clone = aMapLocation2.m38clone();
                if (g.getLocationType() != 1 && g.getLocationType() != 9 && !"gps".equalsIgnoreCase(g.getProvider()) && g.getLocationType() != 7 && m38clone.getLocationType() != 1 && m38clone.getLocationType() != 9 && !"gps".equalsIgnoreCase(m38clone.getProvider()) && m38clone.getLocationType() != 7) {
                    long abs = Math.abs(m38clone.getTime() - g.getTime()) / 1000;
                    if (abs <= 0) {
                        abs = 1;
                    }
                    if (abs <= 1800) {
                        float a = Cdo.a(g, m38clone);
                        float f = a / ((float) abs);
                        if (a > 30000.0f && f > 1000.0f) {
                            StringBuilder sb = new StringBuilder();
                            sb.append(g.getLatitude());
                            sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
                            sb.append(g.getLongitude());
                            sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
                            sb.append(g.getAccuracy());
                            sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
                            sb.append(g.getLocationType());
                            sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
                            if (aMapLocation.getTime() != 0) {
                                sb.append(Cdo.a(g.getTime(), "yyyyMMdd_HH:mm:ss:SS"));
                            } else {
                                sb.append(g.getTime());
                            }
                            sb.append("#");
                            sb.append(m38clone.getLatitude());
                            sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
                            sb.append(m38clone.getLongitude());
                            sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
                            sb.append(m38clone.getAccuracy());
                            sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
                            sb.append(m38clone.getLocationType());
                            sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
                            if (m38clone.getTime() != 0) {
                                sb.append(Cdo.a(m38clone.getTime(), "yyyyMMdd_HH:mm:ss:SS"));
                            } else {
                                sb.append(m38clone.getTime());
                            }
                            a("bigshiftstatistics", sb.toString());
                            sb.delete(0, sb.length());
                        }
                    }
                }
                g = m38clone;
            }
        } catch (Throwable unused) {
        }
    }

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

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

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

    public static void a(String str, Throwable th) {
        try {
            if (th instanceof k) {
                ai.a(dg.b(), str, (k) th);
            }
        } catch (Throwable unused) {
        }
    }

    public static boolean a(Context context, u uVar) {
        try {
            return av.b(context, uVar);
        } catch (Throwable unused) {
            return false;
        }
    }

    private static boolean a(AMapLocation aMapLocation) {
        return Cdo.a(aMapLocation) ? !dg.a(aMapLocation.getLatitude(), aMapLocation.getLongitude()) : "http://abroad.apilocate.amap.com/mobile/binary".equals(dg.a);
    }

    public static void b(Context context, AMapLocation aMapLocation) {
        try {
            if (!Cdo.a(aMapLocation)) {
                return;
            }
            int locationType = aMapLocation.getLocationType();
            int i2 = 2;
            boolean z = false;
            if (locationType == 1) {
                i2 = 0;
            } else if (locationType == 2 || locationType == 4) {
                i2 = 1;
            } else if (locationType == 8) {
                i2 = 3;
            } else if (locationType != 9) {
                i2 = 0;
                if (z) {
                    return;
                }
                if (i == null) {
                    i = new JSONArray();
                }
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("lon", Cdo.c(aMapLocation.getLongitude()));
                jSONObject.put("lat", Cdo.c(aMapLocation.getLatitude()));
                jSONObject.put("type", i2);
                jSONObject.put("timestamp", Cdo.a());
                if (i2 == 0) {
                    JSONObject jSONObject2 = new JSONObject();
                    jSONObject2.put("accuracy", Cdo.b(aMapLocation.getAccuracy()));
                    jSONObject2.put("altitude", Cdo.b(aMapLocation.getAltitude()));
                    jSONObject2.put("bearing", Cdo.b(aMapLocation.getBearing()));
                    jSONObject2.put("speed", Cdo.b(aMapLocation.getSpeed()));
                    jSONObject.put("extension", jSONObject2);
                }
                JSONArray put = i.put(jSONObject);
                i = put;
                if (put.length() >= df.p()) {
                    f(context);
                    return;
                }
                return;
            }
            z = true;
            if (z) {
            }
        } catch (Throwable th) {
            dg.a(th, "ReportUtil", "recordOfflineLocLog");
        }
    }

    public static void b(Context context, String str, int i2) {
        try {
            a(context, "O010", i2, str);
        } catch (Throwable th) {
            dg.a(th, "ReportUtil", "reportDexFunction");
        }
    }

    private static void f(Context context) {
        try {
            JSONArray jSONArray = i;
            if (jSONArray == null || jSONArray.length() <= 0) {
                return;
            }
            bu.a(new bt(context, dg.b(), i.toString()), context);
            i = null;
        } catch (Throwable th) {
            dg.a(th, "ReportUtil", "writeOfflineLocLog");
        }
    }

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

    public final void a(Context context, AMapLocationClientOption aMapLocationClientOption) {
        try {
            int i2 = AnonymousClass1.a[aMapLocationClientOption.getLocationMode().ordinal()];
            int i3 = 3;
            if (i2 == 1) {
                i3 = 4;
            } else if (i2 == 2) {
                i3 = 5;
            } else if (i2 != 3) {
                i3 = -1;
            }
            int i4 = this.e;
            if (i4 == i3) {
                return;
            }
            if (i4 != -1 && i4 != i3) {
                this.a.append(this.e, Long.valueOf((Cdo.b() - this.f) + this.a.get(this.e, 0L).longValue()));
            }
            this.f = Cdo.b() - dn.b(context, "pref", this.d[i3], 0L);
            this.e = i3;
        } catch (Throwable th) {
            dg.a(th, "ReportUtil", "setLocationMode");
        }
    }

    public final void b(Context context) {
        try {
            long b = Cdo.b() - this.c;
            int i2 = this.b;
            if (i2 != -1) {
                this.a.append(this.b, Long.valueOf(b + this.a.get(i2, 0L).longValue()));
            }
            long b2 = Cdo.b() - this.f;
            int i3 = this.e;
            if (i3 != -1) {
                this.a.append(this.e, Long.valueOf(b2 + this.a.get(i3, 0L).longValue()));
            }
            for (int i4 = 0; i4 < this.d.length; i4++) {
                long longValue = this.a.get(i4, 0L).longValue();
                if (longValue > 0 && longValue > dn.b(context, "pref", this.d[i4], 0L)) {
                    dn.a(context, "pref", this.d[i4], longValue);
                }
            }
        } catch (Throwable th) {
            dg.a(th, "ReportUtil", "saveLocationTypeAndMode");
        }
    }

    public final int c(Context context) {
        try {
            long b = dn.b(context, "pref", this.d[2], 0L);
            long b2 = dn.b(context, "pref", this.d[0], 0L);
            long b3 = dn.b(context, "pref", this.d[1], 0L);
            if (b == 0 && b2 == 0 && b3 == 0) {
                return -1;
            }
            long j = b2 - b;
            long j2 = b3 - b;
            return b > j ? b > j2 ? 2 : 1 : j > j2 ? 0 : 1;
        } catch (Throwable unused) {
            return -1;
        }
    }

    public final int d(Context context) {
        try {
            long b = dn.b(context, "pref", this.d[3], 0L);
            long b2 = dn.b(context, "pref", this.d[4], 0L);
            long b3 = dn.b(context, "pref", this.d[5], 0L);
            if (b == 0 && b2 == 0 && b3 == 0) {
                return -1;
            }
            return b > b2 ? b > b3 ? 3 : 5 : b2 > b3 ? 4 : 5;
        } catch (Throwable unused) {
            return -1;
        }
    }

    public final void e(Context context) {
        int i2 = 0;
        while (true) {
            try {
                String[] strArr = this.d;
                if (i2 >= strArr.length) {
                    return;
                }
                dn.a(context, "pref", strArr[i2], 0L);
                i2++;
            } catch (Throwable unused) {
                return;
            }
        }
    }
}