同程有借 v1.0.0版本的 MD5 值为:e33397cdbab33543d0c134ec96d77fb8
以下内容为反编译后的 fw.java 源代码,内容仅作参考
package com.loc;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.util.SparseArray;
import anet.channel.strategy.dispatch.DispatchConstants;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClientOption;
import com.bonree.sdk.agent.engine.external.Instrumented;
import com.bonree.sdk.agent.engine.external.JSONArrayInstrumentation;
import com.bonree.sdk.agent.engine.external.JSONObjectInstrumentation;
import com.ly.fn.ins.android.AppSettings;
import com.taobao.accs.utl.BaseMonitor;
import com.umeng.umcrash.UMCrash;
import com.xiaomi.mipush.sdk.Constants;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
@Instrumented
public final class fw {
public SparseArray<Long> f10023a = new SparseArray<>();
public int f10024b = -1;
public long f10025c = 0;
String[] f10026d = {"ol", "cl", "gl", "ha", "bs", "ds"};
public int f10027e = -1;
public long f10028f = -1;
private static List<bz> f10021i = new ArrayList();
private static JSONArray f10022j = null;
static AMapLocation f10019g = null;
static boolean f10020h = false;
static class AnonymousClass1 {
static final int[] f10029a;
static {
int[] iArr = new int[AMapLocationClientOption.AMapLocationMode.values().length];
f10029a = iArr;
try {
iArr[AMapLocationClientOption.AMapLocationMode.Battery_Saving.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
f10029a[AMapLocationClientOption.AMapLocationMode.Device_Sensors.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
f10029a[AMapLocationClientOption.AMapLocationMode.Hight_Accuracy.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
}
}
private static String a(int i9) {
if (i9 != 2011) {
if (i9 != 2031) {
if (i9 != 2041) {
if (i9 != 2081) {
if (i9 != 2091) {
if (i9 != 2111) {
if (i9 != 2121) {
if (i9 != 2141) {
if (i9 != 2021) {
if (i9 != 2022) {
if (i9 != 2061) {
if (i9 != 2062) {
switch (i9) {
case 2051:
return "NeedLoginNetWork\t";
case 2052:
return "MaybeIntercepted";
case 2053:
return "DecryptResponseException";
case 2054:
return "ParserDataException";
default:
switch (i9) {
case 2101:
return "BindAPSServiceException";
case 2102:
return "AuthClientScodeFail";
case 2103:
return "NotConfigAPSService";
default:
switch (i9) {
case 2131:
return "NoCgiOAndWifiInfo";
case 2132:
return "AirPlaneModeAndWifiOff";
case 2133:
return "NoCgiAndWifiOff";
default:
switch (i9) {
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 a(long j9, long j10) {
try {
if (f10020h) {
return;
}
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("gpsTime:");
stringBuffer.append(fy.a(j9, "yyyy-MM-dd HH:mm:ss.SSS"));
stringBuffer.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
stringBuffer.append("sysTime:");
stringBuffer.append(fy.a(j10, "yyyy-MM-dd HH:mm:ss.SSS"));
stringBuffer.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
long t9 = fq.t();
int i9 = (0L > t9 ? 1 : (0L == t9 ? 0 : -1));
String a9 = i9 != 0 ? fy.a(t9, "yyyy-MM-dd HH:mm:ss.SSS") : "0";
stringBuffer.append("serverTime:");
stringBuffer.append(a9);
a("checkgpstime", stringBuffer.toString());
if (i9 != 0 && Math.abs(j9 - t9) < AppSettings.LOGIN_SESSION_TIME) {
stringBuffer.append(", correctError");
a("checkgpstimeerror", stringBuffer.toString());
}
stringBuffer.delete(0, stringBuffer.length());
f10020h = true;
} catch (Throwable unused) {
}
}
public static synchronized void a(Context context) {
synchronized (fw.class) {
if (context != null) {
try {
if (fq.a()) {
List<bz> list = f10021i;
if (list != null && list.size() > 0) {
ArrayList arrayList = new ArrayList();
arrayList.addAll(f10021i);
ca.b(arrayList, context);
f10021i.clear();
}
f(context);
}
} catch (Throwable th) {
fr.a(th, "ReportUtil", "destroy");
}
}
}
}
public static void a(Context context, int i9, int i10, long j9, long j10) {
if (i9 == -1 || i10 == -1) {
return;
}
try {
a(context, "O012", i9, i10, j9, j10);
} catch (Throwable th) {
fr.a(th, "ReportUtil", "reportServiceAliveTime");
}
}
public static void a(Context context, long j9, boolean z8) {
if (context != null) {
try {
if (fq.a()) {
a(context, j9, z8, "O015");
}
} catch (Throwable th) {
fr.a(th, "ReportUtil", "reportGPSLocUseTime");
}
}
}
private static void a(Context context, long j9, boolean z8, String str) {
a(context, str, !z8 ? "abroad" : "domestic", Long.valueOf(j9).intValue());
}
public static synchronized void a(Context context, AMapLocation aMapLocation) {
int i9;
synchronized (fw.class) {
try {
if (fy.a(aMapLocation)) {
int locationType = aMapLocation.getLocationType();
boolean z8 = false;
if (locationType == 1) {
i9 = 0;
} else if (locationType == 2 || locationType == 4) {
i9 = 1;
} else if (locationType == 11) {
i9 = 4;
} else if (locationType == 8) {
i9 = 3;
} else if (locationType != 9) {
i9 = 0;
if (z8) {
int c9 = fq.c();
if (c9 != 0) {
if (i9 == 0 || i9 == 4) {
if (c9 == 2) {
return;
}
} else if (c9 == 1) {
return;
}
}
if (f10022j == null) {
f10022j = new JSONArray();
}
JSONObject jSONObject = new JSONObject();
jSONObject.put("lon", fy.b(aMapLocation.getLongitude()));
jSONObject.put("lat", fy.b(aMapLocation.getLatitude()));
jSONObject.put("type", i9);
jSONObject.put(UMCrash.SP_KEY_TIMESTAMP, fy.a());
if (aMapLocation.getCoordType().equalsIgnoreCase("WGS84")) {
jSONObject.put("coordType", 1);
} else {
jSONObject.put("coordType", 2);
}
if (i9 == 0) {
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("accuracy", fy.c(aMapLocation.getAccuracy()));
jSONObject2.put("altitude", fy.c(aMapLocation.getAltitude()));
jSONObject2.put("bearing", fy.c(aMapLocation.getBearing()));
jSONObject2.put("speed", fy.c(aMapLocation.getSpeed()));
jSONObject.put("extension", jSONObject2);
}
JSONArray put = f10022j.put(jSONObject);
f10022j = put;
if (put.length() >= fq.b()) {
f(context);
}
}
} else {
i9 = 2;
}
z8 = true;
if (z8) {
}
}
} catch (Throwable th) {
fr.a(th, "ReportUtil", "recordOfflineLocLog");
}
}
}
public static void a(Context context, AMapLocation aMapLocation, eq eqVar) {
int i9;
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";
}
i9 = 0;
} else {
int locationType = aMapLocation.getLocationType();
if (locationType == 5 || locationType == 6) {
str2 = "net";
}
i9 = 1;
}
a(context, "O016", str2, str, i9, aMapLocation.getErrorCode(), eqVar);
}
} catch (Throwable th) {
fr.a(th, "ReportUtil", "reportBatting");
}
}
private static void a(Context context, String str, int i9, int i10, long j9, long j10) {
if (context != null) {
try {
if (fq.a()) {
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);
a(context, str, jSONObject);
}
} catch (Throwable th) {
fr.a(th, "ReportUtil", "applyStatisticsEx");
}
}
}
private static void a(Context context, String str, String str2, int i9) {
if (context != null) {
try {
if (fq.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 (i9 != Integer.MAX_VALUE) {
jSONObject.put("param_int_first", i9);
}
a(context, str, jSONObject);
}
} catch (Throwable th) {
fr.a(th, "ReportUtil", "applyStatisticsEx");
}
}
}
private static void a(Context context, String str, String str2, String str3, int i9, int i10, eq eqVar) {
if (context != null) {
try {
if (fq.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 (i9 != Integer.MAX_VALUE) {
jSONObject.put("param_int_first", i9);
}
if (i10 != Integer.MAX_VALUE) {
jSONObject.put("param_int_second", i10);
}
if (eqVar != null) {
if (!TextUtils.isEmpty(eqVar.d())) {
jSONObject.put(BaseMonitor.COUNT_POINT_DNS, eqVar.d());
}
if (!TextUtils.isEmpty(eqVar.e())) {
jSONObject.put(DispatchConstants.DOMAIN, eqVar.e());
}
if (!TextUtils.isEmpty(eqVar.f())) {
jSONObject.put("type", eqVar.f());
}
if (!TextUtils.isEmpty(eqVar.g())) {
jSONObject.put("reason", eqVar.g());
}
if (!TextUtils.isEmpty(eqVar.c())) {
jSONObject.put("ip", eqVar.c());
}
if (!TextUtils.isEmpty(eqVar.b())) {
jSONObject.put("stack", eqVar.b());
}
if (eqVar.h() > 0) {
jSONObject.put("ctime", String.valueOf(eqVar.h()));
}
if (eqVar.a() > 0) {
jSONObject.put("ntime", String.valueOf(eqVar.a()));
}
}
a(context, str, jSONObject);
}
} catch (Throwable th) {
fr.a(th, "ReportUtil", "applyStatisticsEx");
}
}
}
public static synchronized void a(Context context, String str, JSONObject jSONObject) {
synchronized (fw.class) {
if (context != null) {
try {
if (fq.a()) {
bz bzVar = new bz(context, "loc", "6.2.0", str);
if (jSONObject != null) {
bzVar.a(JSONObjectInstrumentation.toString(jSONObject));
}
f10021i.add(bzVar);
if (f10021i.size() >= 30) {
ArrayList arrayList = new ArrayList();
arrayList.addAll(f10021i);
ca.b(arrayList, context);
f10021i.clear();
}
}
} catch (Throwable th) {
fr.a(th, "ReportUtil", "applyStatistics");
}
}
}
}
public static void a(AMapLocation aMapLocation, AMapLocation aMapLocation2) {
try {
if (f10019g == null) {
if (!fy.a(aMapLocation)) {
f10019g = aMapLocation2;
return;
}
f10019g = aMapLocation.m37clone();
}
if (fy.a(f10019g) && fy.a(aMapLocation2)) {
AMapLocation m37clone = aMapLocation2.m37clone();
if (f10019g.getLocationType() != 1 && f10019g.getLocationType() != 9 && !"gps".equalsIgnoreCase(f10019g.getProvider()) && f10019g.getLocationType() != 7 && m37clone.getLocationType() != 1 && m37clone.getLocationType() != 9 && !"gps".equalsIgnoreCase(m37clone.getProvider()) && m37clone.getLocationType() != 7) {
long abs = Math.abs(m37clone.getTime() - f10019g.getTime()) / 1000;
if (abs <= 0) {
abs = 1;
}
if (abs <= 1800) {
float a9 = fy.a(f10019g, m37clone);
float f9 = a9 / ((float) abs);
if (a9 > 30000.0f && f9 > 1000.0f) {
StringBuilder sb = new StringBuilder();
sb.append(f10019g.getLatitude());
sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
sb.append(f10019g.getLongitude());
sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
sb.append(f10019g.getAccuracy());
sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
sb.append(f10019g.getLocationType());
sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
if (aMapLocation.getTime() != 0) {
sb.append(fy.a(f10019g.getTime(), "yyyyMMdd_HH:mm:ss:SS"));
} else {
sb.append(f10019g.getTime());
}
sb.append("#");
sb.append(m37clone.getLatitude());
sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
sb.append(m37clone.getLongitude());
sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
sb.append(m37clone.getAccuracy());
sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
sb.append(m37clone.getLocationType());
sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
if (m37clone.getTime() != 0) {
sb.append(fy.a(m37clone.getTime(), "yyyyMMdd_HH:mm:ss:SS"));
} else {
sb.append(m37clone.getTime());
}
a("bigshiftstatistics", sb.toString());
sb.delete(0, sb.length());
}
}
}
f10019g = m37clone;
}
} catch (Throwable unused) {
}
}
public static void a(String str, int i9) {
a(str, String.valueOf(i9), a(i9));
}
public static void a(String str, String str2) {
try {
av.b(fr.c(), str2, str);
} catch (Throwable th) {
fr.a(th, "ReportUtil", "reportLog");
}
}
public static void a(String str, String str2, String str3) {
try {
av.a(fr.c(), "/mobile/binary", str3, str, str2);
} catch (Throwable unused) {
}
}
public static void a(String str, Throwable th) {
try {
if (th instanceof k) {
av.a(fr.c(), str, (k) th);
}
} catch (Throwable unused) {
}
}
private static boolean a(AMapLocation aMapLocation) {
return fy.a(aMapLocation) ? !fr.a(aMapLocation.getLatitude(), aMapLocation.getLongitude()) : "http://abroad.apilocate.amap.com/mobile/binary".equals(fr.f9991c);
}
public static void b(Context context, long j9, boolean z8) {
if (context != null) {
try {
if (fq.a()) {
a(context, j9, z8, "O024");
}
} catch (Throwable th) {
fr.a(th, "ReportUtil", "reportCoarseLocUseTime");
}
}
}
private static void f(Context context) {
try {
JSONArray jSONArray = f10022j;
if (jSONArray == null || jSONArray.length() <= 0) {
return;
}
w c9 = fr.c();
JSONArray jSONArray2 = f10022j;
by.a(new bx(context, c9, !(jSONArray2 instanceof JSONArray) ? jSONArray2.toString() : JSONArrayInstrumentation.toString(jSONArray2)), context);
f10022j = null;
} catch (Throwable th) {
fr.a(th, "ReportUtil", "writeOfflineLocLog");
}
}
public final void a(Context context, int i9) {
try {
int i10 = this.f10024b;
if (i10 == i9) {
return;
}
if (i10 != -1 && i10 != i9) {
this.f10023a.append(this.f10024b, Long.valueOf((fy.b() - this.f10025c) + this.f10023a.get(this.f10024b, 0L).longValue()));
}
this.f10025c = fy.b() - fx.a(context, "pref1", this.f10026d[i9], 0L);
this.f10024b = i9;
} catch (Throwable th) {
fr.a(th, "ReportUtil", "setLocationType");
}
}
public final void a(Context context, AMapLocationClientOption aMapLocationClientOption) {
try {
int i9 = AnonymousClass1.f10029a[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.f10027e;
if (i11 == i10) {
return;
}
if (i11 != -1 && i11 != i10) {
this.f10023a.append(this.f10027e, Long.valueOf((fy.b() - this.f10028f) + this.f10023a.get(this.f10027e, 0L).longValue()));
}
this.f10028f = fy.b() - fx.a(context, "pref1", this.f10026d[i10], 0L);
this.f10027e = i10;
} catch (Throwable th) {
fr.a(th, "ReportUtil", "setLocationMode");
}
}
public final void b(Context context) {
try {
long b9 = fy.b() - this.f10025c;
int i9 = this.f10024b;
if (i9 != -1) {
this.f10023a.append(this.f10024b, Long.valueOf(b9 + this.f10023a.get(i9, 0L).longValue()));
}
long b10 = fy.b() - this.f10028f;
int i10 = this.f10027e;
if (i10 != -1) {
this.f10023a.append(this.f10027e, Long.valueOf(b10 + this.f10023a.get(i10, 0L).longValue()));
}
SharedPreferences.Editor a9 = fx.a(context, "pref1");
for (int i11 = 0; i11 < this.f10026d.length; i11++) {
long longValue = this.f10023a.get(i11, 0L).longValue();
if (longValue > 0 && longValue > fx.a(context, "pref1", this.f10026d[i11], 0L)) {
fx.a(a9, this.f10026d[i11], longValue);
}
}
fx.a(a9);
} catch (Throwable th) {
fr.a(th, "ReportUtil", "saveLocationTypeAndMode");
}
}
public final int c(Context context) {
try {
long a9 = fx.a(context, "pref1", this.f10026d[2], 0L);
long a10 = fx.a(context, "pref1", this.f10026d[0], 0L);
long a11 = fx.a(context, "pref1", this.f10026d[1], 0L);
if (a9 == 0 && a10 == 0 && a11 == 0) {
return -1;
}
long j9 = a10 - a9;
long j10 = a11 - a9;
return a9 > j9 ? a9 > j10 ? 2 : 1 : j9 > j10 ? 0 : 1;
} catch (Throwable unused) {
return -1;
}
}
public final int d(Context context) {
try {
long a9 = fx.a(context, "pref1", this.f10026d[3], 0L);
long a10 = fx.a(context, "pref1", this.f10026d[4], 0L);
long a11 = fx.a(context, "pref1", this.f10026d[5], 0L);
if (a9 == 0 && a10 == 0 && a11 == 0) {
return -1;
}
return a9 > a10 ? a9 > a11 ? 3 : 5 : a10 > a11 ? 4 : 5;
} catch (Throwable unused) {
return -1;
}
}
public final void e(Context context) {
try {
SharedPreferences.Editor a9 = fx.a(context, "pref1");
int i9 = 0;
while (true) {
String[] strArr = this.f10026d;
if (i9 >= strArr.length) {
fx.a(a9);
return;
} else {
fx.a(a9, strArr[i9], 0L);
i9++;
}
}
} catch (Throwable unused) {
}
}
}