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

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


package kcsdkint;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Proxy;
import android.os.Build;
import android.text.TextUtils;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;

public final class ns {
    public static int a(Context context) {
        nq.f = false;
        nq.a(context);
        if (3 == nq.g) {
            return 1;
        }
        switch (nq.i) {
            case 0:
                return 2;
            case 1:
                return 3;
            case 2:
                return 4;
            case 3:
                return 5;
            case 4:
                return 6;
            case 5:
                return 7;
            case 6:
                return 8;
            case 7:
                return 9;
            case 8:
                return 10;
            default:
                return 0;
        }
    }

    public static boolean a() {
        NetworkInfo c2 = c();
        if (c2 == null) {
            return false;
        }
        return c2.isConnected();
    }

    public static int b() {
        String f;
        try {
            NetworkInfo c2 = c();
            if (c2 == null) {
                return 0;
            }
            if (c2.getType() == 1) {
                return 2;
            }
            if (c2.getType() != 0 || (f = f()) == null || f.length() <= 0) {
                return 4;
            }
            return g() > 0 ? 3 : 4;
        } catch (Throwable unused) {
            return 4;
        }
    }

    public static int b(Context context) {
        nq.f = false;
        nq.a(context);
        switch (nq.j) {
            case 1:
                return 1;
            case 2:
                return 2;
            case 3:
                return 3;
            case 4:
                return 4;
            case 5:
                return 5;
            case 6:
                return 6;
            case 7:
                return 7;
            case 8:
                return 8;
            case 9:
                return 9;
            case 10:
                return 10;
            case 11:
                return 11;
            case 12:
                return 12;
            case 13:
                return 13;
            case 14:
                return 14;
            case 15:
                return 15;
            case 16:
                return 16;
            case 17:
                return 17;
            case 18:
                return 18;
            case 19:
                return 19;
            case 20:
                return 20;
            case 21:
                return 21;
            case 22:
            default:
                return 0;
        }
    }

    public static NetworkInfo c() {
        try {
            return ((ConnectivityManager) ll.f84496a.getSystemService("connectivity")).getActiveNetworkInfo();
        } catch (Throwable unused) {
            return null;
        }
    }

    public static boolean d() {
        Socket socket;
        System.currentTimeMillis();
        boolean z = false;
        try {
            InetSocketAddress inetSocketAddress = new InetSocketAddress(InetAddress.getByName("www.qq.com"), 80);
            socket = new Socket();
            try {
                socket.setSoLinger(false, 0);
                socket.connect(inetSocketAddress, 5000);
                z = true;
            } catch (Throwable unused) {
            }
        } catch (Throwable unused2) {
            socket = null;
        }
        try {
            socket.close();
        } catch (Throwable unused3) {
            return z;
        }
    }

    public static boolean e() {
        if (2 != b()) {
            return false;
        }
        String str = null;
        try {
            new Object() {
            };
            str = nt.b();
        } catch (ml unused) {
        }
        return !TextUtils.isEmpty(str);
    }

    public static String f() {
        try {
            return h() ? System.getProperty("http.proxyHost") : Proxy.getHost(ll.f84496a);
        } catch (Exception unused) {
            return null;
        }
    }

    public static int g() {
        try {
            return h() ? Integer.parseInt(System.getProperty("http.proxyPort")) : Proxy.getPort(ll.f84496a);
        } catch (Exception unused) {
            return -1;
        }
    }

    private static boolean h() {
        return Build.VERSION.SDK_INT >= 14;
    }
}