package com.baidu.location.b; import android.location.Location; import android.os.Environment; import android.text.TextUtils; import com.alibaba.wireless.security.SecExceptionCode; import com.baidu.location.BDLocation; import com.baidu.location.f; import com.baidu.location.h.a; import com.baidu.location.h.b; import com.baidu.location.h.c; import com.baidu.location.h.h; import java.io.File; import java.io.FileInputStream; import java.math.BigInteger; import java.security.MessageDigest; import java.util.Calendar; import java.util.Locale; public class k implements f { public static float b0 = 2.2f; public static boolean b1 = false; public static boolean b2 = false; private static String b3 = "https://sapi.skyhookwireless.com/wps2/location"; public static int b4 = 0; public static int b5 = 0; public static byte[] b6 = null; public static int b7 = 3; public static double b8 = 0.0d; private static String b9 = "http://loc.map.baidu.com/tcu.php"; private static String bI = "http://loc.map.baidu.com/iofd.php"; public static float bJ = 0.5f; public static double bK = 0.0d; public static int bL = 20; public static int bM = 30000; public static int bN = 7; public static boolean bO = true; public static float bP = 0.9f; public static int bQ = 30000; private static String bR = "http://loc.map.baidu.com/sdk.php"; public static int bS = 6; public static boolean bT = false; public static int bU = 120; public static boolean bV = true; public static boolean bW = false; public static int bX = 1000; private static String bY = "http://loc.map.baidu.com/oqur.php"; private static String bZ = "http://loc.map.baidu.com/wloc"; public static int cA = 420000; public static float cB = 200.0f; public static int cC = 10000; public static float cD = 10.0f; public static float cE = 3.8f; public static int cF = 20; public static int cG = 2; public static int cH = 16; public static double cI = 0.0d; public static int cJ = SecExceptionCode.SEC_ERROR_STA_ENC; public static boolean cK = false; public static long cL = 15; public static int cM = 70; public static long cN = 420000; public static int cO = 70; public static int cP = 0; public static boolean cQ = false; public static String cR = "gcj02"; public static float cS = 50.0f; public static long cT = 300000; public static float cU = 1.1f; private static String ca = "http://loc.map.baidu.com/user_err.php"; public static int cb = 3; public static int cc = 100; public static int cd = 30; public static float ce = 0.1f; public static float cf = 0.0f; public static int cg = 60; public static float ch = 6.0f; public static final boolean ci = true; public static String cj = "no"; public static float ck = 10.0f; public static float cl = 2.0f; public static boolean cm = false; public static boolean cn = false; public static float co = 2.3f; public static boolean cp = true; public static boolean cq = false; public static float cr = 10.0f; public static int cs = 0; public static double ct = 0.0d; public static int cu = 10; public static int cv = 1000; public static long cw = 900000; public static long cx = 0; public static long cy = 180000; public static String cz = "http://loc.map.baidu.com/sdk_ep.php"; static String W() { Calendar instance = Calendar.getInstance(); int i = instance.get(5); int i2 = instance.get(1); int i3 = instance.get(11); int i4 = instance.get(12); int i5 = instance.get(13); return String.format(Locale.CHINA, "%d_%d_%d_%d_%d_%d", Integer.valueOf(i2), Integer.valueOf(instance.get(2) + 1), Integer.valueOf(i), Integer.valueOf(i3), Integer.valueOf(i4), Integer.valueOf(i5)); } public static String X() { return bY; } public static String Y() { return bR; } public static String Z() { return bZ; } public static String aa() { return b3; } public static String ab() { return b9; } public static String ac() { Calendar instance = Calendar.getInstance(); int i = instance.get(5); int i2 = instance.get(1); int i3 = instance.get(11); int i4 = instance.get(12); int i5 = instance.get(13); return String.format(Locale.CHINA, "%d-%02d-%02d %02d:%02d:%02d", Integer.valueOf(i2), Integer.valueOf(instance.get(2) + 1), Integer.valueOf(i), Integer.valueOf(i3), Integer.valueOf(i4), Integer.valueOf(i5)); } public static String ad() { return ca; } public static String ae() { if (!Environment.getExternalStorageState().equals("mounted")) { return null; } try { String path = Environment.getExternalStorageDirectory().getPath(); File file = new File(path + "/baidu/tempdata"); if (file.exists()) { return path; } file.mkdirs(); return path; } catch (Exception e2) { return null; } } public static String af() { return bI; } public static String ag() { String ae = ae(); if (ae == null) { return null; } return ae + "/baidu/tempdata"; } public static String ah() { try { File file = new File(f.getServiceContext().getFilesDir() + File.separator + "lldt"); if (!file.exists()) { file.mkdirs(); } return file.getAbsolutePath(); } catch (Exception e2) { return null; } } /* renamed from: do reason: not valid java name */ static float m77do(String str, String str2, String str3) { int indexOf; int length; int indexOf2; String substring; if (str == null || str.equals("") || (indexOf = str.indexOf(str2)) == -1 || (indexOf2 = str.indexOf(str3, (length = indexOf + str2.length()))) == -1 || (substring = str.substring(length, indexOf2)) == null || substring.equals("")) { return Float.MIN_VALUE; } try { return Float.parseFloat(substring); } catch (NumberFormatException e2) { return Float.MIN_VALUE; } } /* renamed from: do reason: not valid java name */ public static boolean m78do(BDLocation bDLocation) { int locType = bDLocation.getLocType(); return locType > 100 && locType < 200; } /* renamed from: for reason: not valid java name */ public static int m79for(String str, String str2, String str3) { int indexOf; int length; int indexOf2; String substring; if (str == null || str.equals("") || (indexOf = str.indexOf(str2)) == -1 || (indexOf2 = str.indexOf(str3, (length = indexOf + str2.length()))) == -1 || (substring = str.substring(length, indexOf2)) == null || substring.equals("")) { return Integer.MIN_VALUE; } try { return Integer.parseInt(substring); } catch (NumberFormatException e2) { return Integer.MIN_VALUE; } } /* renamed from: if reason: not valid java name */ public static String m80if(h hVar, com.baidu.location.h.f fVar, Location location, String str) { String str2; String str3; String str4; StringBuffer stringBuffer = new StringBuffer(); if (!(hVar == null || (str4 = b.cT().m414new(hVar)) == null)) { stringBuffer.append(str4); } if (fVar != null) { try { str3 = fVar.e(5); } catch (Exception e2) { str3 = null; } if (str3 != null) { stringBuffer.append(str3); } } if (location != null) { String str5 = b5 != 0 ? a.m379else(location) : a.m381goto(location); if (str5 != null) { stringBuffer.append(str5); } } String str6 = c.M().m53do(false); if (str6 != null) { stringBuffer.append(str6); } if (str != null) { stringBuffer.append(str); } if (!(hVar == null || (str2 = c.a().m431int(hVar)) == null || str2.length() + stringBuffer.length() >= 750)) { stringBuffer.append(str2); } return stringBuffer.toString(); } /* renamed from: if reason: not valid java name */ public static String m81if(h hVar, com.baidu.location.h.f fVar, Location location, String str, int i) { String str2; String str3; StringBuffer stringBuffer = new StringBuffer(1024); if (!(hVar == null || (str3 = b.cT().m414new(hVar)) == null)) { stringBuffer.append(str3); } if (fVar != null) { String dm = i == 0 ? fVar.dm() : fVar.di(); if (dm != null) { stringBuffer.append(dm); } } if (location != null) { String str4 = (b5 == 0 || i == 0) ? a.m381goto(location) : a.m379else(location); if (str4 != null) { stringBuffer.append(str4); } } boolean z = false; if (i == 0) { z = true; } String str5 = c.M().m53do(z); if (str5 != null) { stringBuffer.append(str5); } if (str != null) { stringBuffer.append(str); } String bA = com.baidu.location.e.f.bB().bA(); if (!TextUtils.isEmpty(bA)) { stringBuffer.append("&bc=").append(bA); } if (i == 0) { } if (!(hVar == null || (str2 = c.a().m431int(hVar)) == null || str2.length() + stringBuffer.length() >= 750)) { stringBuffer.append(str2); } String stringBuffer2 = stringBuffer.toString(); if (location == null || fVar == null) { b7 = 3; } else { try { float speed = location.getSpeed(); int i2 = b5; int dd = fVar.dd(); int dj = fVar.dj(); boolean df = fVar.df(); if (speed < ch && ((i2 == 1 || i2 == 0) && (dd < cg || df))) { b7 = 1; } else if (speed >= cD || (!(i2 == 1 || i2 == 0 || i2 == 3) || (dd >= cO && dj <= bS))) { b7 = 3; } else { b7 = 2; } } catch (Exception e2) { b7 = 3; } } return stringBuffer2; } /* renamed from: if reason: not valid java name */ public static String m82if(File file) { if (!file.isFile()) { return null; } byte[] bArr = new byte[1024]; try { MessageDigest instance = MessageDigest.getInstance("MD5"); FileInputStream fileInputStream = new FileInputStream(file); while (true) { int read = fileInputStream.read(bArr, 0, 1024); if (read != -1) { instance.update(bArr, 0, read); } else { fileInputStream.close(); return new BigInteger(1, instance.digest()).toString(16); } } } catch (Exception e2) { e2.printStackTrace(); return null; } } /* renamed from: if reason: not valid java name */ static String m83if(String str, String str2, String str3, double d2) { int indexOf; int length; int indexOf2; if (str == null || str.equals("") || (indexOf = str.indexOf(str2)) == -1 || (indexOf2 = str.indexOf(str3, (length = indexOf + str2.length()))) == -1) { return null; } return str.substring(0, length) + String.format(Locale.CHINA, "%.7f", Double.valueOf(d2)) + str.substring(indexOf2); } /* renamed from: int reason: not valid java name */ static double m84int(String str, String str2, String str3) { int indexOf; int length; int indexOf2; String substring; if (str == null || str.equals("") || (indexOf = str.indexOf(str2)) == -1 || (indexOf2 = str.indexOf(str3, (length = indexOf + str2.length()))) == -1 || (substring = str.substring(length, indexOf2)) == null || substring.equals("")) { return Double.MIN_VALUE; } try { return Double.parseDouble(substring); } catch (NumberFormatException e2) { return Double.MIN_VALUE; } } }