小源钱包 v1.0.0版本的 MD5 值为:2fddb51fa9867693f901004082511bea

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


package com.loc;

import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.util.SparseArray;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClientOption;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import p6.p2;
import p6.v2;
public final class n1 {
    private static List<c0> f14363g = new ArrayList();
    private static JSONArray f14364h = null;
    static AMapLocation f14365i = null;
    static boolean f14366j = false;
    public SparseArray<Long> f14367a = new SparseArray<>();
    public int f14368b = -1;
    public long f14369c = 0;
    String[] f14370d = {"ol", "cl", "gl", "ha", "bs", "ds"};
    public int f14371e = -1;
    public long f14372f = -1;

    static class a {
        static final int[] f14373a;

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

    private static String a(int i10) {
        if (i10 != 2011) {
            if (i10 != 2031) {
                if (i10 != 2041) {
                    if (i10 != 2081) {
                        if (i10 != 2091) {
                            if (i10 != 2111) {
                                if (i10 != 2121) {
                                    if (i10 != 2141) {
                                        if (i10 != 2021) {
                                            if (i10 != 2022) {
                                                if (i10 != 2061) {
                                                    if (i10 != 2062) {
                                                        switch (i10) {
                                                            case 2051:
                                                                return "NeedLoginNetWork\t";
                                                            case 2052:
                                                                return "MaybeIntercepted";
                                                            case 2053:
                                                                return "DecryptResponseException";
                                                            case 2054:
                                                                return "ParserDataException";
                                                            default:
                                                                switch (i10) {
                                                                    case 2101:
                                                                        return "BindAPSServiceException";
                                                                    case 2102:
                                                                        return "AuthClientScodeFail";
                                                                    case 2103:
                                                                        return "NotConfigAPSService";
                                                                    default:
                                                                        switch (i10) {
                                                                            case 2131:
                                                                                return "NoCgiOAndWifiInfo";
                                                                            case 2132:
                                                                                return "AirPlaneModeAndWifiOff";
                                                                            case 2133:
                                                                                return "NoCgiAndWifiOff";
                                                                            default:
                                                                                switch (i10) {
                                                                                    case 2151:
                                                                                        return "MaybeMockNetLoc";
                                                                                    case 2152:
                                                                                        return "MaybeMockGPSLoc";
                                                                                    case 2153:
                                                                                        return "UNSUPPORT_COARSE_LBSLOC";
                                                                                    case 2154:
                                                                                        return "UNSUPPORT_CONTINUE_LOC";
                                                                                    default:
                                                                                        return "";
                                                                                }
                                                                        }
                                                                }
                                                        }
                                                    }
                                                    return "ServerLocFail";
                                                }
                                                return "ServerRetypeError";
                                            }
                                            return "OnlyOneWifiButNotMain";
                                        }
                                        return "OnlyMainWifi";
                                    }
                                    return "NoEnoughStatellites";
                                }
                                return "NotLocPermission";
                            }
                            return "ErrorCgiInfo";
                        }
                        return "InitException";
                    }
                    return "LocalLocException";
                }
                return "ResponseResultIsNull";
            }
            return "CreateApsReqException";
        }
        return "ContextIsNull";
    }

    public static void b(long j10, long j11) {
        try {
            if (f14366j) {
                return;
            }
            StringBuffer stringBuffer = new StringBuffer();
            stringBuffer.append("gpsTime:");
            stringBuffer.append(o1.i(j10, "yyyy-MM-dd HH:mm:ss.SSS"));
            stringBuffer.append(",");
            stringBuffer.append("sysTime:");
            stringBuffer.append(o1.i(j11, "yyyy-MM-dd HH:mm:ss.SSS"));
            stringBuffer.append(",");
            long L = k1.L();
            int i10 = (0L > L ? 1 : (0L == L ? 0 : -1));
            String i11 = i10 != 0 ? o1.i(L, "yyyy-MM-dd HH:mm:ss.SSS") : "0";
            stringBuffer.append("serverTime:");
            stringBuffer.append(i11);
            q("checkgpstime", stringBuffer.toString());
            if (i10 != 0 && Math.abs(j10 - L) < 31536000000L) {
                stringBuffer.append(", correctError");
                q("checkgpstimeerror", stringBuffer.toString());
            }
            stringBuffer.delete(0, stringBuffer.length());
            f14366j = true;
        } catch (Throwable unused) {
        }
    }

    public static synchronized void c(Context context) {
        synchronized (n1.class) {
            if (context != null) {
                try {
                    if (k1.e()) {
                        List<c0> list = f14363g;
                        if (list != null && list.size() > 0) {
                            ArrayList arrayList = new ArrayList();
                            arrayList.addAll(f14363g);
                            d0.h(arrayList, context);
                            f14363g.clear();
                        }
                        z(context);
                    }
                } catch (Throwable th) {
                    l1.h(th, "ReportUtil", "destroy");
                }
            }
        }
    }

    public static void e(Context context, int i10, int i11, long j10, long j11) {
        if (i10 == -1 || i11 == -1) {
            return;
        }
        try {
            k(context, "O012", i10, i11, j10, j11);
        } catch (Throwable th) {
            l1.h(th, "ReportUtil", "reportServiceAliveTime");
        }
    }

    public static void f(Context context, long j10, boolean z10) {
        if (context != null) {
            try {
                if (k1.e()) {
                    g(context, j10, z10, "O015");
                }
            } catch (Throwable th) {
                l1.h(th, "ReportUtil", "reportGPSLocUseTime");
            }
        }
    }

    private static void g(Context context, long j10, boolean z10, String str) {
        l(context, str, !z10 ? "abroad" : "domestic", Long.valueOf(j10).intValue());
    }

    public static synchronized void h(Context context, AMapLocation aMapLocation) {
        int i10;
        synchronized (n1.class) {
            try {
                if (o1.p(aMapLocation)) {
                    int W = aMapLocation.W();
                    boolean z10 = false;
                    if (W == 1) {
                        i10 = 0;
                    } else if (W == 2 || W == 4) {
                        i10 = 1;
                    } else if (W == 11) {
                        i10 = 4;
                    } else if (W == 8) {
                        i10 = 3;
                    } else if (W != 9) {
                        i10 = 0;
                        if (z10) {
                            int l6 = k1.l();
                            if (l6 != 0) {
                                if (i10 == 0 || i10 == 4) {
                                    if (l6 == 2) {
                                        return;
                                    }
                                } else if (l6 == 1) {
                                    return;
                                }
                            }
                            if (f14364h == null) {
                                f14364h = new JSONArray();
                            }
                            JSONObject jSONObject = new JSONObject();
                            jSONObject.put("lon", o1.y(aMapLocation.getLongitude()));
                            jSONObject.put(com.umeng.analytics.pro.d.C, o1.y(aMapLocation.getLatitude()));
                            jSONObject.put("type", i10);
                            jSONObject.put("timestamp", o1.f());
                            if (aMapLocation.N().equalsIgnoreCase("WGS84")) {
                                jSONObject.put("coordType", 1);
                            } else {
                                jSONObject.put("coordType", 2);
                            }
                            if (i10 == 0) {
                                JSONObject jSONObject2 = new JSONObject();
                                jSONObject2.put("accuracy", o1.H(aMapLocation.getAccuracy()));
                                jSONObject2.put("altitude", o1.H(aMapLocation.getAltitude()));
                                jSONObject2.put("bearing", o1.H(aMapLocation.getBearing()));
                                jSONObject2.put("speed", o1.H(aMapLocation.getSpeed()));
                                jSONObject.put("extension", jSONObject2);
                            }
                            JSONArray put = f14364h.put(jSONObject);
                            f14364h = put;
                            if (put.length() >= k1.i()) {
                                z(context);
                            }
                        }
                    } else {
                        i10 = 2;
                    }
                    z10 = true;
                    if (z10) {
                    }
                }
            } catch (Throwable th) {
                l1.h(th, "ReportUtil", "recordOfflineLocLog");
            }
        }
    }

    public static void i(Context context, AMapLocation aMapLocation, er erVar) {
        int i10;
        if (aMapLocation == null) {
            return;
        }
        try {
            if (!"gps".equalsIgnoreCase(aMapLocation.getProvider()) && aMapLocation.W() != 1) {
                String str = t(aMapLocation) ? "abroad" : "domestic";
                String str2 = "cache";
                if (aMapLocation.R() != 0) {
                    int R = aMapLocation.R();
                    if (R == 4 || R == 5 || R == 6 || R == 11) {
                        str2 = "net";
                    }
                    i10 = 0;
                } else {
                    int W = aMapLocation.W();
                    if (W == 5 || W == 6) {
                        str2 = "net";
                    }
                    i10 = 1;
                }
                m(context, "O016", str2, str, i10, aMapLocation.R(), erVar);
            }
        } catch (Throwable th) {
            l1.h(th, "ReportUtil", "reportBatting");
        }
    }

    private static void k(Context context, String str, int i10, int i11, long j10, long j11) {
        if (context != null) {
            try {
                if (k1.e()) {
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("param_int_first", i10);
                    jSONObject.put("param_int_second", i11);
                    jSONObject.put("param_long_first", j10);
                    jSONObject.put("param_long_second", j11);
                    n(context, str, jSONObject);
                }
            } catch (Throwable th) {
                l1.h(th, "ReportUtil", "applyStatisticsEx");
            }
        }
    }

    private static void l(Context context, String str, String str2, int i10) {
        if (context != null) {
            try {
                if (k1.e()) {
                    JSONObject jSONObject = new JSONObject();
                    if (!TextUtils.isEmpty(str2)) {
                        jSONObject.put("param_string_first", str2);
                    }
                    if (!TextUtils.isEmpty(null)) {
                        jSONObject.put("param_string_second", (Object) null);
                    }
                    if (i10 != Integer.MAX_VALUE) {
                        jSONObject.put("param_int_first", i10);
                    }
                    n(context, str, jSONObject);
                }
            } catch (Throwable th) {
                l1.h(th, "ReportUtil", "applyStatisticsEx");
            }
        }
    }

    private static void m(Context context, String str, String str2, String str3, int i10, int i11, er erVar) {
        if (context != null) {
            try {
                if (k1.e()) {
                    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 (i10 != Integer.MAX_VALUE) {
                        jSONObject.put("param_int_first", i10);
                    }
                    if (i11 != Integer.MAX_VALUE) {
                        jSONObject.put("param_int_second", i11);
                    }
                    if (erVar != null) {
                        if (!TextUtils.isEmpty(erVar.v())) {
                            jSONObject.put("dns", erVar.v());
                        }
                        if (!TextUtils.isEmpty(erVar.y())) {
                            jSONObject.put("domain", erVar.y());
                        }
                        if (!TextUtils.isEmpty(erVar.A())) {
                            jSONObject.put("type", erVar.A());
                        }
                        if (!TextUtils.isEmpty(erVar.C())) {
                            jSONObject.put("reason", erVar.C());
                        }
                        if (!TextUtils.isEmpty(erVar.i())) {
                            jSONObject.put("ip", erVar.i());
                        }
                        if (!TextUtils.isEmpty(erVar.f())) {
                            jSONObject.put("stack", erVar.f());
                        }
                        if (erVar.D() > 0) {
                            jSONObject.put("ctime", String.valueOf(erVar.D()));
                        }
                        if (erVar.b() > 0) {
                            jSONObject.put("ntime", String.valueOf(erVar.b()));
                        }
                    }
                    n(context, str, jSONObject);
                }
            } catch (Throwable th) {
                l1.h(th, "ReportUtil", "applyStatisticsEx");
            }
        }
    }

    public static synchronized void n(Context context, String str, JSONObject jSONObject) {
        synchronized (n1.class) {
            if (context != null) {
                try {
                    if (k1.e()) {
                        c0 c0Var = new c0(context, "loc", "6.4.3", str);
                        if (jSONObject != null) {
                            c0Var.a(jSONObject.toString());
                        }
                        f14363g.add(c0Var);
                        if (f14363g.size() >= 30) {
                            ArrayList arrayList = new ArrayList();
                            arrayList.addAll(f14363g);
                            d0.h(arrayList, context);
                            f14363g.clear();
                        }
                    }
                } catch (Throwable th) {
                    l1.h(th, "ReportUtil", "applyStatistics");
                }
            }
        }
    }

    public static void o(AMapLocation aMapLocation, AMapLocation aMapLocation2) {
        try {
            if (f14365i == null) {
                if (!o1.p(aMapLocation)) {
                    f14365i = aMapLocation2;
                    return;
                }
                f14365i = aMapLocation.clone();
            }
            if (o1.p(f14365i) && o1.p(aMapLocation2)) {
                AMapLocation clone = aMapLocation2.clone();
                if (f14365i.W() != 1 && f14365i.W() != 9 && !"gps".equalsIgnoreCase(f14365i.getProvider()) && f14365i.W() != 7 && clone.W() != 1 && clone.W() != 9 && !"gps".equalsIgnoreCase(clone.getProvider()) && clone.W() != 7) {
                    long abs = Math.abs(clone.getTime() - f14365i.getTime()) / 1000;
                    if (abs <= 0) {
                        abs = 1;
                    }
                    if (abs <= 1800) {
                        float c10 = o1.c(f14365i, clone);
                        float f10 = c10 / ((float) abs);
                        if (c10 > 30000.0f && f10 > 1000.0f) {
                            StringBuilder sb = new StringBuilder();
                            sb.append(f14365i.getLatitude());
                            sb.append(",");
                            sb.append(f14365i.getLongitude());
                            sb.append(",");
                            sb.append(f14365i.getAccuracy());
                            sb.append(",");
                            sb.append(f14365i.W());
                            sb.append(",");
                            if (aMapLocation.getTime() != 0) {
                                sb.append(o1.i(f14365i.getTime(), "yyyyMMdd_HH:mm:ss:SS"));
                            } else {
                                sb.append(f14365i.getTime());
                            }
                            sb.append("#");
                            sb.append(clone.getLatitude());
                            sb.append(",");
                            sb.append(clone.getLongitude());
                            sb.append(",");
                            sb.append(clone.getAccuracy());
                            sb.append(",");
                            sb.append(clone.W());
                            sb.append(",");
                            if (clone.getTime() != 0) {
                                sb.append(o1.i(clone.getTime(), "yyyyMMdd_HH:mm:ss:SS"));
                            } else {
                                sb.append(clone.getTime());
                            }
                            q("bigshiftstatistics", sb.toString());
                            sb.delete(0, sb.length());
                        }
                    }
                }
                f14365i = clone;
            }
        } catch (Throwable unused) {
        }
    }

    public static void p(String str, int i10) {
        r(str, String.valueOf(i10), a(i10));
    }

    public static void q(String str, String str2) {
        try {
            j.l(l1.m(), str2, str);
        } catch (Throwable th) {
            l1.h(th, "ReportUtil", "reportLog");
        }
    }

    public static void r(String str, String str2, String str3) {
        try {
            j.h(l1.m(), "/mobile/binary", str3, str, str2);
        } catch (Throwable unused) {
        }
    }

    public static void s(String str, Throwable th) {
        try {
            if (th instanceof v2) {
                j.j(l1.m(), str, (v2) th);
            }
        } catch (Throwable unused) {
        }
    }

    private static boolean t(AMapLocation aMapLocation) {
        return o1.p(aMapLocation) ? !l1.i(aMapLocation.getLatitude(), aMapLocation.getLongitude()) : "http://abroad.apilocate.amap.com/mobile/binary".equals(l1.f14350c);
    }

    public static void v(Context context, long j10, boolean z10) {
        if (context != null) {
            try {
                if (k1.e()) {
                    g(context, j10, z10, "O024");
                }
            } catch (Throwable th) {
                l1.h(th, "ReportUtil", "reportCoarseLocUseTime");
            }
        }
    }

    private static void z(Context context) {
        try {
            JSONArray jSONArray = f14364h;
            if (jSONArray == null || jSONArray.length() <= 0) {
                return;
            }
            p6.x.d(new p6.w(context, l1.m(), f14364h.toString()), context);
            f14364h = null;
        } catch (Throwable th) {
            l1.h(th, "ReportUtil", "writeOfflineLocLog");
        }
    }

    public final void d(Context context, int i10) {
        try {
            int i11 = this.f14368b;
            if (i11 == i10) {
                return;
            }
            if (i11 != -1 && i11 != i10) {
                this.f14367a.append(this.f14368b, Long.valueOf((o1.A() - this.f14369c) + this.f14367a.get(this.f14368b, 0L).longValue()));
            }
            this.f14369c = o1.A() - p2.b(context, "pref1", this.f14370d[i10], 0L);
            this.f14368b = i10;
        } catch (Throwable th) {
            l1.h(th, "ReportUtil", "setLocationType");
        }
    }

    public final void j(Context context, AMapLocationClientOption aMapLocationClientOption) {
        try {
            int i10 = a.f14373a[aMapLocationClientOption.A().ordinal()];
            int i11 = 3;
            if (i10 == 1) {
                i11 = 4;
            } else if (i10 == 2) {
                i11 = 5;
            } else if (i10 != 3) {
                i11 = -1;
            }
            int i12 = this.f14371e;
            if (i12 == i11) {
                return;
            }
            if (i12 != -1 && i12 != i11) {
                this.f14367a.append(this.f14371e, Long.valueOf((o1.A() - this.f14372f) + this.f14367a.get(this.f14371e, 0L).longValue()));
            }
            this.f14372f = o1.A() - p2.b(context, "pref1", this.f14370d[i11], 0L);
            this.f14371e = i11;
        } catch (Throwable th) {
            l1.h(th, "ReportUtil", "setLocationMode");
        }
    }

    public final void u(Context context) {
        try {
            long A = o1.A() - this.f14369c;
            int i10 = this.f14368b;
            if (i10 != -1) {
                this.f14367a.append(this.f14368b, Long.valueOf(A + this.f14367a.get(i10, 0L).longValue()));
            }
            long A2 = o1.A() - this.f14372f;
            int i11 = this.f14371e;
            if (i11 != -1) {
                this.f14367a.append(this.f14371e, Long.valueOf(A2 + this.f14367a.get(i11, 0L).longValue()));
            }
            SharedPreferences.Editor c10 = p2.c(context, "pref1");
            for (int i12 = 0; i12 < this.f14370d.length; i12++) {
                long longValue = this.f14367a.get(i12, 0L).longValue();
                if (longValue > 0 && longValue > p2.b(context, "pref1", this.f14370d[i12], 0L)) {
                    p2.i(c10, this.f14370d[i12], longValue);
                }
            }
            p2.f(c10);
        } catch (Throwable th) {
            l1.h(th, "ReportUtil", "saveLocationTypeAndMode");
        }
    }

    public final int w(Context context) {
        try {
            long b10 = p2.b(context, "pref1", this.f14370d[2], 0L);
            long b11 = p2.b(context, "pref1", this.f14370d[0], 0L);
            long b12 = p2.b(context, "pref1", this.f14370d[1], 0L);
            if (b10 == 0 && b11 == 0 && b12 == 0) {
                return -1;
            }
            long j10 = b11 - b10;
            long j11 = b12 - b10;
            return b10 > j10 ? b10 > j11 ? 2 : 1 : j10 > j11 ? 0 : 1;
        } catch (Throwable unused) {
            return -1;
        }
    }

    public final int x(Context context) {
        try {
            long b10 = p2.b(context, "pref1", this.f14370d[3], 0L);
            long b11 = p2.b(context, "pref1", this.f14370d[4], 0L);
            long b12 = p2.b(context, "pref1", this.f14370d[5], 0L);
            if (b10 == 0 && b11 == 0 && b12 == 0) {
                return -1;
            }
            return b10 > b11 ? b10 > b12 ? 3 : 5 : b11 > b12 ? 4 : 5;
        } catch (Throwable unused) {
            return -1;
        }
    }

    public final void y(Context context) {
        try {
            SharedPreferences.Editor c10 = p2.c(context, "pref1");
            int i10 = 0;
            while (true) {
                String[] strArr = this.f14370d;
                if (i10 >= strArr.length) {
                    p2.f(c10);
                    return;
                } else {
                    p2.i(c10, strArr[i10], 0L);
                    i10++;
                }
            }
        } catch (Throwable unused) {
        }
    }
}