鳯华 v4.0.0版本的 MD5 值为:e66eea5d0a772ef117f7e252dfbb1dfc

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


package h5;

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.zhihu.matisse.filter.Filter;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
public final class q2 {
    private static List<y0> f15092g = new ArrayList();
    private static JSONArray f15093h = null;
    static AMapLocation f15094i = null;
    public SparseArray<Long> f15095a = new SparseArray<>();
    public int f15096b = -1;
    public long f15097c = 0;
    String[] f15098d = {"ol", "cl", "gl", "ha", "bs", "ds"};
    public int f15099e = -1;
    public long f15100f = -1;

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

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

    public static void a(Context context) {
        if (context != null) {
            try {
                if (k2.M()) {
                    List<y0> list = f15092g;
                    if (list != null && list.size() > 0) {
                        ArrayList arrayList = new ArrayList();
                        arrayList.addAll(f15092g);
                        z0.e(arrayList, context);
                        f15092g.clear();
                    }
                    y(context);
                }
            } catch (Throwable th) {
                l2.h(th, "ReportUtil", "destroy");
            }
        }
    }

    public static void c(Context context, int i9, int i10, long j9, long j10) {
        if (i9 == -1 || i10 == -1 || context == null) {
            return;
        }
        try {
            if (k2.M()) {
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("param_int_first", i9);
                jSONObject.put("param_int_second", i10);
                jSONObject.put("param_long_first", j9);
                jSONObject.put("param_long_second", j10);
                k(context, "O012", jSONObject);
            }
        } catch (Throwable th) {
            try {
                l2.h(th, "ReportUtil", "applyStatisticsEx");
            } catch (Throwable th2) {
                l2.h(th2, "ReportUtil", "reportServiceAliveTime");
            }
        }
    }

    public static void d(Context context, long j9, boolean z9) {
        if (context != null) {
            try {
                if (k2.M()) {
                    j(context, "O015", z9 ? "domestic" : "abroad", null, Long.valueOf(j9).intValue(), Filter.MAX);
                }
            } catch (Throwable th) {
                l2.h(th, "ReportUtil", "reportGPSLocUseTime");
            }
        }
    }

    public static void e(Context context, AMapLocation aMapLocation) {
        int i9;
        if (aMapLocation == null) {
            return;
        }
        try {
            if (!"gps".equalsIgnoreCase(aMapLocation.getProvider()) && aMapLocation.getLocationType() != 1) {
                String str = r(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";
                    }
                    i9 = 0;
                } else {
                    int locationType = aMapLocation.getLocationType();
                    if (locationType == 5 || locationType == 6) {
                        str2 = "net";
                    }
                    i9 = 1;
                }
                j(context, "O016", str2, str, i9, Filter.MAX);
            }
        } catch (Throwable th) {
            l2.h(th, "ReportUtil", "reportBatting");
        }
    }

    public static void g(Context context, p2 p2Var) {
        String str;
        if (context != null) {
            try {
                if (k2.M()) {
                    AMapLocationServer f9 = p2Var.f();
                    if (t2.p(f9) && !"gps".equalsIgnoreCase(f9.getProvider())) {
                        boolean z9 = true;
                        if (f9.getLocationType() == 1) {
                            return;
                        }
                        int intValue = Long.valueOf(p2Var.d() - p2Var.a()).intValue();
                        int intValue2 = Long.valueOf(f9.k()).intValue();
                        int locationType = f9.getLocationType();
                        if (locationType == 5 || locationType == 6) {
                            z9 = false;
                            str = "net";
                        } else {
                            str = "cache";
                        }
                        String str2 = r(f9) ? "abroad" : "domestic";
                        if (!z9) {
                            j(context, "O014", str2, null, intValue2, intValue);
                        }
                        j(context, "O013", str, str2, intValue, Filter.MAX);
                    }
                }
            } catch (Throwable th) {
                l2.h(th, "ReportUtil", "reportLBSLocUseTime");
            }
        }
    }

    public static void h(Context context, String str, int i9) {
        try {
            i(context, "O009", i9, str);
        } catch (Throwable th) {
            l2.h(th, "ReportUtil", "reportDexLoadDexClass");
        }
    }

    private static void i(Context context, String str, int i9, String str2) {
        if (context != null) {
            try {
                if (k2.M()) {
                    JSONObject jSONObject = new JSONObject();
                    if (!TextUtils.isEmpty(str2)) {
                        jSONObject.put("param_string_first", str2);
                    }
                    if (i9 != Integer.MAX_VALUE) {
                        jSONObject.put("param_int_first", i9);
                    }
                    k(context, str, jSONObject);
                }
            } catch (Throwable th) {
                l2.h(th, "ReportUtil", "applyStatisticsEx");
            }
        }
    }

    private static void j(Context context, String str, String str2, String str3, int i9, int i10) {
        if (context != null) {
            try {
                if (k2.M()) {
                    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 (i9 != Integer.MAX_VALUE) {
                        jSONObject.put("param_int_first", i9);
                    }
                    if (i10 != Integer.MAX_VALUE) {
                        jSONObject.put("param_int_second", i10);
                    }
                    k(context, str, jSONObject);
                }
            } catch (Throwable th) {
                l2.h(th, "ReportUtil", "applyStatisticsEx");
            }
        }
    }

    private static void k(Context context, String str, JSONObject jSONObject) {
        if (context != null) {
            try {
                if (k2.M()) {
                    y0 y0Var = new y0(context, "loc", "4.3.0", str);
                    y0Var.a(jSONObject.toString());
                    f15092g.add(y0Var);
                    if (f15092g.size() >= 100) {
                        ArrayList arrayList = new ArrayList();
                        arrayList.addAll(f15092g);
                        z0.e(arrayList, context);
                        f15092g.clear();
                    }
                }
            } catch (Throwable th) {
                l2.h(th, "ReportUtil", "applyStatistics");
            }
        }
    }

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

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

    public static void n(String str, String str2) {
        try {
            k.k(l2.m(), str2, str);
        } catch (Throwable th) {
            l2.h(th, "ReportUtil", "reportLog");
        }
    }

    public static void o(String str, String str2, String str3) {
        try {
            k.i(l2.m(), "/mobile/binary", str3, str, str2);
        } catch (Throwable unused) {
        }
    }

    public static void p(String str, Throwable th) {
        try {
            if (th instanceof b3) {
                k.h(l2.m(), str, (b3) th);
            }
        } catch (Throwable unused) {
        }
    }

    public static boolean q(Context context, m3 m3Var) {
        try {
            return x.j(context, m3Var);
        } catch (Throwable unused) {
            return false;
        }
    }

    private static boolean r(AMapLocation aMapLocation) {
        return t2.o(aMapLocation) ? !l2.i(aMapLocation.getLatitude(), aMapLocation.getLongitude()) : "http://abroad.apilocate.amap.com/mobile/binary".equals(l2.f14957a);
    }

    public static void t(Context context, AMapLocation aMapLocation) {
        int i9;
        try {
            if (!t2.o(aMapLocation)) {
                return;
            }
            int locationType = aMapLocation.getLocationType();
            int i10 = 0;
            if (locationType != 1) {
                if (locationType == 2 || locationType == 4) {
                    i9 = 1;
                    i10 = 1;
                } else if (locationType == 8) {
                    i10 = 3;
                } else if (locationType != 9) {
                    i9 = 0;
                } else {
                    i9 = 2;
                    i10 = 1;
                }
                if (i10 == 0) {
                    if (f15093h == null) {
                        f15093h = new JSONArray();
                    }
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("lon", t2.I(aMapLocation.getLongitude()));
                    jSONObject.put("lat", t2.I(aMapLocation.getLatitude()));
                    jSONObject.put("type", i9);
                    jSONObject.put("timestamp", t2.h());
                    if (aMapLocation.getCoordType().equalsIgnoreCase(AMapLocation.COORD_TYPE_WGS84)) {
                        jSONObject.put("coordType", 1);
                    } else {
                        jSONObject.put("coordType", 2);
                    }
                    if (i9 == 0) {
                        JSONObject jSONObject2 = new JSONObject();
                        jSONObject2.put("accuracy", t2.x(aMapLocation.getAccuracy()));
                        jSONObject2.put("altitude", t2.x(aMapLocation.getAltitude()));
                        jSONObject2.put("bearing", t2.x(aMapLocation.getBearing()));
                        jSONObject2.put("speed", t2.x(aMapLocation.getSpeed()));
                        jSONObject.put("extension", jSONObject2);
                    }
                    JSONArray put = f15093h.put(jSONObject);
                    f15093h = put;
                    if (put.length() >= k2.N()) {
                        y(context);
                        return;
                    }
                    return;
                }
                return;
            }
            i9 = i10;
            i10 = 1;
            if (i10 == 0) {
            }
        } catch (Throwable th) {
            l2.h(th, "ReportUtil", "recordOfflineLocLog");
        }
    }

    public static void u(Context context, String str, int i9) {
        try {
            i(context, "O010", i9, str);
        } catch (Throwable th) {
            l2.h(th, "ReportUtil", "reportDexFunction");
        }
    }

    private static void y(Context context) {
        try {
            JSONArray jSONArray = f15093h;
            if (jSONArray == null || jSONArray.length() <= 0) {
                return;
            }
            x0.d(new w0(context, l2.m(), f15093h.toString()), context);
            f15093h = null;
        } catch (Throwable th) {
            l2.h(th, "ReportUtil", "writeOfflineLocLog");
        }
    }

    public final void b(Context context, int i9) {
        try {
            int i10 = this.f15096b;
            if (i10 == i9) {
                return;
            }
            if (i10 != -1 && i10 != i9) {
                this.f15095a.append(this.f15096b, Long.valueOf((t2.y() - this.f15097c) + this.f15095a.get(this.f15096b, 0L).longValue()));
            }
            this.f15097c = t2.y() - s2.g(context, "pref", this.f15098d[i9], 0L);
            this.f15096b = i9;
        } catch (Throwable th) {
            l2.h(th, "ReportUtil", "setLocationType");
        }
    }

    public final void f(Context context, AMapLocationClientOption aMapLocationClientOption) {
        try {
            int i9 = a.f15101a[aMapLocationClientOption.getLocationMode().ordinal()];
            int i10 = 3;
            if (i9 == 1) {
                i10 = 4;
            } else if (i9 == 2) {
                i10 = 5;
            } else if (i9 != 3) {
                i10 = -1;
            }
            int i11 = this.f15099e;
            if (i11 == i10) {
                return;
            }
            if (i11 != -1 && i11 != i10) {
                this.f15095a.append(this.f15099e, Long.valueOf((t2.y() - this.f15100f) + this.f15095a.get(this.f15099e, 0L).longValue()));
            }
            this.f15100f = t2.y() - s2.g(context, "pref", this.f15098d[i10], 0L);
            this.f15099e = i10;
        } catch (Throwable th) {
            l2.h(th, "ReportUtil", "setLocationMode");
        }
    }

    public final void s(Context context) {
        try {
            long y9 = t2.y() - this.f15097c;
            int i9 = this.f15096b;
            if (i9 != -1) {
                this.f15095a.append(this.f15096b, Long.valueOf(y9 + this.f15095a.get(i9, 0L).longValue()));
            }
            long y10 = t2.y() - this.f15100f;
            int i10 = this.f15099e;
            if (i10 != -1) {
                this.f15095a.append(this.f15099e, Long.valueOf(y10 + this.f15095a.get(i10, 0L).longValue()));
            }
            for (int i11 = 0; i11 < this.f15098d.length; i11++) {
                long longValue = this.f15095a.get(i11, 0L).longValue();
                if (longValue > 0 && longValue > s2.g(context, "pref", this.f15098d[i11], 0L)) {
                    s2.b(context, "pref", this.f15098d[i11], longValue);
                }
            }
        } catch (Throwable th) {
            l2.h(th, "ReportUtil", "saveLocationTypeAndMode");
        }
    }

    public final int v(Context context) {
        try {
            long g9 = s2.g(context, "pref", this.f15098d[2], 0L);
            long g10 = s2.g(context, "pref", this.f15098d[0], 0L);
            long g11 = s2.g(context, "pref", this.f15098d[1], 0L);
            if (g9 == 0 && g10 == 0 && g11 == 0) {
                return -1;
            }
            long j9 = g10 - g9;
            long j10 = g11 - g9;
            return g9 > j9 ? g9 > j10 ? 2 : 1 : j9 > j10 ? 0 : 1;
        } catch (Throwable unused) {
            return -1;
        }
    }

    public final int w(Context context) {
        try {
            long g9 = s2.g(context, "pref", this.f15098d[3], 0L);
            long g10 = s2.g(context, "pref", this.f15098d[4], 0L);
            long g11 = s2.g(context, "pref", this.f15098d[5], 0L);
            if (g9 == 0 && g10 == 0 && g11 == 0) {
                return -1;
            }
            return g9 > g10 ? g9 > g11 ? 3 : 5 : g10 > g11 ? 4 : 5;
        } catch (Throwable unused) {
            return -1;
        }
    }

    public final void x(Context context) {
        int i9 = 0;
        while (true) {
            try {
                String[] strArr = this.f15098d;
                if (i9 >= strArr.length) {
                    return;
                }
                s2.b(context, "pref", strArr[i9], 0L);
                i9++;
            } catch (Throwable unused) {
                return;
            }
        }
    }
}