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


package com.czhj.devicehelper;

import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import com.czhj.devicehelper.oaId.helpers.DevicesIDsHelper;
import com.czhj.sdk.logger.SigmobLog;

public final class DeviceHelper {
    private static final String a = "getSimState";
    private static final String b = "getImei";
    private static final String c = "getLine1Number";
    private static String d = null;
    private static String e = null;
    private static String f = null;
    private static String g = "";
    private static Handler h = null;
    private static Handler i = null;
    private static int j = 0;
    private static boolean k = false;
    private static String l;
    private static String m;
    private static String n;
    private static Thread o;
    private static Thread p;
    private static boolean q;
    private static int r;

    public static String getIMEI(Context context) {
        String str;
        try {
            SigmobLog.d("private :getIMEI");
            TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
            if (telephonyManager == null) {
                return null;
            }
            if (Build.VERSION.SDK_INT >= 26) {
                str = telephonyManager.getImei();
                if (TextUtils.isEmpty(str)) {
                    try {
                        return telephonyManager.getDeviceId();
                    } catch (Throwable unused) {
                        return telephonyManager.getMeid();
                    }
                }
            } else {
                str = telephonyManager.getDeviceId();
            }
            if (str != null) {
                return str;
            }
            return null;
        } catch (Exception unused2) {
        }
    }

    public static String getIMEI(Context context, int i2) {
        String str;
        try {
            SigmobLog.d("private :getIMEI " + i2);
            TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
            if (telephonyManager == null) {
                return null;
            }
            if (Build.VERSION.SDK_INT >= 26) {
                str = telephonyManager.getImei(i2);
                if (TextUtils.isEmpty(str)) {
                    try {
                        return telephonyManager.getDeviceId(i2);
                    } catch (Throwable unused) {
                        return telephonyManager.getMeid(i2);
                    }
                }
            } else {
                str = telephonyManager.getDeviceId();
            }
            if (str != null) {
                return str;
            }
            return null;
        } catch (Exception unused2) {
        }
    }

    public static String getIMSI(Context context) {
        return null;
    }

    public static String getMacAddress() {
        return "";
    }

    public static void getOAID(final Context context, final DevicesIDsHelper.AppIdsUpdater appIdsUpdater) {
        if (TextUtils.isEmpty(d)) {
            if (r > 10 || q) {
                if (appIdsUpdater != null) {
                    appIdsUpdater.OnIdsAvalid("");
                }
            } else if (p == null) {
                Thread thread = new Thread(new Runnable() {
                    /* class com.czhj.devicehelper.DeviceHelper.AnonymousClass2 */

                    public void run() {
                        DevicesIDsHelper.b(context, new DevicesIDsHelper.AppIdsUpdater() {
                            /* class com.czhj.devicehelper.DeviceHelper.AnonymousClass2.AnonymousClass1 */

                            @Override // com.czhj.devicehelper.oaId.helpers.DevicesIDsHelper.AppIdsUpdater
                            public void OnIdsAvalid(String str) {
                                if (!TextUtils.isEmpty(str)) {
                                    String unused = DeviceHelper.d = str;
                                    if (appIdsUpdater != null) {
                                        appIdsUpdater.OnIdsAvalid(str);
                                    }
                                }
                                boolean unused2 = DeviceHelper.q = false;
                                if (DeviceHelper.h != null) {
                                    Handler unused3 = DeviceHelper.h = null;
                                }
                            }
                        });
                    }
                });
                p = thread;
                thread.start();
                r++;
                q = true;
            }
        } else if (appIdsUpdater != null) {
            appIdsUpdater.OnIdsAvalid(e);
        }
    }

    public static void getOAID_API(final Context context, final DevicesIDsHelper.AppIdsUpdater appIdsUpdater) {
        if (TextUtils.isEmpty(g)) {
            if (j <= 10 && !k) {
                if (o == null) {
                    Thread thread = new Thread(new Runnable() {
                        /* class com.czhj.devicehelper.DeviceHelper.AnonymousClass1 */

                        public void run() {
                            try {
                                new DevicesIDsHelper().a(context, new DevicesIDsHelper.AppIdsUpdater() {
                                    /* class com.czhj.devicehelper.DeviceHelper.AnonymousClass1.AnonymousClass1 */

                                    @Override // com.czhj.devicehelper.oaId.helpers.DevicesIDsHelper.AppIdsUpdater
                                    public void OnIdsAvalid(String str) {
                                        boolean unused = DeviceHelper.k = false;
                                        if (!TextUtils.isEmpty(str)) {
                                            String unused2 = DeviceHelper.g = str;
                                            if (appIdsUpdater != null) {
                                                appIdsUpdater.OnIdsAvalid(DeviceHelper.g);
                                            }
                                        }
                                        Log.d("oaid", "oaid_src: " + str);
                                        Thread unused3 = DeviceHelper.o = null;
                                    }
                                });
                            } catch (Exception e) {
                                SigmobLog.e(e.getMessage());
                            }
                        }
                    });
                    o = thread;
                    thread.start();
                }
                j++;
                k = true;
            } else if (appIdsUpdater != null) {
                appIdsUpdater.OnIdsAvalid("");
            }
        } else if (appIdsUpdater != null) {
            appIdsUpdater.OnIdsAvalid(g);
        }
    }

    public static String getVAID() {
        return f;
    }

    public static String getWifiName(Context context) {
        return l;
    }

    public static String getWifimac(Context context) {
        return "";
    }
}