得物.apk(点击下载) / g.java


package cn.com.chinatelecom.account.api.e;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import cn.com.chinatelecom.account.api.a;
import cn.com.chinatelecom.account.api.a.d;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import java.lang.reflect.Method;

public class g {

    /* renamed from: a  reason: collision with root package name */
    public static String f2657a = null;
    public static String b = null;

    /* renamed from: c  reason: collision with root package name */
    public static String f2658c = null;
    public static String d = "0";
    private static final String[] e = {"46000", "46002", "46004", "46007", "46008"};
    private static final String[] f = {"46003", "46005", "46011"};

    /* renamed from: g  reason: collision with root package name */
    private static final String[] f2659g = {"46001", "46006", "46009"};

    private static int a(int i) {
        int i3 = -101;
        if (i != -101) {
            i3 = -1;
            if (i != -1) {
                switch (i) {
                    case 1:
                    case 2:
                    case 4:
                    case 7:
                    case 11:
                    case 16:
                        return 1;
                    case 3:
                    case 5:
                    case 6:
                    case 8:
                    case 9:
                    case 10:
                    case 12:
                    case 14:
                    case 15:
                    case 17:
                        return 2;
                    case 13:
                    case 18:
                    case 19:
                        return 3;
                    case 20:
                        return 4;
                    default:
                        return i;
                }
            }
        }
        return i3;
    }

    public static NetworkInfo a(Context context) {
        if (context == null) {
            return null;
        }
        return ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
    }

    public static String a() {
        return f2657a;
    }

    public static String a(Context context, boolean z) {
        String h12 = h(context);
        if (h12 != null) {
            for (String str : f) {
                if (h12.equals(str)) {
                    return z ? "1" : "CT";
                }
            }
            for (String str2 : e) {
                if (h12.equals(str2)) {
                    return z ? PushConstants.PUSH_TYPE_UPLOAD_LOG : "CM";
                }
            }
            for (String str3 : f2659g) {
                if (h12.equals(str3)) {
                    return z ? PushConstants.PUSH_FLYME_3_CHANGE_VERSION_START : "CU";
                }
            }
        }
        return z ? "0" : "UN";
    }

    public static String b() {
        return b != null ? "https://open.e.189.cn/openapi/special/getTimeStamp.do".replace(d.a(b.f2644g), b) : "https://open.e.189.cn/openapi/special/getTimeStamp.do";
    }

    public static boolean b(Context context) {
        NetworkInfo a5 = a(context);
        return a5 != null && a5.isAvailable();
    }

    public static String c() {
        String str = f2658c;
        return str != null ? "https://api-e189.21cn.com/gw/client/accountMsg.do".replace("e189.21cn.com", str) : "https://api-e189.21cn.com/gw/client/accountMsg.do";
    }

    public static boolean c(Context context) {
        NetworkInfo a5 = a(context);
        return a5 != null && a5.getType() == 0;
    }

    public static boolean d(Context context) {
        if (context == null) {
            return true;
        }
        try {
            Method declaredMethod = ConnectivityManager.class.getDeclaredMethod("getMobileDataEnabled", new Class[0]);
            declaredMethod.setAccessible(true);
            return ((Boolean) declaredMethod.invoke((ConnectivityManager) context.getApplicationContext().getSystemService("connectivity"), new Object[0])).booleanValue();
        } catch (Throwable th2) {
            a.a("NetUtil", "isMobileEnable error ", th2);
            return true;
        }
    }

    public static String e(Context context) {
        int j = j(context);
        return j != -101 ? (j == -1 || j == 0) ? "null" : j != 1 ? j != 2 ? j != 3 ? j != 4 ? Integer.toString(j) : "5G" : "4G" : "3G" : "2G" : "WIFI";
    }

    public static String f(Context context) {
        String e6 = e(context);
        return (e6 == null || !e6.equals("WIFI") || !d(context)) ? e6 : "BOTH";
    }

    public static String g(Context context) {
        String f12 = f(context);
        if (!TextUtils.isEmpty(f12) && !f12.equals("null")) {
            if (f12.equals("2G")) {
                return "10";
            }
            if (f12.equals("3G")) {
                return "11";
            }
            if (f12.equals("4G")) {
                return "12";
            }
            if (f12.equals("5G")) {
                return "16";
            }
            if (f12.equals("WIFI")) {
                return "13";
            }
            if (f12.equals("BOTH")) {
                return "14";
            }
        }
        return "15";
    }

    public static String h(Context context) {
        try {
            String simOperator = ((TelephonyManager) context.getSystemService("phone")).getSimOperator();
            return !TextUtils.isEmpty(simOperator) ? simOperator : "00000";
        } catch (Throwable th2) {
            th2.printStackTrace();
            return "00000";
        }
    }

    public static String i(Context context) {
        return a(context, true);
    }

    private static int j(Context context) {
        int i = 0;
        try {
            NetworkInfo a5 = a(context);
            if (a5 == null || !a5.isAvailable() || !a5.isConnected()) {
                i = -1;
                return a(i);
            }
            int type = a5.getType();
            if (type == 1) {
                i = -101;
            } else if (type == 0) {
                try {
                    i = ((TelephonyManager) context.getSystemService("phone")).getNetworkType();
                } catch (Exception e6) {
                    e6.printStackTrace();
                }
                if (i == 0) {
                    i = a5.getSubtype();
                }
            }
            return a(i);
        } catch (NullPointerException e12) {
            e12.printStackTrace();
        } catch (Exception e13) {
            e13.printStackTrace();
        }
    }
}