QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

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


package com.tencent.featuretoggle.hltxkg.common.a;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.LinkProperties;
import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.PowerManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.tencent.common.http.Apn;
import com.tencent.mtt.compliance.MethodDelegate;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.net.Proxy;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import tmsdk.common.gourd.vine.IMessageCenter;

public final class e {

    private static volatile byte f10977a = 0;

    private static volatile boolean f10978b = true;

    private static String f10979c = "";

    private static String f10980d = "unknown";
    private static volatile int e = 0;
    private static volatile boolean f = false;
    private static volatile int g = -1;
    private static Map<String, j> h = new ConcurrentHashMap();
    private static BroadcastReceiver i = new f();
    private static String j = "";
    private static String k = Apn.APN_CMWAP;
    private static String l = Apn.APN_3GWAP;
    private static String m = Apn.APN_UNIWAP;
    private static String n = Apn.APN_CTWAP;

    private static byte a(String str) {
        NetworkInterface byName;
        try {
            byName = NetworkInterface.getByName(str);
        } catch (Exception unused) {
        }
        if (!byName.isUp()) {
            return (byte) 1;
        }
        Iterator<InterfaceAddress> it = byName.getInterfaceAddresses().iterator();
        boolean z = false;
        boolean z2 = false;
        while (it.hasNext()) {
            InetAddress address = it.next().getAddress();
            if (!address.isLoopbackAddress()) {
                String hostAddress = MethodDelegate.getHostAddress(address);
                if (hostAddress.contains("%")) {
                    hostAddress = hostAddress.split("%")[0];
                }
                if (i.b(hostAddress)) {
                    z = true;
                } else if (!z2 && i.c(hostAddress) && i.a(hostAddress)) {
                    z2 = true;
                }
            }
        }
        if (z && z2) {
            return (byte) 2;
        }
        if (z2) {
            return (byte) 3;
        }
        return z ? (byte) 1 : (byte) 0;
    }

    public static void a() {
        try {
            m();
            d();
            com.tencent.featuretoggle.hltxkg.common.a.a().registerReceiver(i, new IntentFilter(IMessageCenter.MSG_SYS_CONNECTIVITY_ACTION));
        } catch (Throwable unused) {
        }
    }

    public static void a(String str, j jVar) {
        synchronized (h) {
            h.put(str, jVar);
        }
    }

    public static String b() {
        return f10980d;
    }

    public static String c() {
        int i2 = e;
        return i2 != 1 ? i2 != 2 ? i2 != 3 ? i2 != 4 ? "" : "4g" : "3g" : "2g" : "wifi";
    }

    public static synchronized void d() {
        boolean contains;
        synchronized (e.class) {
            int i2 = e;
            try {
                NetworkInfo activeNetworkInfo = ((ConnectivityManager) com.tencent.featuretoggle.hltxkg.common.a.a().getSystemService("connectivity")).getActiveNetworkInfo();
                if (activeNetworkInfo != null && activeNetworkInfo.isAvailable() && activeNetworkInfo.isConnected()) {
                    f10978b = true;
                    int type = activeNetworkInfo.getType();
                    if (type == 1) {
                        e = 1;
                        g = 0;
                        f = false;
                        WifiInfo connectionInfo = MethodDelegate.getConnectionInfo((WifiManager) com.tencent.featuretoggle.hltxkg.common.a.a().getApplicationContext().getSystemService("wifi"));
                        f10980d = "ssid_" + connectionInfo.getSSID() + connectionInfo.getBSSID();
                    } else {
                        String extraInfo = activeNetworkInfo.getExtraInfo();
                        if (extraInfo != null) {
                            f10979c = extraInfo.trim().toLowerCase();
                            if (type == 0) {
                                f10980d = "apn_" + f10979c;
                                int subtype = activeNetworkInfo.getSubtype();
                                g = subtype;
                                if (subtype != 1 && subtype != 2 && subtype != 4) {
                                    if (subtype != 13 && subtype != 19) {
                                        e = 3;
                                        contains = f10979c.contains("wap");
                                        f = contains;
                                        if (contains) {
                                            j = f10979c.contains(l) ? "10.0.0.172" : f10979c.contains(k) ? "10.0.0.172" : f10979c.contains(m) ? "10.0.0.172" : f10979c.contains(n) ? "10.0.0.200" : "";
                                        }
                                    }
                                    e = 4;
                                    contains = f10979c.contains("wap");
                                    f = contains;
                                    if (contains) {
                                    }
                                }
                                e = 2;
                                contains = f10979c.contains("wap");
                                f = contains;
                                if (contains) {
                                }
                            } else {
                                f10979c = "unknown";
                                e = 0;
                                g = -1;
                                f10980d = "unknown";
                            }
                        } else {
                            f10979c = "unknown";
                            e = 0;
                            g = -1;
                            f10980d = "unknown";
                        }
                        f = false;
                    }
                } else {
                    f10979c = "unknown";
                    e = 0;
                    g = -1;
                    f10980d = "unknown";
                    f = false;
                    f10978b = false;
                    f10977a = (byte) 0;
                }
                if (i2 != e) {
                    synchronized (h) {
                        for (j jVar : h.values()) {
                            if (jVar != null) {
                                jVar.a(e, f10980d);
                            }
                        }
                    }
                }
            } catch (Throwable th) {
                try {
                    th.printStackTrace();
                    if (i2 != e) {
                        synchronized (h) {
                            for (j jVar2 : h.values()) {
                                if (jVar2 != null) {
                                    jVar2.a(e, f10980d);
                                }
                            }
                        }
                    }
                } catch (Throwable th2) {
                    if (i2 != e) {
                        synchronized (h) {
                            for (j jVar3 : h.values()) {
                                if (jVar3 != null) {
                                    jVar3.a(e, f10980d);
                                }
                            }
                        }
                    }
                    throw th2;
                }
            }
        }
    }

    public static int e() {
        return e;
    }

    public static byte f() {
        return f10977a;
    }

    public static boolean g() {
        return f10978b;
    }

    public static boolean h() {
        return f;
    }

    public static Integer i() {
        d();
        Integer num = 3;
        boolean z = true;
        int i2 = 0;
        if (e != 2 && e != 3 && e != 4) {
            z = false;
        }
        if (z) {
            Context a2 = com.tencent.featuretoggle.hltxkg.common.a.a();
            String str = f10979c;
            TelephonyManager telephonyManager = (TelephonyManager) a2.getSystemService("phone");
            if (telephonyManager != null && telephonyManager.getSimState() == 5) {
                String simOperator = telephonyManager.getSimOperator();
                if (simOperator.length() > 0) {
                    if (!simOperator.equals("46000") && !simOperator.equals("46002")) {
                        if (!simOperator.equals("46001")) {
                        }
                        num = 2;
                        i2 = num.intValue();
                    }
                    num = 1;
                    i2 = num.intValue();
                }
            }
            if (str != null) {
                String lowerCase = str.toLowerCase();
                if (!lowerCase.contains("cmnet") && !lowerCase.contains(Apn.APN_CMWAP)) {
                    if (!lowerCase.contains(Apn.APN_UNINET) && !lowerCase.contains(Apn.APN_UNIWAP) && !lowerCase.contains(Apn.APN_3GNET) && !lowerCase.contains(Apn.APN_3GWAP)) {
                        if (!lowerCase.contains(Apn.APN_CTNET)) {
                        }
                        i2 = num.intValue();
                    }
                    num = 2;
                    i2 = num.intValue();
                }
                num = 1;
                i2 = num.intValue();
            }
            num = 0;
            i2 = num.intValue();
        }
        return Integer.valueOf(i2);
    }

    public static Proxy j() {
        if (!f || TextUtils.isEmpty(j)) {
            return null;
        }
        return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(j, 80));
    }

    public static boolean k() {
        try {
            PowerManager powerManager = (PowerManager) com.tencent.featuretoggle.hltxkg.common.a.a().getSystemService("power");
            if (Build.VERSION.SDK_INT < 23 || powerManager == null) {
                return false;
            }
            return ((Boolean) PowerManager.class.getDeclaredMethod("isDeviceIdleMode", new Class[0]).invoke(powerManager, new Object[0])).booleanValue();
        } catch (Throwable unused) {
            return false;
        }
    }

    public static boolean m() {
        if (Build.VERSION.SDK_INT < 21) {
            f10977a = (byte) 1;
            return false;
        }
        ConnectivityManager connectivityManager = (ConnectivityManager) com.tencent.featuretoggle.hltxkg.common.a.a().getSystemService("connectivity");
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        if (activeNetworkInfo == null || !activeNetworkInfo.isAvailable() || !activeNetworkInfo.isConnected()) {
            f10977a = (byte) 0;
            return false;
        }
        try {
            LinkProperties linkProperties = (LinkProperties) ConnectivityManager.class.getDeclaredMethod("getActiveLinkProperties", new Class[0]).invoke(connectivityManager, new Object[0]);
            if (linkProperties == null) {
                f10977a = (byte) 0;
            } else {
                f10977a = a(linkProperties.getInterfaceName());
            }
        } catch (Exception unused) {
            f10977a = (byte) 0;
        }
        return true;
    }
}