小红书.apk(点击下载) / k.java


package com.baidu.location.e;

import android.content.Context;
import android.location.Location;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Environment;
import android.os.Process;
import android.provider.Settings;
import android.util.Base64;
import com.ali.auth.third.core.util.Rsa;
import com.alipay.sdk.util.f;
import com.baidu.location.BDLocation;
import com.baidu.location.Jni;
import com.baidu.location.c.a;
import com.baidu.location.c.b;
import com.baidu.location.c.e;
import com.baidu.location.c.h;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.tencent.cos.xml.crypto.COSCryptoScheme;
import java.io.File;
import java.io.FileInputStream;
import java.math.BigInteger;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.security.KeyFactory;
import java.security.MessageDigest;
import java.security.PublicKey;
import java.security.Signature;
import java.security.spec.X509EncodedKeySpec;
import java.util.Calendar;
import java.util.Enumeration;
import java.util.Locale;
import n02.d;

public class k {
    public static float A = 2.2f;
    public static float B = 2.3f;
    public static float C = 3.8f;
    public static int D = 3;
    public static int E = 10;
    public static int F = 2;
    public static int G = 7;
    public static int H = 20;
    public static int I = 70;

    /* renamed from: J  reason: collision with root package name */
    public static int f19187J = 120;
    public static float K = 2.0f;
    public static float L = 10.0f;
    public static float M = 50.0f;
    public static float N = 200.0f;
    public static int O = 16;
    public static int P = 32;
    public static float Q = 0.9f;
    public static int R = 10000;
    public static float S = 0.5f;
    public static float T = 0.0f;
    public static float U = 0.1f;
    public static int V = 30;
    public static int W = 100;
    public static int X = 0;
    public static int Y = 0;
    public static int Z = 0;

    /* renamed from: a  reason: collision with root package name */
    public static boolean f19188a = false;
    private static String aA = "http://loc.map.baidu.com/oqur.php";
    private static String aB = "http://loc.map.baidu.com/tcu.php";
    private static String aC = "http://loc.map.baidu.com/rtbu.php";
    private static String aD = "http://loc.map.baidu.com/iofd.php";
    private static String aE = "http://loc.map.baidu.com/wloc";

    /* renamed from: aa  reason: collision with root package name */
    public static int f19189aa = 420000;

    /* renamed from: ab  reason: collision with root package name */
    public static boolean f19190ab = true;

    /* renamed from: ac  reason: collision with root package name */
    public static boolean f19191ac = true;

    /* renamed from: ad  reason: collision with root package name */
    public static int f19192ad = 20;

    /* renamed from: ae  reason: collision with root package name */
    public static int f19193ae = 300;

    /* renamed from: af  reason: collision with root package name */
    public static int f19194af = 1000;

    /* renamed from: ag  reason: collision with root package name */
    public static int f19195ag = Integer.MAX_VALUE;

    /* renamed from: ah  reason: collision with root package name */
    public static long f19196ah = 900000;

    /* renamed from: ai  reason: collision with root package name */
    public static long f19197ai = 420000;

    /* renamed from: aj  reason: collision with root package name */
    public static long f19198aj = 180000;

    /* renamed from: ak  reason: collision with root package name */
    public static long f19199ak = 0;

    /* renamed from: al  reason: collision with root package name */
    public static long f19200al = 15;

    /* renamed from: am  reason: collision with root package name */
    public static long f19201am = 300000;

    /* renamed from: an  reason: collision with root package name */
    public static int f19202an = 1000;

    /* renamed from: ao  reason: collision with root package name */
    public static int f19203ao = 0;

    /* renamed from: ap  reason: collision with root package name */
    public static int f19204ap = 30000;

    /* renamed from: aq  reason: collision with root package name */
    public static int f19205aq = 30000;

    /* renamed from: ar  reason: collision with root package name */
    public static float f19206ar = 10.0f;

    /* renamed from: as  reason: collision with root package name */
    public static float f19207as = 6.0f;

    /* renamed from: at  reason: collision with root package name */
    public static float f19208at = 10.0f;

    /* renamed from: au  reason: collision with root package name */
    public static int f19209au = 60;

    /* renamed from: av  reason: collision with root package name */
    public static int f19210av = 70;

    /* renamed from: aw  reason: collision with root package name */
    public static int f19211aw = 6;

    /* renamed from: ax  reason: collision with root package name */
    public static String f19212ax = null;

    /* renamed from: ay  reason: collision with root package name */
    private static String f19213ay = "http://loc.map.baidu.com/sdk.php";

    /* renamed from: az  reason: collision with root package name */
    private static String f19214az = "http://loc.map.baidu.com/user_err.php";

    /* renamed from: b  reason: collision with root package name */
    public static boolean f19215b = false;

    /* renamed from: c  reason: collision with root package name */
    public static boolean f19216c = false;

    /* renamed from: d  reason: collision with root package name */
    public static int f19217d = 0;

    /* renamed from: e  reason: collision with root package name */
    public static String f19218e = "http://loc.map.baidu.com/sdk_ep.php";

    /* renamed from: f  reason: collision with root package name */
    public static String f19219f = "https://loc.map.baidu.com/sdk.php";

    /* renamed from: g  reason: collision with root package name */
    public static String f19220g = "no";

    /* renamed from: h  reason: collision with root package name */
    public static boolean f19221h = false;

    /* renamed from: i  reason: collision with root package name */
    public static boolean f19222i = false;

    /* renamed from: j  reason: collision with root package name */
    public static boolean f19223j = false;

    /* renamed from: k  reason: collision with root package name */
    public static boolean f19224k = false;

    /* renamed from: l  reason: collision with root package name */
    public static boolean f19225l = false;

    /* renamed from: m  reason: collision with root package name */
    public static boolean f19226m = false;

    /* renamed from: n  reason: collision with root package name */
    public static String f19227n = "gcj02";

    /* renamed from: o  reason: collision with root package name */
    public static String f19228o = "";

    /* renamed from: p  reason: collision with root package name */
    public static boolean f19229p = true;

    /* renamed from: q  reason: collision with root package name */
    public static int f19230q = 3;

    /* renamed from: r  reason: collision with root package name */
    public static double f19231r = 0.0d;

    /* renamed from: s  reason: collision with root package name */
    public static double f19232s = 0.0d;

    /* renamed from: t  reason: collision with root package name */
    public static double f19233t = 0.0d;

    /* renamed from: u  reason: collision with root package name */
    public static double f19234u = 0.0d;

    /* renamed from: v  reason: collision with root package name */
    public static int f19235v = 0;

    /* renamed from: w  reason: collision with root package name */
    public static byte[] f19236w = null;

    /* renamed from: x  reason: collision with root package name */
    public static boolean f19237x = false;

    /* renamed from: y  reason: collision with root package name */
    public static int f19238y = 0;

    /* renamed from: z  reason: collision with root package name */
    public static float f19239z = 1.1f;

    public static int a(Context context) {
        try {
            return Settings.System.getInt(context.getContentResolver(), "airplane_mode_on", 0);
        } catch (Exception unused) {
            return 2;
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:8:0x0016 A[RETURN] */
    /* JADX WARNING: Removed duplicated region for block: B:9:0x0017 A[RETURN] */
    public static int a(Context context, String str) {
        boolean z14;
        try {
            if (context.checkPermission(str, Process.myPid(), Process.myUid()) != 0) {
                z14 = false;
                return z14 ? 0 : 1;
            }
        } catch (Exception unused) {
        }
        z14 = true;
        if (z14) {
        }
    }

    public static int a(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(""))) {
            try {
                return Integer.parseInt(substring);
            } catch (NumberFormatException unused) {
            }
        }
        return Integer.MIN_VALUE;
    }

    public static String a() {
        Calendar instance = Calendar.getInstance();
        int i10 = instance.get(5);
        int i14 = instance.get(1);
        int i15 = instance.get(11);
        int i16 = instance.get(12);
        int i17 = instance.get(13);
        return String.format(Locale.CHINA, "%d-%02d-%02d %02d:%02d:%02d", Integer.valueOf(i14), Integer.valueOf(instance.get(2) + 1), Integer.valueOf(i10), Integer.valueOf(i15), Integer.valueOf(i16), Integer.valueOf(i17));
    }

    public static String a(a aVar, h hVar, Location location, String str, int i10) {
        return a(aVar, hVar, location, str, i10, false);
    }

    public static String a(a aVar, h hVar, Location location, String str, int i10, boolean z14) {
        String a14;
        String b14;
        StringBuffer stringBuffer = new StringBuffer(1024);
        if (!(aVar == null || (b14 = b.a().b(aVar)) == null)) {
            stringBuffer.append(b14);
        }
        if (hVar != null) {
            String b15 = i10 == 0 ? z14 ? hVar.b() : hVar.c() : hVar.d();
            if (b15 != null) {
                stringBuffer.append(b15);
            }
        }
        if (location != null) {
            String b16 = (f19217d == 0 || i10 == 0) ? e.b(location) : e.c(location);
            if (b16 != null) {
                stringBuffer.append(b16);
            }
        }
        boolean z15 = false;
        if (i10 == 0) {
            z15 = true;
        }
        String a15 = b.a().a(z15);
        if (a15 != null) {
            stringBuffer.append(a15);
        }
        if (str != null) {
            stringBuffer.append(str);
        }
        if (!(aVar == null || (a14 = b.a().a(aVar)) == null || a14.length() + stringBuffer.length() >= 750)) {
            stringBuffer.append(a14);
        }
        String stringBuffer2 = stringBuffer.toString();
        if (!(location == null || hVar == null)) {
            try {
                float speed = location.getSpeed();
                int i14 = f19217d;
                int h10 = hVar.h();
                int a16 = hVar.a();
                boolean i15 = hVar.i();
                if (speed < f19207as && ((i14 == 1 || i14 == 0) && (h10 < f19209au || i15))) {
                    f19230q = 1;
                    return stringBuffer2;
                } else if (speed < f19208at && ((i14 == 1 || i14 == 0 || i14 == 3) && (h10 < f19210av || a16 > f19211aw))) {
                    f19230q = 2;
                    return stringBuffer2;
                }
            } catch (Exception unused) {
                f19230q = 3;
            }
        }
        f19230q = 3;
        return stringBuffer2;
    }

    public static String a(File file, String str) {
        if (!file.isFile()) {
            return null;
        }
        byte[] bArr = new byte[1024];
        try {
            MessageDigest instance = MessageDigest.getInstance(str);
            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 e14) {
            e14.printStackTrace();
            return null;
        }
    }

    public static String a(String str) {
        return Jni.en1(f19228o + f.f18324b + str);
    }

    public static boolean a(BDLocation bDLocation) {
        int locType = bDLocation.getLocType();
        return (locType > 100 && locType < 200) || locType == 62;
    }

    public static int b(Context context) {
        if (Build.VERSION.SDK_INT < 19) {
            return -2;
        }
        try {
            return Settings.Secure.getInt(context.getContentResolver(), "location_mode", -1);
        } catch (Exception unused) {
            return -1;
        }
    }

    public static boolean b() {
        return false;
    }

    public static boolean b(String str, String str2, String str3) {
        try {
            PublicKey generatePublic = KeyFactory.getInstance(COSCryptoScheme.RSA).generatePublic(new X509EncodedKeySpec(Base64.decode(str3.getBytes(), 0)));
            Signature instance = Signature.getInstance(Rsa.SIGN_ALGORITHMS);
            instance.initVerify(generatePublic);
            instance.update(str.getBytes());
            return instance.verify(Base64.decode(str2.getBytes(), 0));
        } catch (Exception e14) {
            e14.printStackTrace();
            return false;
        }
    }

    public static String c() {
        try {
            Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
            while (networkInterfaces.hasMoreElements()) {
                Enumeration<InetAddress> inetAddresses = networkInterfaces.nextElement().getInetAddresses();
                while (true) {
                    if (inetAddresses.hasMoreElements()) {
                        InetAddress nextElement = inetAddresses.nextElement();
                        if (!nextElement.isLoopbackAddress() && (nextElement instanceof Inet4Address)) {
                            byte[] address = nextElement.getAddress();
                            String str = "";
                            for (byte b14 : address) {
                                String hexString = Integer.toHexString(b14 & 255);
                                if (hexString.length() == 1) {
                                    hexString = '0' + hexString;
                                }
                                str = str + hexString;
                            }
                            return str;
                        }
                    }
                }
            }
            return null;
        } catch (Exception unused) {
            return null;
        }
    }

    public static String c(Context context) {
        int a14 = a(context, "android.permission.ACCESS_COARSE_LOCATION");
        int a15 = a(context, "android.permission.ACCESS_FINE_LOCATION");
        int a16 = a(context, "android.permission.READ_PHONE_STATE");
        return "&per=" + a14 + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + a15 + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + a16;
    }

    public static String d() {
        try {
            Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
            while (networkInterfaces.hasMoreElements()) {
                Enumeration<InetAddress> inetAddresses = networkInterfaces.nextElement().getInetAddresses();
                while (true) {
                    if (inetAddresses.hasMoreElements()) {
                        InetAddress nextElement = inetAddresses.nextElement();
                        if (!nextElement.isLoopbackAddress() && (nextElement instanceof Inet6Address) && nextElement.getHostAddress() != null && !nextElement.getHostAddress().startsWith("fe80:")) {
                            return nextElement.getHostAddress();
                        }
                    }
                }
            }
            return "";
        } catch (SocketException unused) {
            return "";
        }
    }

    public static String d(Context context) {
        int i10 = -1;
        if (context != null) {
            try {
                NetworkInfo d14 = d.d((ConnectivityManager) context.getSystemService("connectivity"));
                if (d14 != null && d14.isAvailable()) {
                    i10 = d14.getType();
                }
            } catch (Exception unused) {
            }
        }
        return "&netc=" + i10;
    }

    public static String e() {
        return f19213ay;
    }

    public static String f() {
        return aB;
    }

    public static String g() {
        return "https://daup.map.baidu.com/cltr/rcvr";
    }

    public static String h() {
        try {
            if (Environment.getExternalStorageState().equals("mounted")) {
                String path = n02.f.d().getPath();
                File file = new File(path + "/baidu/tempdata");
                if (!file.exists()) {
                    file.mkdirs();
                }
                return path;
            }
        } catch (Exception unused) {
        }
        return null;
    }

    public static String i() {
        String h10 = h();
        if (h10 == null) {
            return null;
        }
        return h10 + "/baidu/tempdata";
    }

    public static String j() {
        try {
            File file = new File(com.baidu.location.f.getServiceContext().getFilesDir() + File.separator + "lldt");
            if (!file.exists()) {
                file.mkdirs();
            }
            return file.getAbsolutePath();
        } catch (Exception unused) {
            return null;
        }
    }

    public static String k() {
        try {
            File file = new File(com.baidu.location.f.getServiceContext().getFilesDir() + File.separator + "/baidu/tempdata");
            if (!file.exists()) {
                file.mkdirs();
            }
            return com.baidu.location.f.getServiceContext().getFilesDir().getPath();
        } catch (Exception unused) {
            return null;
        }
    }
}