派享便利 v1.0.3版本的 MD5 值为:1fc1776275e6607636a3a1f946b1f976

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


package com.loc;

import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.os.SystemClock;
import android.text.TextUtils;
import com.amap.api.maps.AMapException;
import com.loc.bf;
import com.loc.bh;
import com.taobao.weex.WXEnvironment;
import com.taobao.weex.el.parse.Operators;
import com.taobao.weex.performance.WXInstanceApm;
import io.dcloud.common.adapter.util.Logger;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.json.JSONException;
import org.json.JSONObject;
public final class l {
    private static volatile boolean C = false;
    public static int a = -1;
    public static String b = "";
    public static Context c = null;
    private static String k = "6";
    private static String l = "4";
    private static String m = "9";
    private static String n = "8";
    private static volatile boolean o = true;
    private static Vector<e> p = new Vector<>();
    private static Map<String, Integer> q = new HashMap();
    private static String r = null;
    private static long s = 0;
    public static volatile boolean d = false;
    private static volatile ConcurrentHashMap<String, Long> t = new ConcurrentHashMap<>(8);
    private static volatile ConcurrentHashMap<String, Long> u = new ConcurrentHashMap<>(8);
    private static volatile ConcurrentHashMap<String, d> v = new ConcurrentHashMap<>(8);
    private static boolean w = false;
    public static int e = 5000;
    public static boolean f = true;
    public static boolean g = false;
    private static int x = 3;
    public static boolean h = true;
    public static boolean i = false;
    private static int y = 3;
    public static boolean j = false;
    private static ConcurrentHashMap<String, Boolean> z = new ConcurrentHashMap<>();
    private static ConcurrentHashMap<String, Boolean> A = new ConcurrentHashMap<>();
    private static ArrayList<bf.a> B = new ArrayList<>();
    private static Queue<bf.c> D = new LinkedList();

    public interface a {
        void a(b bVar);
    }

    public static class b {
        @Deprecated
        public JSONObject a;
        @Deprecated
        public JSONObject b;
        public String c;
        public int d = -1;
        public long e = 0;
        public JSONObject f;
        public a g;
        public C0028b h;
        private boolean i;

        public static class a {
            public boolean a;
            public boolean b;
            public JSONObject c;
        }

        public static class C0028b {
            public boolean a;
        }
    }

    public static class c extends bd {
        private String g;
        private Map<String, String> h;
        private String i;
        private String j;
        private String k;

        c(Context context, t tVar, String str, String str2, String str3, String str4) {
            super(context, tVar);
            this.g = str;
            this.h = null;
            this.i = str2;
            this.j = str3;
            this.k = str4;
            a(bh.c.HTTPS);
            a(bh.a.FIX);
        }

        private static String a(String str, String str2) {
            try {
                return !TextUtils.isEmpty(str2) ? Uri.parse(str).buildUpon().encodedAuthority(str2).build().toString() : str;
            } catch (Throwable unused) {
                return str;
            }
        }

        @Override
        public final Map<String, String> a() {
            if (TextUtils.isEmpty(this.k)) {
                return null;
            }
            HashMap hashMap = new HashMap();
            hashMap.put("host", this.k);
            return hashMap;
        }

        @Override
        public final byte[] a_() {
            return null;
        }

        @Override
        public final String b() {
            return a("https://restsdk.amap.com/v3/iasdkauth", this.i);
        }

        @Override
        public final byte[] b_() {
            String w = n.w(this.a);
            if (!TextUtils.isEmpty(w)) {
                w = r.a(new StringBuilder(w).reverse().toString());
            }
            HashMap hashMap = new HashMap();
            hashMap.put("authkey", TextUtils.isEmpty(this.g) ? "" : this.g);
            hashMap.put("plattype", WXEnvironment.OS);
            hashMap.put("product", this.b.a());
            hashMap.put("version", this.b.b());
            hashMap.put("output", "json");
            StringBuilder sb = new StringBuilder();
            sb.append(Build.VERSION.SDK_INT);
            hashMap.put("androidversion", sb.toString());
            hashMap.put("deviceId", w);
            hashMap.put("manufacture", Build.MANUFACTURER);
            Map<String, String> map = this.h;
            if (map != null && !map.isEmpty()) {
                hashMap.putAll(this.h);
            }
            hashMap.put("abitype", u.a(this.a));
            hashMap.put("ext", this.b.d());
            return u.a(u.a(hashMap));
        }

        @Override
        public final String c() {
            return a("https://dualstack-arestapi.amap.com/v3/iasdkauth", this.j);
        }

        @Override
        protected final String f() {
            return "3.0";
        }

        @Override
        public final String g() {
            return !TextUtils.isEmpty(this.k) ? this.k : super.g();
        }
    }

    public static class d {
        t a;
        String b;
        a c;

        private d() {
        }

        d(byte b) {
            this();
        }
    }

    public static class e {
        private String a;
        private String b;
        private AtomicInteger c;

        public e(String str, String str2, int i) {
            this.a = str;
            this.b = str2;
            this.c = new AtomicInteger(i);
        }

        public static e b(String str) {
            if (TextUtils.isEmpty(str)) {
                return null;
            }
            try {
                JSONObject jSONObject = new JSONObject(str);
                return new e(jSONObject.optString("a"), jSONObject.optString("f"), jSONObject.optInt("h"));
            } catch (Throwable unused) {
                return null;
            }
        }

        public final int a() {
            AtomicInteger atomicInteger = this.c;
            if (atomicInteger == null) {
                return 0;
            }
            return atomicInteger.get();
        }

        public final void a(String str) {
            this.b = str;
        }

        public final String b() {
            try {
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("a", this.a);
                jSONObject.put("f", this.b);
                jSONObject.put("h", this.c.get());
                return jSONObject.toString();
            } catch (Throwable unused) {
                return "";
            }
        }
    }

    public static class f {
        public static boolean a = true;
        public static boolean b = false;
        public static boolean c = true;
        public static int d = 0;
        public static boolean e = false;
        public static int f;
    }

    public static b a(Context context, t tVar, String str, String str2, String str3, String str4) {
        return b(context, tVar, str, str2, str3, str4);
    }

    private static synchronized e a(Context context, String str, String str2) {
        e eVar;
        synchronized (l.class) {
            if (!TextUtils.isEmpty(str)) {
                for (int i2 = 0; i2 < p.size(); i2++) {
                    eVar = p.get(i2);
                    if (eVar != null && str.equals(eVar.a)) {
                        break;
                    }
                }
            }
            eVar = null;
            if (eVar != null) {
                return eVar;
            }
            if (context == null) {
                return null;
            }
            e b2 = e.b(am.b(context, str2, str, ""));
            String a2 = u.a(System.currentTimeMillis(), Logger.TIMESTAMP_YYYY_MM_DD);
            if (b2 == null) {
                b2 = new e(str, a2, 0);
            }
            if (!a2.equals(b2.b)) {
                b2.a(a2);
                b2.c.set(0);
            }
            p.add(b2);
            return b2;
        }
    }

    public static void a(Context context) {
        if (context != null) {
            c = context.getApplicationContext();
        }
    }

    private static void a(Context context, t tVar, String str) {
        HashMap hashMap = new HashMap();
        hashMap.put("amap_sdk_auth_fail", "1");
        hashMap.put("amap_sdk_auth_fail_type", str);
        hashMap.put("amap_sdk_name", tVar.a());
        hashMap.put("amap_sdk_version", tVar.c());
        String jSONObject = new JSONObject(hashMap).toString();
        if (TextUtils.isEmpty(jSONObject)) {
            return;
        }
        try {
            bn bnVar = new bn(context, "core", "2.0", "O001");
            bnVar.a(jSONObject);
            bo.a(bnVar, context);
        } catch (j unused) {
        }
    }

    public static synchronized void a(Context context, t tVar, String str, a aVar) {
        synchronized (l.class) {
            if (context == null || tVar == null) {
                return;
            }
            try {
                if (c == null) {
                    c = context.getApplicationContext();
                }
                String a2 = tVar.a();
                if (TextUtils.isEmpty(a2)) {
                    return;
                }
                a(tVar);
                if (v == null) {
                    v = new ConcurrentHashMap<>(8);
                }
                if (u == null) {
                    u = new ConcurrentHashMap<>(8);
                }
                if (t == null) {
                    t = new ConcurrentHashMap<>(8);
                }
                if (!v.containsKey(a2)) {
                    d dVar = new d((byte) 0);
                    dVar.a = tVar;
                    dVar.b = str;
                    dVar.c = aVar;
                    v.put(a2, dVar);
                    t.put(a2, Long.valueOf(am.b(c, "open_common", a2)));
                    d(c);
                }
            } catch (Throwable th) {
                ah.a(th, "at", "rglc");
            }
        }
    }

    private static void a(Context context, t tVar, String str, b bVar, JSONObject jSONObject) throws JSONException {
        String str2;
        String str3;
        String str4;
        JSONObject jSONObject2;
        boolean a2;
        Context context2;
        JSONObject jSONObject3;
        String[] strArr;
        b.a aVar = new b.a();
        aVar.a = false;
        aVar.b = false;
        bVar.g = aVar;
        try {
            String[] split = str.split(";");
            if (split != null && split.length > 0) {
                int length = split.length;
                int i2 = 0;
                while (i2 < length) {
                    String str5 = split[i2];
                    if (jSONObject.has(str5)) {
                        strArr = split;
                        bVar.f.putOpt(str5, jSONObject.get(str5));
                    } else {
                        strArr = split;
                    }
                    i2++;
                    split = strArr;
                }
            }
        } catch (Throwable th) {
            ah.a(th, "at", "co");
        }
        if (u.a(jSONObject, "16H")) {
            try {
                bVar.i = a(jSONObject.getJSONObject("16H").optString("able"), false);
            } catch (Throwable th2) {
                ah.a(th2, "AuthConfigManager", "load 16H");
            }
        }
        if (u.a(jSONObject, "11K")) {
            try {
                JSONObject jSONObject4 = jSONObject.getJSONObject("11K");
                aVar.a = a(jSONObject4.getString("able"), false);
                if (jSONObject4.has("off")) {
                    aVar.c = jSONObject4.getJSONObject("off");
                }
            } catch (Throwable th3) {
                ah.a(th3, "AuthConfigManager", "load 11K");
            }
        }
        if (u.a(jSONObject, "145")) {
            try {
                bVar.a = jSONObject.getJSONObject("145");
            } catch (Throwable th4) {
                ah.a(th4, "AuthConfigManager", "load 145");
            }
        }
        if (u.a(jSONObject, "14D")) {
            try {
                bVar.b = jSONObject.getJSONObject("14D");
            } catch (Throwable th5) {
                ah.a(th5, "AuthConfigManager", "load 14D");
            }
        }
        if (u.a(jSONObject, "151")) {
            try {
                JSONObject jSONObject5 = jSONObject.getJSONObject("151");
                b.C0028b c0028b = new b.C0028b();
                if (jSONObject5 != null) {
                    c0028b.a = a(jSONObject5.optString("able"), false);
                }
                bVar.h = c0028b;
            } catch (Throwable th6) {
                ah.a(th6, "AuthConfigManager", "load 151");
            }
        }
        if (u.a(jSONObject, "17S")) {
            try {
                jSONObject2 = jSONObject.getJSONObject("17S");
                if (jSONObject2 != null && (a2 = a(jSONObject2.optString("able"), false)) != o) {
                    o = a2;
                    if (context != null) {
                        SharedPreferences.Editor a3 = am.a(context, "open_common");
                        am.a(a3, "a2", a2);
                        am.a(a3);
                    }
                }
            } catch (Throwable th7) {
                th = th7;
                str2 = "ustv";
            }
            if (jSONObject2 != null) {
                boolean a4 = a(jSONObject2.optString("static_enable"), true);
                boolean a5 = a(jSONObject2.optString("static_ip_direct_enable"), false);
                int optInt = jSONObject2.optInt("static_timeout", 5) * 1000;
                int optInt2 = jSONObject2.optInt("static_retry", 3);
                str2 = "ustv";
                try {
                    boolean a6 = a(jSONObject2.optString("bgp_enable"), true);
                    str3 = "ust";
                    try {
                        boolean a7 = a(jSONObject2.optString("bgp_ip_direct_enable"), false);
                        str4 = "umv";
                        try {
                            int optInt3 = jSONObject2.optInt("bgp_retry", 3);
                            boolean a8 = a(jSONObject2.optString("perf_data_upload_enable"), false);
                            if (a4 != f || a5 != g || optInt != e || optInt2 != x || a6 != h || a7 != i || optInt3 != y || a8 != j) {
                                f = a4;
                                g = a5;
                                e = optInt;
                                x = optInt2;
                                h = a6;
                                i = a7;
                                y = optInt3;
                                j = a8;
                                if (context != null) {
                                    SharedPreferences.Editor a9 = am.a(context, "open_common");
                                    am.a(a9, "a13", a4);
                                    am.a(a9, "a6", a6);
                                    am.a(a9, "a7", a5);
                                    am.a(a9, "a8", optInt);
                                    am.a(a9, "a9", optInt2);
                                    am.a(a9, "a10", a7);
                                    am.a(a9, "a11", optInt3);
                                    am.a(a9, "a12", a8);
                                    am.a(a9);
                                }
                            }
                            new StringBuilder("static_enable=").append(f);
                            bf.a();
                            new StringBuilder("bgp_enable=").append(h);
                            bf.a();
                            new StringBuilder("static_ip_direct_enable=").append(g);
                            bf.a();
                            new StringBuilder("bgp_ip_direct_enable=").append(i);
                            bf.a();
                            new StringBuilder("perf_data_upload_enable=").append(j);
                            bf.a();
                        } catch (Throwable th8) {
                            th = th8;
                            ah.a(th, "AuthConfigManager", "load 17S");
                            if (u.a(jSONObject, "15K")) {
                            }
                            context2 = context;
                            if (u.a(jSONObject, "183")) {
                            }
                            if (u.a(jSONObject, "17I")) {
                            }
                        }
                    } catch (Throwable th9) {
                        th = th9;
                        str4 = "umv";
                        ah.a(th, "AuthConfigManager", "load 17S");
                        if (u.a(jSONObject, "15K")) {
                        }
                        context2 = context;
                        if (u.a(jSONObject, "183")) {
                        }
                        if (u.a(jSONObject, "17I")) {
                        }
                    }
                } catch (Throwable th10) {
                    th = th10;
                    str3 = "ust";
                    str4 = "umv";
                    ah.a(th, "AuthConfigManager", "load 17S");
                    if (u.a(jSONObject, "15K")) {
                    }
                    context2 = context;
                    if (u.a(jSONObject, "183")) {
                    }
                    if (u.a(jSONObject, "17I")) {
                    }
                }
                if (u.a(jSONObject, "15K")) {
                    try {
                        jSONObject3 = jSONObject.getJSONObject("15K");
                    } catch (Throwable th11) {
                        context2 = context;
                        ah.a(th11, "AuthConfigManager", "load 15K");
                    }
                    if (jSONObject3 != null) {
                        boolean a10 = a(jSONObject3.optString("ucf"), f.a);
                        boolean a11 = a(jSONObject3.optString("fsv2"), f.b);
                        boolean a12 = a(jSONObject3.optString("usc"), f.c);
                        String str6 = str4;
                        int optInt4 = jSONObject3.optInt(str6, f.d);
                        String str7 = str3;
                        boolean a13 = a(jSONObject3.optString(str7), f.e);
                        String str8 = str2;
                        int optInt5 = jSONObject3.optInt(str8, f.f);
                        if (a10 != f.a || a11 != f.b || a12 != f.c || optInt4 != f.d || a13 != f.e || optInt5 != f.d) {
                            f.a = a10;
                            f.b = a11;
                            f.c = a12;
                            f.d = optInt4;
                            f.e = a13;
                            f.f = optInt5;
                            context2 = context;
                            try {
                                SharedPreferences.Editor a14 = am.a(context2, "open_common");
                                am.a(a14, "ucf", f.a);
                                am.a(a14, "fsv2", f.b);
                                am.a(a14, "usc", f.c);
                                am.a(a14, str6, f.d);
                                am.a(a14, str7, f.e);
                                am.a(a14, str8, f.f);
                                am.a(a14);
                            } catch (Throwable unused) {
                            }
                            if (u.a(jSONObject, "183")) {
                                try {
                                    be.a(tVar, jSONObject.getJSONObject("183"));
                                } catch (Throwable th12) {
                                    ah.a(th12, "AuthConfigManager", "load 183");
                                }
                            }
                            if (u.a(jSONObject, "17I")) {
                                return;
                            }
                            try {
                                JSONObject jSONObject6 = jSONObject.getJSONObject("17I");
                                boolean a15 = a(jSONObject6.optString("na"), false);
                                boolean a16 = a(jSONObject6.optString("aa"), false);
                                ad.d = a15;
                                ad.e = a16;
                                SharedPreferences.Editor a17 = am.a(context2, "open_common");
                                am.a(a17, "a4", a15);
                                am.a(a17, "a5", a16);
                                am.a(a17);
                                return;
                            } catch (Throwable th13) {
                                ah.a(th13, "AuthConfigManager", "load 17I");
                                return;
                            }
                        }
                    }
                }
                context2 = context;
                if (u.a(jSONObject, "183")) {
                }
                if (u.a(jSONObject, "17I")) {
                }
            }
        }
        str2 = "ustv";
        str3 = "ust";
        str4 = "umv";
        if (u.a(jSONObject, "15K")) {
        }
        context2 = context;
        if (u.a(jSONObject, "183")) {
        }
        if (u.a(jSONObject, "17I")) {
        }
    }

    private static void a(Context context, t tVar, Throwable th) {
        a(context, tVar, th.getMessage());
    }

    public static void a(Context context, String str) {
        k.a(context, str);
    }

    private static void a(Context context, String str, String str2, e eVar) {
        if (eVar == null || TextUtils.isEmpty(eVar.a)) {
            return;
        }
        String b2 = eVar.b();
        if (TextUtils.isEmpty(b2) || context == null) {
            return;
        }
        SharedPreferences.Editor a2 = am.a(context, str2);
        a2.putString(str, b2);
        am.a(a2);
    }

    public static void a(bf.c cVar) {
        if (cVar == null || c == null) {
            return;
        }
        HashMap hashMap = new HashMap();
        hashMap.put("serverip", cVar.c);
        hashMap.put("hostname", cVar.e);
        hashMap.put("path", cVar.d);
        hashMap.put("csid", cVar.a);
        hashMap.put("degrade", String.valueOf(cVar.b.a()));
        hashMap.put("errorcode", String.valueOf(cVar.m));
        hashMap.put("errorsubcode", String.valueOf(cVar.n));
        hashMap.put("connecttime", String.valueOf(cVar.h));
        hashMap.put("writetime", String.valueOf(cVar.i));
        hashMap.put("readtime", String.valueOf(cVar.j));
        hashMap.put("datasize", String.valueOf(cVar.l));
        hashMap.put("totaltime", String.valueOf(cVar.f));
        String jSONObject = new JSONObject(hashMap).toString();
        "--埋点--".concat(String.valueOf(jSONObject));
        bf.a();
        if (TextUtils.isEmpty(jSONObject)) {
            return;
        }
        try {
            bn bnVar = new bn(c, "core", "2.0", "O008");
            bnVar.a(jSONObject);
            bo.a(bnVar, c);
        } catch (j unused) {
        }
    }

    private static void a(t tVar) {
        if (tVar != null) {
            try {
                if (TextUtils.isEmpty(tVar.a())) {
                    return;
                }
                String c2 = tVar.c();
                if (TextUtils.isEmpty(c2)) {
                    c2 = tVar.b();
                }
                if (TextUtils.isEmpty(c2)) {
                    return;
                }
                ad.a(tVar.a(), c2);
            } catch (Throwable unused) {
            }
        }
    }

    private static void a(String str, String str2) {
        e a2 = a(c, str, str2);
        String a3 = u.a(System.currentTimeMillis(), Logger.TIMESTAMP_YYYY_MM_DD);
        if (!a3.equals(a2.b)) {
            a2.a(a3);
            a2.c.set(0);
        }
        a2.c.incrementAndGet();
        a(c, str, str2, a2);
    }

    public static synchronized void a(final String str, boolean z2, final String str2, final String str3, final String str4) {
        synchronized (l.class) {
            try {
                if (TextUtils.isEmpty(str)) {
                    return;
                }
                if (u == null) {
                    u = new ConcurrentHashMap<>(8);
                }
                u.put(str, Long.valueOf(SystemClock.elapsedRealtime()));
                if (v == null) {
                    return;
                }
                if (v.containsKey(str)) {
                    if (TextUtils.isEmpty(str)) {
                        return;
                    }
                    if (z2) {
                        be.a(true, str);
                    }
                    cf.a().b(new cg() {
                        @Override
                        public final void a() {
                            d dVar = (d) l.v.get(str);
                            if (dVar == null) {
                                return;
                            }
                            a aVar = dVar.c;
                            b a2 = l.a(l.c, dVar.a, dVar.b, str2, str3, str4);
                            if (a2 == null || aVar == null) {
                                return;
                            }
                            aVar.a(a2);
                        }
                    });
                }
            } catch (Throwable th) {
                ah.a(th, "at", "lca");
            }
        }
    }

    public static void a(String str, boolean z2, boolean z3, boolean z4) {
        if (TextUtils.isEmpty(str) || c == null) {
            return;
        }
        HashMap hashMap = new HashMap();
        hashMap.put("url", str);
        hashMap.put("downLevel", String.valueOf(z2));
        int q2 = n.q(c);
        String str2 = WXInstanceApm.VALUE_ERROR_CODE_DEFAULT;
        hashMap.put("ant", q2 == 0 ? WXInstanceApm.VALUE_ERROR_CODE_DEFAULT : "1");
        hashMap.put("type", z4 ? z2 ? m : n : z2 ? k : l);
        if (!z3) {
            str2 = "1";
        }
        hashMap.put("status", str2);
        String jSONObject = new JSONObject(hashMap).toString();
        if (TextUtils.isEmpty(jSONObject)) {
            return;
        }
        try {
            bn bnVar = new bn(c, "core", "2.0", "O002");
            bnVar.a(jSONObject);
            bo.a(bnVar, c);
        } catch (j unused) {
        }
    }

    public static void a(boolean z2, bf.a aVar) {
        if (!C || aVar == null) {
            return;
        }
        synchronized (B) {
            if (z2) {
                Iterator<bf.a> it = B.iterator();
                while (it.hasNext()) {
                    bf.a next = it.next();
                    if (next.b.equals(aVar.b) && next.e.equals(aVar.e) && next.f == aVar.f) {
                        if (next.j == aVar.j) {
                            it.remove();
                        } else {
                            next.j.set(next.j.get() - aVar.j.get());
                        }
                        bf.a();
                    }
                }
            }
            C = false;
            Iterator<bf.a> it2 = B.iterator();
            while (true) {
                bf.a();
                if (it2.hasNext()) {
                    bf.a next2 = it2.next();
                    StringBuilder sb = new StringBuilder("----path=");
                    sb.append(next2.e);
                    sb.append("-counts=");
                    sb.append(next2.j);
                    sb.append("-code=");
                    sb.append(next2.f);
                    sb.append("----");
                } else {
                    bf.a();
                }
            }
        }
    }

    public static void a(boolean z2, String str) {
        try {
            "--markHostNameFailed---hostname=".concat(String.valueOf(str));
            bf.a();
            if (f || z2) {
                if ((i || !z2) && !TextUtils.isEmpty(str)) {
                    if (z2) {
                        if (A.get(str) != null) {
                            return;
                        }
                        A.put(str, Boolean.TRUE);
                        a(b(str, "a15"), "open_common");
                    } else if (z.get(str) != null) {
                    } else {
                        z.put(str, Boolean.TRUE);
                        a(b(str, "a14"), "open_common");
                    }
                }
            }
        } catch (Throwable unused) {
        }
    }

    public static boolean a() {
        e a2;
        if (c != null) {
            i();
            if (!c()) {
                return false;
            }
            if (b()) {
                return true;
            }
        }
        return o && (a2 = a(c, "IPV6_CONFIG_NAME", "open_common")) != null && a2.a() < 5;
    }

    public static synchronized boolean a(String str) {
        synchronized (l.class) {
            try {
            } finally {
                return false;
            }
            if (TextUtils.isEmpty(str)) {
                return false;
            }
            if (v == null) {
                return false;
            }
            if (u == null) {
                u = new ConcurrentHashMap<>(8);
            }
            if (v.containsKey(str) && !u.containsKey(str)) {
                u.put(str, Long.valueOf(SystemClock.elapsedRealtime()));
                return true;
            }
            return false;
        }
    }

    public static synchronized boolean a(String str, long j2) {
        synchronized (l.class) {
            boolean z2 = false;
            if (TextUtils.isEmpty(str)) {
                return false;
            }
            if (j2 > c(str)) {
                long j3 = 0;
                if (u != null && u.containsKey(str)) {
                    j3 = u.get(str).longValue();
                }
                if (SystemClock.elapsedRealtime() - j3 > 30000) {
                    z2 = true;
                }
            }
            return z2;
        }
    }

    public static boolean a(String str, boolean z2) {
        try {
            if (TextUtils.isEmpty(str)) {
                return z2;
            }
            String[] split = URLDecoder.decode(str).split(Operators.DIV);
            return split[split.length - 1].charAt(4) % 2 == 1;
        } catch (Throwable unused) {
            return z2;
        }
    }

    private static boolean a(InetAddress inetAddress) {
        return inetAddress.isLoopbackAddress() || inetAddress.isLinkLocalAddress() || inetAddress.isAnyLocalAddress();
    }

    private static b b(Context context, t tVar, String str, String str2, String str3, String str4) {
        String str5;
        String str6;
        String str7;
        String str8;
        b bVar;
        String str9;
        String str10;
        String str11;
        bi biVar;
        byte[] bArr;
        String str12;
        String str13;
        boolean isEmpty;
        List<String> list;
        b bVar2 = new b();
        bVar2.f = new JSONObject();
        if (context != null) {
            c = context.getApplicationContext();
        }
        e();
        String str14 = null;
        try {
            a(tVar);
            new bc();
            isEmpty = TextUtils.isEmpty(str);
            if (isEmpty) {
                str11 = str;
            } else {
                try {
                    StringBuilder sb = new StringBuilder();
                    str5 = str;
                    try {
                        sb.append(str5);
                        sb.append(";15K;16H;17I;17S;183");
                        str11 = sb.toString();
                    } catch (j e2) {
                        e = e2;
                        str6 = "infocode";
                        str7 = "result";
                        str8 = "ver";
                        bVar = bVar2;
                        str9 = "at";
                        str10 = "lc";
                        try {
                            throw e;
                        } catch (j e3) {
                            e = e3;
                            str11 = str5;
                            biVar = null;
                            bArr = null;
                            bVar.c = e.a();
                            a(context, tVar, e.a());
                            ak.a(tVar, "/v3/iasdkauth", e);
                            String str15 = str11;
                            if (bArr == null) {
                            }
                        } catch (IllegalBlockSizeException e4) {
                            e = e4;
                            str11 = str5;
                            biVar = null;
                            bArr = null;
                            a(context, tVar, e);
                            String str152 = str11;
                            if (bArr == null) {
                            }
                        } catch (Throwable th) {
                            e = th;
                            str11 = str5;
                            biVar = null;
                            bArr = null;
                            ak.b(e, str9, str10);
                            a(context, tVar, e);
                            String str1522 = str11;
                            if (bArr == null) {
                            }
                        }
                    } catch (Throwable unused) {
                        str11 = str5;
                        str6 = "infocode";
                        str7 = "result";
                        str8 = "ver";
                        bVar = bVar2;
                        str9 = "at";
                        str10 = "lc";
                        try {
                            throw new j(AMapException.ERROR_UNKNOWN);
                        } catch (j e5) {
                            e = e5;
                            biVar = null;
                            bArr = null;
                            bVar.c = e.a();
                            a(context, tVar, e.a());
                            ak.a(tVar, "/v3/iasdkauth", e);
                            String str15222 = str11;
                            if (bArr == null) {
                            }
                        } catch (IllegalBlockSizeException e6) {
                            e = e6;
                            biVar = null;
                            bArr = null;
                            a(context, tVar, e);
                            String str152222 = str11;
                            if (bArr == null) {
                            }
                        } catch (Throwable th2) {
                            e = th2;
                            biVar = null;
                            bArr = null;
                            ak.b(e, str9, str10);
                            a(context, tVar, e);
                            String str1522222 = str11;
                            if (bArr == null) {
                            }
                        }
                    }
                } catch (j e7) {
                    e = e7;
                    str5 = str;
                } catch (Throwable unused2) {
                    str5 = str;
                }
            }
            try {
                d(context);
                str7 = "result";
                bVar = bVar2;
                str8 = "ver";
                str9 = "at";
                str6 = "infocode";
                str10 = "lc";
            } catch (j e8) {
                e = e8;
                str6 = "infocode";
                str7 = "result";
                str8 = "ver";
                bVar = bVar2;
                str9 = "at";
                str10 = "lc";
            } catch (Throwable unused3) {
                str6 = "infocode";
                str7 = "result";
                str8 = "ver";
                bVar = bVar2;
                str9 = "at";
                str10 = "lc";
                throw new j(AMapException.ERROR_UNKNOWN);
            }
        } catch (j e9) {
            e = e9;
            str5 = str;
            str6 = "infocode";
            str7 = "result";
            str8 = "ver";
            bVar = bVar2;
            str9 = "at";
            str10 = "lc";
        } catch (IllegalBlockSizeException e10) {
            e = e10;
            str5 = str;
            str6 = "infocode";
            str7 = "result";
            str8 = "ver";
            bVar = bVar2;
            str9 = "at";
            str10 = "lc";
        } catch (Throwable th3) {
            e = th3;
            str5 = str;
            str6 = "infocode";
            str7 = "result";
            str8 = "ver";
            bVar = bVar2;
            str9 = "at";
            str10 = "lc";
        }
        try {
            biVar = bc.a(new c(context, tVar, str11, str2, str3, str4));
            if (isEmpty) {
                return bVar;
            }
            if (biVar != null) {
                try {
                    bArr = biVar.a;
                    try {
                        Map<String, List<String>> map = biVar.b;
                        if (map != null && map.containsKey("lct") && (list = map.get("lct")) != null && list.size() > 0) {
                            String str16 = list.get(0);
                            if (!TextUtils.isEmpty(str16)) {
                                bVar.e = Long.valueOf(str16).longValue();
                                if (tVar != null && bVar.e != 0) {
                                    String a2 = tVar.a();
                                    if (!TextUtils.isEmpty(a2)) {
                                        b(a2, bVar.e);
                                    }
                                }
                            }
                        }
                    } catch (Throwable th4) {
                        try {
                            ak.b(th4, str9, "lct");
                        } catch (j e11) {
                            e = e11;
                            bVar.c = e.a();
                            a(context, tVar, e.a());
                            ak.a(tVar, "/v3/iasdkauth", e);
                            String str15222222 = str11;
                            if (bArr == null) {
                            }
                        } catch (IllegalBlockSizeException e12) {
                            e = e12;
                            a(context, tVar, e);
                            String str152222222 = str11;
                            if (bArr == null) {
                            }
                        } catch (Throwable th5) {
                            e = th5;
                            ak.b(e, str9, str10);
                            a(context, tVar, e);
                            String str1522222222 = str11;
                            if (bArr == null) {
                            }
                        }
                    }
                } catch (j e13) {
                    e = e13;
                    bArr = null;
                    bVar.c = e.a();
                    a(context, tVar, e.a());
                    ak.a(tVar, "/v3/iasdkauth", e);
                    String str15222222222 = str11;
                    if (bArr == null) {
                    }
                } catch (IllegalBlockSizeException e14) {
                    e = e14;
                    bArr = null;
                    a(context, tVar, e);
                    String str152222222222 = str11;
                    if (bArr == null) {
                    }
                } catch (Throwable th6) {
                    e = th6;
                    bArr = null;
                    ak.b(e, str9, str10);
                    a(context, tVar, e);
                    String str1522222222222 = str11;
                    if (bArr == null) {
                    }
                }
            } else {
                bArr = null;
            }
            byte[] bArr2 = new byte[16];
            byte[] bArr3 = new byte[bArr.length - 16];
            System.arraycopy(bArr, 0, bArr2, 0, 16);
            System.arraycopy(bArr, 16, bArr3, 0, bArr.length - 16);
            SecretKeySpec secretKeySpec = new SecretKeySpec(bArr2, u.c("EQUVT"));
            Cipher cipher = Cipher.getInstance(u.c("CQUVTL0NCQy9QS0NTNVBhZGRpbmc"));
            cipher.init(2, secretKeySpec, new IvParameterSpec(u.c()));
            str14 = u.a(cipher.doFinal(bArr3));
            String str15222222222222 = str11;
            if (bArr == null) {
                return bVar;
            }
            if (TextUtils.isEmpty(str14)) {
                str14 = u.a(bArr);
            }
            String str17 = str14;
            if (TextUtils.isEmpty(str17)) {
                a(context, tVar, "result is null");
            }
            try {
                JSONObject jSONObject = new JSONObject(str17);
                if (jSONObject.has("status")) {
                    int i2 = jSONObject.getInt("status");
                    if (i2 == 1) {
                        a = 1;
                    } else if (i2 == 0) {
                        if (biVar != null) {
                            str12 = biVar.c;
                            str13 = biVar.d;
                        } else {
                            str12 = "authcsid";
                            str13 = "authgsid";
                        }
                        u.a(context, str12, str13, jSONObject);
                        a = 0;
                        if (jSONObject.has("info")) {
                            b = jSONObject.getString("info");
                        }
                        String str18 = str6;
                        ak.a(tVar, "/v3/iasdkauth", b, str13, str12, jSONObject.has(str18) ? jSONObject.getString(str18) : "");
                        if (a == 0) {
                            bVar.c = b;
                            return bVar;
                        }
                    }
                    String str19 = str8;
                    if (jSONObject.has(str19)) {
                        bVar.d = jSONObject.getInt(str19);
                    }
                    String str20 = str7;
                    if (u.a(jSONObject, str20)) {
                        JSONObject jSONObject2 = jSONObject.getJSONObject(str20);
                        a(context, tVar, str15222222222222, bVar, jSONObject2);
                        try {
                            JSONObject jSONObject3 = jSONObject2.getJSONObject("15K");
                            boolean a3 = a(jSONObject3.optString("isTargetAble"), false);
                            if (a(jSONObject3.optString("able"), false)) {
                                p.a().a(context, a3);
                            } else {
                                p.a();
                                p.b(context);
                            }
                        } catch (Throwable unused4) {
                        }
                    }
                }
            } catch (Throwable th7) {
                ah.a(th7, str9, str10);
            }
            return bVar;
        } catch (j e15) {
            e = e15;
            str5 = str11;
            throw e;
        } catch (Throwable unused5) {
            throw new j(AMapException.ERROR_UNKNOWN);
        }
    }

    private static String b(String str, String str2) {
        String a2 = r.a(str.getBytes());
        return str2 + "_" + a2;
    }

    public static void b(Context context) {
        if (context == null) {
            return;
        }
        o = am.a(context, "open_common", "a2", true);
    }

    public static void b(bf.c cVar) {
        synchronized (B) {
            boolean z2 = false;
            for (int i2 = 0; i2 < B.size(); i2++) {
                bf.a aVar = B.get(i2);
                if (cVar.c.equals(aVar.b) && cVar.d.equals(aVar.e) && cVar.m == aVar.f) {
                    if (aVar.f == 1) {
                        aVar.i = ((aVar.j.get() * aVar.i) + cVar.f) / (aVar.j.get() + 1);
                    }
                    aVar.j.getAndIncrement();
                    z2 = true;
                }
            }
            if (!z2) {
                B.add(new bf.a(cVar));
            }
            bf.a();
        }
    }

    public static synchronized void b(String str) {
        synchronized (l.class) {
            if (u == null) {
                return;
            }
            if (u.containsKey(str)) {
                u.remove(str);
            }
        }
    }

    private static synchronized void b(String str, long j2) {
        synchronized (l.class) {
            try {
                if (v != null && v.containsKey(str)) {
                    if (t == null) {
                        t = new ConcurrentHashMap<>(8);
                    }
                    t.put(str, Long.valueOf(j2));
                    Context context = c;
                    if (context != null) {
                        SharedPreferences.Editor a2 = am.a(context, "open_common");
                        am.a(a2, str, j2);
                        am.a(a2);
                    }
                }
            } catch (Throwable th) {
                ah.a(th, "at", "ucut");
            }
        }
    }

    public static synchronized void b(String str, boolean z2) {
        synchronized (l.class) {
            a(str, z2, (String) null, (String) null, (String) null);
        }
    }

    public static boolean b() {
        Integer num;
        Context context = c;
        if (context == null) {
            return false;
        }
        String v2 = n.v(context);
        return (TextUtils.isEmpty(v2) || (num = q.get(v2.toUpperCase())) == null || num.intValue() != 2) ? false : true;
    }

    public static synchronized long c(String str) {
        synchronized (l.class) {
            try {
                if (t == null) {
                    t = new ConcurrentHashMap<>(8);
                }
                if (t.containsKey(str)) {
                    return t.get(str).longValue();
                }
            } finally {
                return 0L;
            }
            return 0L;
        }
    }

    private static void c(Context context) {
        if (context == null) {
            return;
        }
        f = am.a(context, "open_common", "a13", true);
        h = am.a(context, "open_common", "a6", true);
        g = am.a(context, "open_common", "a7", false);
        e = am.a(context, "open_common", "a8", 5000);
        x = am.a(context, "open_common", "a9", 3);
        i = am.a(context, "open_common", "a10", false);
        y = am.a(context, "open_common", "a11", 3);
        j = am.a(context, "open_common", "a12", false);
    }

    public static void c(bf.c cVar) {
        if (cVar != null && j) {
            synchronized (D) {
                D.offer(cVar);
                bf.a();
            }
        }
    }

    public static boolean c() {
        Integer num;
        Context context = c;
        if (context == null) {
            return false;
        }
        String v2 = n.v(context);
        return (TextUtils.isEmpty(v2) || (num = q.get(v2.toUpperCase())) == null || num.intValue() < 2) ? false : true;
    }

    public static void d() {
        try {
            e a2 = a(c, "IPV6_CONFIG_NAME", "open_common");
            String a3 = u.a(System.currentTimeMillis(), Logger.TIMESTAMP_YYYY_MM_DD);
            if (!a3.equals(a2.b)) {
                a2.a(a3);
                a2.c.set(0);
            }
            a2.c.incrementAndGet();
            a(c, "IPV6_CONFIG_NAME", "open_common", a2);
        } catch (Throwable unused) {
        }
    }

    private static void d(Context context) {
        try {
            if (w) {
                return;
            }
            ad.d = am.a(context, "open_common", "a4", true);
            ad.e = am.a(context, "open_common", "a5", true);
            w = true;
        } catch (Throwable unused) {
        }
    }

    public static boolean d(String str) {
        e a2;
        try {
            if (TextUtils.isEmpty(str)) {
                return true;
            }
            if (f) {
                if (z.get(str) == null) {
                    Context context = c;
                    if (context == null || (a2 = a(context, b(str, "a14"), "open_common")) == null) {
                        return true;
                    }
                    return a2.a() < x;
                }
                return false;
            }
            return false;
        } catch (Throwable unused) {
            return true;
        }
    }

    public static void e() {
        if (d) {
            return;
        }
        try {
            Context context = c;
            if (context == null) {
                return;
            }
            d = true;
            p.a().a(context);
            b(context);
            c(context);
            f.a = am.a(context, "open_common", "ucf", f.a);
            f.b = am.a(context, "open_common", "fsv2", f.b);
            f.c = am.a(context, "open_common", "usc", f.c);
            f.d = am.a(context, "open_common", "umv", f.d);
            f.e = am.a(context, "open_common", "ust", f.e);
            f.f = am.a(context, "open_common", "ustv", f.f);
        } catch (Throwable unused) {
        }
    }

    public static boolean e(String str) {
        e a2;
        if (!TextUtils.isEmpty(str) && i) {
            if (A.get(str) == null) {
                Context context = c;
                if (context == null || (a2 = a(context, b(str, "a15"), "open_common")) == null) {
                    return true;
                }
                return a2.a() < y;
            }
            return false;
        }
        return false;
    }

    public static bf.a f() {
        if (C) {
            return null;
        }
        synchronized (B) {
            if (C) {
                return null;
            }
            Collections.sort(B);
            if (B.size() > 0) {
                bf.a clone = B.get(0).clone();
                C = true;
                return clone;
            }
            return null;
        }
    }

    public static bf.c g() {
        synchronized (D) {
            bf.c poll = D.poll();
            if (poll != null) {
                return poll;
            }
            return null;
        }
    }

    private static void i() {
        Map<String, Integer> map;
        String str;
        Integer valueOf;
        try {
            Context context = c;
            if (context != null) {
                String v2 = n.v(context);
                if (!TextUtils.isEmpty(r) && !TextUtils.isEmpty(v2) && r.equals(v2) && System.currentTimeMillis() - s < 60000) {
                    return;
                }
                if (!TextUtils.isEmpty(v2)) {
                    r = v2;
                }
            } else if (System.currentTimeMillis() - s < 10000) {
                return;
            }
            s = System.currentTimeMillis();
            q.clear();
            Iterator it = Collections.list(NetworkInterface.getNetworkInterfaces()).iterator();
            while (it.hasNext()) {
                NetworkInterface networkInterface = (NetworkInterface) it.next();
                if (!networkInterface.getInterfaceAddresses().isEmpty()) {
                    String displayName = networkInterface.getDisplayName();
                    int i2 = 0;
                    for (InterfaceAddress interfaceAddress : networkInterface.getInterfaceAddresses()) {
                        InetAddress address = interfaceAddress.getAddress();
                        if (address instanceof Inet6Address) {
                            if (!a((Inet6Address) address)) {
                                i2 |= 2;
                            }
                        } else if (address instanceof Inet4Address) {
                            Inet4Address inet4Address = (Inet4Address) address;
                            if (!a(inet4Address) && !inet4Address.getHostAddress().startsWith(u.c("FMTkyLjE2OC40My4"))) {
                                i2 |= 1;
                            }
                        }
                    }
                    if (i2 != 0) {
                        if (displayName != null && displayName.startsWith("wlan")) {
                            map = q;
                            str = "WIFI";
                            valueOf = Integer.valueOf(i2);
                        } else if (displayName != null && displayName.startsWith("rmnet")) {
                            map = q;
                            str = "MOBILE";
                            valueOf = Integer.valueOf(i2);
                        }
                        map.put(str, valueOf);
                    }
                }
            }
        } catch (Throwable th) {
            ah.a(th, "at", "ipstack");
        }
    }
}