觅伊 v4.1.7版本的 MD5 值为:2a9d9e87c53524c098d85b78a90aa398

以下内容为反编译后的 fk.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 com.amap.api.services.core.AMapException;
import com.amap.api.services.geocoder.GeocodeSearch;
import com.lzy.okgo.cookie.SerializableCookie;
import com.xiaomi.mipush.sdk.Constants;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;
public final class fk {
    public SparseArray<Long> a = 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<bn> i = new ArrayList();
    private static JSONArray j = null;
    static AMapLocation g = null;
    static boolean h = false;

    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) {
            }
        }
    }

    private static String a(int i2) {
        if (i2 != 2011) {
            if (i2 != 2031) {
                if (i2 != 2041) {
                    if (i2 != 2081) {
                        if (i2 != 2091) {
                            if (i2 != 2111) {
                                if (i2 != 2121) {
                                    if (i2 != 2141) {
                                        if (i2 != 2021) {
                                            if (i2 != 2022) {
                                                if (i2 != 2061) {
                                                    if (i2 != 2062) {
                                                        if (i2 != 2151) {
                                                            if (i2 != 2152) {
                                                                switch (i2) {
                                                                    case 2051:
                                                                        return "NeedLoginNetWork\t";
                                                                    case 2052:
                                                                        return "MaybeIntercepted";
                                                                    case 2053:
                                                                        return "DecryptResponseException";
                                                                    case 2054:
                                                                        return "ParserDataException";
                                                                    default:
                                                                        switch (i2) {
                                                                            case AMapException.CODE_AMAP_NEARBY_KEY_NOT_BIND:
                                                                                return "BindAPSServiceException";
                                                                            case 2102:
                                                                                return "AuthClientScodeFail";
                                                                            case 2103:
                                                                                return "NotConfigAPSService";
                                                                            default:
                                                                                switch (i2) {
                                                                                    case 2131:
                                                                                        return "NoCgiOAndWifiInfo";
                                                                                    case 2132:
                                                                                        return "AirPlaneModeAndWifiOff";
                                                                                    case 2133:
                                                                                        return "NoCgiAndWifiOff";
                                                                                    default:
                                                                                        return "";
                                                                                }
                                                                        }
                                                                }
                                                            }
                                                            return "MaybeMockGPSLoc";
                                                        }
                                                        return "MaybeMockNetLoc";
                                                    }
                                                    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 a(long j2, long j3) {
        try {
            if (h) {
                return;
            }
            StringBuffer stringBuffer = new StringBuffer();
            stringBuffer.append("gpsTime:");
            stringBuffer.append(fm.a(j2, "yyyy-MM-dd HH:mm:ss.SSS"));
            stringBuffer.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
            stringBuffer.append("sysTime:");
            stringBuffer.append(fm.a(j3, "yyyy-MM-dd HH:mm:ss.SSS"));
            stringBuffer.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
            long t = fe.t();
            int i2 = (0L > t ? 1 : (0L == t ? 0 : -1));
            String a = i2 != 0 ? fm.a(t, "yyyy-MM-dd HH:mm:ss.SSS") : "0";
            stringBuffer.append("serverTime:");
            stringBuffer.append(a);
            a("checkgpstime", stringBuffer.toString());
            if (i2 != 0 && Math.abs(j2 - t) < 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 (fk.class) {
            if (context != null) {
                try {
                    if (fe.a()) {
                        List<bn> list = i;
                        if (list != null && list.size() > 0) {
                            ArrayList arrayList = new ArrayList();
                            arrayList.addAll(i);
                            bo.b(arrayList, context);
                            i.clear();
                        }
                        f(context);
                    }
                } catch (Throwable th) {
                    ff.a(th, "ReportUtil", "destroy");
                }
            }
        }
    }

    public static void a(Context context, int i2, int i3, long j2, long j3) {
        if (i2 == -1 || i3 == -1) {
            return;
        }
        try {
            a(context, "O012", i2, i3, j2, j3);
        } catch (Throwable th) {
            ff.a(th, "ReportUtil", "reportServiceAliveTime");
        }
    }

    public static void a(Context context, long j2, boolean z) {
        if (context != null) {
            try {
                if (fe.a()) {
                    a(context, "O015", z ? "domestic" : "abroad", Long.valueOf(j2).intValue());
                }
            } catch (Throwable th) {
                ff.a(th, "ReportUtil", "reportGPSLocUseTime");
            }
        }
    }

    public static synchronized void a(Context context, AMapLocation aMapLocation) {
        int i2;
        synchronized (fk.class) {
            try {
                if (fm.a(aMapLocation)) {
                    int locationType = aMapLocation.getLocationType();
                    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) {
                            int c = fe.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", fm.b(aMapLocation.getLongitude()));
                            jSONObject.put("lat", fm.b(aMapLocation.getLatitude()));
                            jSONObject.put("type", i2);
                            jSONObject.put("timestamp", fm.a());
                            if (aMapLocation.getCoordType().equalsIgnoreCase(AMapLocation.COORD_TYPE_WGS84)) {
                                jSONObject.put("coordType", 1);
                            } else {
                                jSONObject.put("coordType", 2);
                            }
                            if (i2 == 0) {
                                JSONObject jSONObject2 = new JSONObject();
                                jSONObject2.put("accuracy", fm.c(aMapLocation.getAccuracy()));
                                jSONObject2.put("altitude", fm.c(aMapLocation.getAltitude()));
                                jSONObject2.put("bearing", fm.c(aMapLocation.getBearing()));
                                jSONObject2.put("speed", fm.c(aMapLocation.getSpeed()));
                                jSONObject.put("extension", jSONObject2);
                            }
                            JSONArray put = j.put(jSONObject);
                            j = put;
                            if (put.length() >= fe.b()) {
                                f(context);
                            }
                        }
                    } else {
                        i2 = 2;
                    }
                    z = true;
                    if (z) {
                    }
                }
            } catch (Throwable th) {
                ff.a(th, "ReportUtil", "recordOfflineLocLog");
            }
        }
    }

    public static void a(Context context, AMapLocation aMapLocation, ee eeVar) {
        int i2;
        if (aMapLocation == null) {
            return;
        }
        try {
            if (!GeocodeSearch.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, aMapLocation.getErrorCode(), eeVar);
            }
        } catch (Throwable th) {
            ff.a(th, "ReportUtil", "reportBatting");
        }
    }

    private static void a(Context context, String str, int i2, int i3, long j2, long j3) {
        if (context != null) {
            try {
                if (fe.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, str, jSONObject);
                }
            } catch (Throwable th) {
                ff.a(th, "ReportUtil", "applyStatisticsEx");
            }
        }
    }

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

    private static void a(Context context, String str, String str2, String str3, int i2, int i3, ee eeVar) {
        if (context != null) {
            try {
                if (fe.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 (i3 != Integer.MAX_VALUE) {
                        jSONObject.put("param_int_second", i3);
                    }
                    if (eeVar != null) {
                        if (!TextUtils.isEmpty(eeVar.d())) {
                            jSONObject.put("dns", eeVar.d());
                        }
                        if (!TextUtils.isEmpty(eeVar.e())) {
                            jSONObject.put(SerializableCookie.DOMAIN, eeVar.e());
                        }
                        if (!TextUtils.isEmpty(eeVar.f())) {
                            jSONObject.put("type", eeVar.f());
                        }
                        if (!TextUtils.isEmpty(eeVar.g())) {
                            jSONObject.put("reason", eeVar.g());
                        }
                        if (!TextUtils.isEmpty(eeVar.c())) {
                            jSONObject.put(IjkMediaPlayer.OnNativeInvokeListener.ARG_IP, eeVar.c());
                        }
                        if (!TextUtils.isEmpty(eeVar.b())) {
                            jSONObject.put("stack", eeVar.b());
                        }
                        if (eeVar.h() > 0) {
                            jSONObject.put("ctime", String.valueOf(eeVar.h()));
                        }
                        if (eeVar.a() > 0) {
                            jSONObject.put("ntime", String.valueOf(eeVar.a()));
                        }
                    }
                    a(context, str, jSONObject);
                }
            } catch (Throwable th) {
                ff.a(th, "ReportUtil", "applyStatisticsEx");
            }
        }
    }

    public static synchronized void a(Context context, String str, JSONObject jSONObject) {
        synchronized (fk.class) {
            if (context != null) {
                try {
                    if (fe.a()) {
                        bn bnVar = new bn(context, "loc", "5.4.0", str);
                        if (jSONObject != null) {
                            bnVar.a(jSONObject.toString());
                        }
                        i.add(bnVar);
                        if (i.size() >= 30) {
                            ArrayList arrayList = new ArrayList();
                            arrayList.addAll(i);
                            bo.b(arrayList, context);
                            i.clear();
                        }
                    }
                } catch (Throwable th) {
                    ff.a(th, "ReportUtil", "applyStatistics");
                }
            }
        }
    }

    public static void a(AMapLocation aMapLocation, AMapLocation aMapLocation2) {
        try {
            if (g == null) {
                if (!fm.a(aMapLocation)) {
                    g = aMapLocation2;
                    return;
                }
                g = aMapLocation.m7clone();
            }
            if (fm.a(g) && fm.a(aMapLocation2)) {
                AMapLocation m7clone = aMapLocation2.m7clone();
                if (g.getLocationType() != 1 && g.getLocationType() != 9 && !GeocodeSearch.GPS.equalsIgnoreCase(g.getProvider()) && g.getLocationType() != 7 && m7clone.getLocationType() != 1 && m7clone.getLocationType() != 9 && !GeocodeSearch.GPS.equalsIgnoreCase(m7clone.getProvider()) && m7clone.getLocationType() != 7) {
                    long abs = Math.abs(m7clone.getTime() - g.getTime()) / 1000;
                    if (abs <= 0) {
                        abs = 1;
                    }
                    if (abs <= 1800) {
                        float a = fm.a(g, m7clone);
                        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(fm.a(g.getTime(), "yyyyMMdd_HH:mm:ss:SS"));
                            } else {
                                sb.append(g.getTime());
                            }
                            sb.append("#");
                            sb.append(m7clone.getLatitude());
                            sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
                            sb.append(m7clone.getLongitude());
                            sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
                            sb.append(m7clone.getAccuracy());
                            sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
                            sb.append(m7clone.getLocationType());
                            sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
                            if (m7clone.getTime() != 0) {
                                sb.append(fm.a(m7clone.getTime(), "yyyyMMdd_HH:mm:ss:SS"));
                            } else {
                                sb.append(m7clone.getTime());
                            }
                            a("bigshiftstatistics", sb.toString());
                            sb.delete(0, sb.length());
                        }
                    }
                }
                g = m7clone;
            }
        } catch (Throwable unused) {
        }
    }

    public static void a(String str, int i2) {
        a(str, String.valueOf(i2), a(i2));
    }

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

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

    public static void a(String str, Throwable th) {
        try {
            if (th instanceof j) {
                ak.a(ff.c(), str, (j) th);
            }
        } catch (Throwable unused) {
        }
    }

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

    private static void f(Context context) {
        try {
            JSONArray jSONArray = j;
            if (jSONArray == null || jSONArray.length() <= 0) {
                return;
            }
            bm.a(new bl(context, ff.c(), j.toString()), context);
            j = null;
        } catch (Throwable th) {
            ff.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((fm.b() - this.c) + this.a.get(this.b, 0L).longValue()));
            }
            this.c = fm.b() - fl.a(context, "pref1", this.d[i2], 0L);
            this.b = i2;
        } catch (Throwable th) {
            ff.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((fm.b() - this.f) + this.a.get(this.e, 0L).longValue()));
            }
            this.f = fm.b() - fl.a(context, "pref1", this.d[i3], 0L);
            this.e = i3;
        } catch (Throwable th) {
            ff.a(th, "ReportUtil", "setLocationMode");
        }
    }

    public final void b(Context context) {
        try {
            long b = fm.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 = fm.b() - this.f;
            int i3 = this.e;
            if (i3 != -1) {
                this.a.append(this.e, Long.valueOf(b2 + this.a.get(i3, 0L).longValue()));
            }
            SharedPreferences.Editor a = fl.a(context, "pref1");
            for (int i4 = 0; i4 < this.d.length; i4++) {
                long longValue = this.a.get(i4, 0L).longValue();
                if (longValue > 0 && longValue > fl.a(context, "pref1", this.d[i4], 0L)) {
                    fl.a(a, this.d[i4], longValue);
                }
            }
            fl.a(a);
        } catch (Throwable th) {
            ff.a(th, "ReportUtil", "saveLocationTypeAndMode");
        }
    }

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

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

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