鑫垚影视 v20.42版本的 MD5 值为:e3822d25ef47121f1770bb4806abacfe

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


package e.l.a.j;

import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.telephony.TelephonyManager;
import com.efs.sdk.base.core.util.NetworkUtil;
import com.movie.heaven.app.App;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.URI;
import java.net.UnknownHostException;
import java.util.Enumeration;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.regex.Pattern;

public class p {

    private static Context f14413a = App.getContext();

    private static final Pattern f14414b = Pattern.compile("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$");

    private static final int f14415c = 16;

    private static final int f14416d = 17;

    private static final int f14417e = 18;

    public static class a implements Callable<String> {

        public final String f14418a;

        public a(String str) {
            this.f14418a = str;
        }

        @Override
        public String call() throws Exception {
            try {
                return InetAddress.getByName(this.f14418a).getHostAddress();
            } catch (UnknownHostException e2) {
                e2.printStackTrace();
                return null;
            }
        }
    }

    public enum b {
        NETWORK_WIFI,
        NETWORK_4G,
        NETWORK_3G,
        NETWORK_2G,
        NETWORK_UNKNOWN,
        NETWORK_NO
    }

    private p() {
        throw new UnsupportedOperationException("u can'getResponseHeader instantiate me...");
    }

    private static NetworkInfo a() {
        return ((ConnectivityManager) f14413a.getSystemService("connectivity")).getActiveNetworkInfo();
    }

    public static boolean b() {
        try {
            TelephonyManager telephonyManager = (TelephonyManager) f14413a.getSystemService(e.l.a.g.g.f14042h);
            Method declaredMethod = telephonyManager.getClass().getDeclaredMethod("getDataEnabled", new Class[0]);
            if (declaredMethod != null) {
                return ((Boolean) declaredMethod.invoke(telephonyManager, new Object[0])).booleanValue();
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        return false;
    }

    public static String c(String str) {
        try {
            return (String) Executors.newCachedThreadPool().submit(new a(str)).get();
        } catch (InterruptedException | ExecutionException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public static String d(boolean z) {
        try {
            Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
            while (networkInterfaces.hasMoreElements()) {
                NetworkInterface nextElement = networkInterfaces.nextElement();
                if (nextElement.isUp()) {
                    Enumeration<InetAddress> inetAddresses = nextElement.getInetAddresses();
                    while (inetAddresses.hasMoreElements()) {
                        InetAddress nextElement2 = inetAddresses.nextElement();
                        if (!nextElement2.isLoopbackAddress()) {
                            String hostAddress = nextElement2.getHostAddress();
                            boolean z2 = hostAddress.indexOf(58) < 0;
                            if (z) {
                                if (z2) {
                                    return hostAddress;
                                }
                            } else if (!z2) {
                                int indexOf = hostAddress.indexOf(37);
                                return indexOf < 0 ? hostAddress.toUpperCase() : hostAddress.substring(0, indexOf).toUpperCase();
                            }
                        }
                    }
                }
            }
            return null;
        } catch (SocketException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public static InetAddress e() {
        Enumeration<NetworkInterface> enumeration;
        try {
            enumeration = NetworkInterface.getNetworkInterfaces();
        } catch (SocketException e2) {
            e2.printStackTrace();
            enumeration = null;
        }
        if (enumeration != null) {
            while (enumeration.hasMoreElements()) {
                Enumeration<InetAddress> inetAddresses = enumeration.nextElement().getInetAddresses();
                if (inetAddresses != null) {
                    while (inetAddresses.hasMoreElements()) {
                        InetAddress nextElement = inetAddresses.nextElement();
                        if (!nextElement.isLoopbackAddress() && l(nextElement.getHostAddress())) {
                            return nextElement;
                        }
                    }
                }
            }
        }
        return null;
    }

    public static String f() {
        TelephonyManager telephonyManager = (TelephonyManager) f14413a.getSystemService(e.l.a.g.g.f14042h);
        if (telephonyManager != null) {
            return telephonyManager.getNetworkOperatorName();
        }
        return null;
    }

    public static b g() {
        b bVar = b.NETWORK_NO;
        NetworkInfo a2 = a();
        if (a2 == null || !a2.isAvailable()) {
            return bVar;
        }
        if (a2.getType() == 1) {
            return b.NETWORK_WIFI;
        }
        if (a2.getType() == 0) {
            switch (a2.getSubtype()) {
                case 1:
                case 2:
                case 4:
                case 7:
                case 11:
                case 16:
                    return b.NETWORK_2G;
                case 3:
                case 5:
                case 6:
                case 8:
                case 9:
                case 10:
                case 12:
                case 14:
                case 15:
                case 17:
                    return b.NETWORK_3G;
                case 13:
                case 18:
                    return b.NETWORK_4G;
                default:
                    String subtypeName = a2.getSubtypeName();
                    if (!subtypeName.equalsIgnoreCase("TD-SCDMA") && !subtypeName.equalsIgnoreCase("WCDMA") && !subtypeName.equalsIgnoreCase("CDMA2000")) {
                        return b.NETWORK_UNKNOWN;
                    }
                    return b.NETWORK_3G;
            }
        }
        return b.NETWORK_UNKNOWN;
    }

    public static boolean h() {
        return ((WifiManager) f14413a.getSystemService(NetworkUtil.NETWORK_TYPE_WIFI)).isWifiEnabled();
    }

    public static boolean i() {
        NetworkInfo a2 = a();
        return a2 != null && a2.isAvailable() && a2.getSubtype() == 13;
    }

    public static boolean j() {
        NetworkInfo a2 = a();
        return a2 != null && a2.isAvailable();
    }

    public static boolean k() {
        NetworkInfo a2 = a();
        return a2 != null && a2.isConnected();
    }

    public static boolean l(String str) {
        return f14414b.matcher(str).matches();
    }

    public static boolean m() {
        return h() && j();
    }

    public static boolean n() {
        ConnectivityManager connectivityManager = (ConnectivityManager) f14413a.getSystemService("connectivity");
        return (connectivityManager == null || connectivityManager.getActiveNetworkInfo() == null || connectivityManager.getActiveNetworkInfo().getType() != 1) ? false : true;
    }

    public static void o() {
        if (Build.VERSION.SDK_INT > 10) {
            f14413a.startActivity(new Intent("android.settings.WIRELESS_SETTINGS").setFlags(268435456));
        } else {
            f14413a.startActivity(new Intent("android.settings.SETTINGS").setFlags(268435456));
        }
    }

    public static final boolean p() {
        return q(null);
    }

    public static final boolean q(String str) {
        URI c2;
        Runtime runtime = Runtime.getRuntime();
        Process process = null;
        try {
            try {
                String str2 = "www.baidu.com";
                if (!x.f(str) && (c2 = x.c(str)) != null) {
                    str2 = c2.getHost();
                }
                process = runtime.exec("ping -c 5 -w 4 " + str2);
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
                StringBuffer stringBuffer = new StringBuffer();
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    stringBuffer.append(readLine);
                }
                if (process.waitFor() == 0) {
                    if (process != null) {
                        process.destroy();
                    }
                    runtime.gc();
                    return true;
                }
                if (stringBuffer.indexOf("100% packet loss") != -1) {
                    if (process != null) {
                        process.destroy();
                    }
                    runtime.gc();
                    return false;
                }
                if (process != null) {
                    process.destroy();
                }
                runtime.gc();
                return true;
            } catch (Exception e2) {
                e2.printStackTrace();
                if (process != null) {
                    process.destroy();
                }
                runtime.gc();
                return false;
            }
        } catch (Throwable th) {
            if (process != null) {
                process.destroy();
            }
            runtime.gc();
            throw th;
        }
    }

    public static void r(boolean z) {
        try {
            TelephonyManager telephonyManager = (TelephonyManager) f14413a.getSystemService(e.l.a.g.g.f14042h);
            Method declaredMethod = telephonyManager.getClass().getDeclaredMethod("setDataEnabled", Boolean.TYPE);
            if (declaredMethod != null) {
                declaredMethod.invoke(telephonyManager, Boolean.valueOf(z));
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static void s(boolean z) {
        WifiManager wifiManager = (WifiManager) f14413a.getSystemService(NetworkUtil.NETWORK_TYPE_WIFI);
        if (z) {
            if (wifiManager.isWifiEnabled()) {
                return;
            }
            wifiManager.setWifiEnabled(true);
        } else if (wifiManager.isWifiEnabled()) {
            wifiManager.setWifiEnabled(false);
        }
    }
}