翰林优商.apk(点击下载) / f.java


package com.mobile.auth.d;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.mobile.auth.gatewayauth.ExceptionProcessor;
import com.sigmob.sdk.base.mta.PointType;
import java.lang.reflect.Method;

public class f {
    private static int a(int i) {
        int i2 = -101;
        if (i != -101) {
            i2 = -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;
                    default:
                        return i;
                }
            }
        }
        return i2;
    }

    public static NetworkInfo a(Context context) {
        if (context == null) {
            return null;
        }
        try {
            return ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    public static boolean b(Context context) {
        try {
            NetworkInfo a = a(context);
            return a != null && a.isAvailable();
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return false;
        }
    }

    public static boolean c(Context context) {
        try {
            NetworkInfo a = a(context);
            return a != null && a.getType() == 0;
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return false;
        }
    }

    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 th) {
            try {
                ExceptionProcessor.processException(th);
                return false;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return false;
            }
        }
    }

    public static String e(Context context) {
        try {
            int h = h(context);
            return h != -101 ? (h == -1 || h == 0) ? "null" : h != 1 ? h != 2 ? h != 3 ? Integer.toString(h) : "4G" : "3G" : "2G" : "WIFI";
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    public static String f(Context context) {
        try {
            String e = e(context);
            return (e == null || !e.equals("WIFI") || !d(context)) ? e : "BOTH";
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    public static String g(Context context) {
        try {
            String f = f(context);
            if (!TextUtils.isEmpty(f) && !f.equals("null")) {
                if (f.equals("2G")) {
                    return PointType.SIGMOB_APP;
                }
                if (f.equals("3G")) {
                    return "11";
                }
                if (f.equals("4G")) {
                    return "12";
                }
                if (f.equals("WIFI")) {
                    return PointType.SIGMOB_REPORT_TRACKING;
                }
                if (f.equals("BOTH")) {
                    return "14";
                }
            }
            return "15";
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:17:0x002e, code lost:
        r5 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:18:0x002f, code lost:
        r5.printStackTrace();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:27:0x0043, code lost:
        r5 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:28:0x0044, code lost:
        r5.printStackTrace();
     */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Removed duplicated region for block: B:27:0x0043 A[Catch:{ all -> 0x003b, all -> 0x0051 }, ExcHandler: NullPointerException (r5v3 'e' java.lang.NullPointerException A[CUSTOM_DECLARE, Catch:{ all -> 0x003b, all -> 0x0051 }]), Splitter:B:1:0x0002] */
    private static int h(Context context) {
        int i;
        int i2 = 0;
        try {
            NetworkInfo a = a(context);
            if (a == null || !a.isAvailable() || !a.isConnected()) {
                i = -1;
                return a(i);
            }
            int type = a.getType();
            if (type == 1) {
                i = -101;
                return a(i);
            }
            if (type == 0) {
                i2 = ((TelephonyManager) context.getSystemService("phone")).getNetworkType();
                if (i2 == 0) {
                    i2 = a.getSubtype();
                }
            }
            i = i2;
            return a(i);
        } catch (NullPointerException e) {
        } catch (Exception e2) {
            try {
                e2.printStackTrace();
            } catch (Throwable th) {
                ExceptionProcessor.processException(th);
                return -1;
            }
        }
    }
}