鸠摩搜书官方正版 v1.7版本的 MD5 值为:01c9a20d2c415de3233d7f691829edf5

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


package com.admogo.util;

import android.app.Activity;
import android.content.Context;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Locale;
import java.util.regex.Pattern;

public class AdMogoUtil {
    public static final int CUSTOM_TYPE_BANNER = 1;
    public static final int CUSTOM_TYPE_FULL = 3;
    public static final int CUSTOM_TYPE_GIF = 7;
    public static final int CUSTOM_TYPE_HTML = 6;
    public static final int CUSTOM_TYPE_ICON = 2;
    public static final String FRSCTSL_URL = "http://www.admarket.mobi/ftad/apiadreq";
    public static final int MOGO_TYPE_BANNER = 1;
    public static final int MOGO_TYPE_ICON = 2;
    public static final int NETWORK_TYPE_4THSCREEN = 13;
    public static final int NETWORK_TYPE_ADCHINA = 21;
    public static final int NETWORK_TYPE_ADMOB = 1;
    public static final int NETWORK_TYPE_ADMOGO = 10;
    public static final int NETWORK_TYPE_ADSENSE = 14;
    public static final int NETWORK_TYPE_ADTOUCH = 28;
    public static final int NETWORK_TYPE_ADWO = 33;
    public static final int NETWORK_TYPE_AIRAD = 32;
    public static final int NETWORK_TYPE_APPMEDIA = 36;
    public static final int NETWORK_TYPE_BAIDU = 44;
    public static final int NETWORK_TYPE_CASEE = 25;
    public static final int NETWORK_TYPE_CUSTOM = 9;
    public static final int NETWORK_TYPE_DOMOB = 29;
    public static final int NETWORK_TYPE_DOUBLECLICK = 15;
    public static final int NETWORK_TYPE_EVENT = 17;
    public static final int NETWORK_TYPE_EXCHANGE = 45;
    public static final int NETWORK_TYPE_FRACTAL = 50;
    public static final int NETWORK_TYPE_GENERIC = 16;
    public static final int NETWORK_TYPE_GREYSTRIP = 7;
    public static final int NETWORK_TYPE_INMOBI = 18;
    public static final int NETWORK_TYPE_IZP = 40;
    public static final int NETWORK_TYPE_JUMPTAP = 2;
    public static final int NETWORK_TYPE_LIVERAIL = 5;
    public static final int NETWORK_TYPE_LMMOB = 46;
    public static final int NETWORK_TYPE_LSENSE = 34;
    public static final int NETWORK_TYPE_MDOTM = 12;
    public static final int NETWORK_TYPE_MEDIALETS = 4;
    public static final int NETWORK_TYPE_MILLENNIAL = 6;
    public static final int NETWORK_TYPE_MOBCLIX = 11;
    public static final int NETWORK_TYPE_MOBISAGE = 31;
    public static final int NETWORK_TYPE_MOBWIN = 53;
    public static final int NETWORK_TYPE_MOGO = 27;
    public static final int NETWORK_TYPE_PREMIUMAD = 48;
    public static final int NETWORK_TYPE_QUATTRO = 8;
    public static final int NETWORK_TYPE_RECOMMENDAD = 54;
    public static final int NETWORK_TYPE_SMAATO = 35;
    public static final int NETWORK_TYPE_SMART = 26;
    public static final int NETWORK_TYPE_SUIZONG = 51;
    public static final int NETWORK_TYPE_VIDEOEGG = 3;
    public static final int NETWORK_TYPE_VPON = 30;
    public static final int NETWORK_TYPE_WEIQIAN = 56;
    public static final int NETWORK_TYPE_WINAD = 37;
    public static final int NETWORK_TYPE_WINSMEDIA = 52;
    public static final int NETWORK_TYPE_WIYUN = 22;
    public static final int NETWORK_TYPE_WOOBOO = 23;
    public static final int NETWORK_TYPE_YOUMI = 24;
    public static final int NETWORK_TYPE_ZESTADZ = 20;
    public static final int NETWORK_TYPE_ZHIDIAN = 47;
    public static final String VER = "1.2.0";
    public static final int VERSION = 293;
    public static final String downloadDir = "MOGO/download/";
    public static final String partnerID = "mogo001";
    public static final String urlCaseeAD = "http://wap.casee.cn/mo/Mogo.ad";
    public static final String urlInmobiAD = "http://w.inmobi.com/showad.asm";
    public static final String urlWinsAD = "http://api.winsmedia.net/webviewAdReq";
    public static final String urlWinsADClick = "http://api.winsmedia.net/webviewAdClick";
    public static final String winsVersion = "1.3";
    public static String ADMOGO = "AdsMOGO SDK";
    public static String urlConfig = "http://cfg.adsmogo.com/getinfo.ashx?appid=%s&appver=%d&adtype=%s&client=2&country=%s";
    public static String urlAudiance = "http://cfg.adsmogo.com/Audiance.ashx?aid=%s&uid=%s&vr=%s&pn=%s&uv=%s&uc=%s&nt=%s&mn=%s&os=%s&dn=%s&si=%s%s&ra=%s&cn=%s&lc=%s&ll=%s";
    public static String urlUpdate = "http://cfg.adsmogo.com/AppVersion.ashx?appid=%s";
    public static String urlCustom = "http://cus.adsmogo.com/custom.ashx?appid=%s&nid=%s&uuid=%s&client=2&country=%s&adtype=%s&appver=293";
    public static String urlExchange = "http://cus.adsmogo.com/Exchange.ashx?appid=%s&adtype=%s&country=%s&client=2&uuid=%s&network=%s&appver=293";
    public static String urlMogo = "http://cus.adsmogo.com/MogoAD.ashx?appid=%s&nid=%s&adtype=%s&country=%s&client=2&uuid=%s&network=%s&bf=%d&ver=293";
    public static String urlPremium = "http://cus.adsmogo.com/Premium.ashx?appid=%s&nid=%s&uuid=%s&client=2&adtype=%s&country=%s&nt=%s&appver=293";
    public static String urlRecommend = "http://cus.adsmogo.com/Recommend.ashx?appid=%s&nid=%s&uuid=%s&client=2&adtype=%s&country=%s&nt=%s&appver=293";
    public static String urlRecordData = "http://cfg.adsmogo.com/batch.ashx";
    public static String urlImpression = "http://imp.adsmogo.com/exmet.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
    public static String urlClick = "http://clk.adsmogo.com/exclick.ashx?appid=%s&appver=%d&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s%s";
    public static String urlRequest = "http://req.adsmogo.com/exrequest.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
    public static String urlNull = "http://blk.adsmogo.com/blank.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
    public static String urlAction = "http://cus.adsmogo.com/Action.ashx?aid=%s&cid=%s&uid=%s&cn=%s&at=%s&t=%s&ct=%s";
    public static String urlGetIp = "http://cfg.adsmogo.com/GetIP.ashx";
    public static double density = -1.0d;

    public static void changeURL(int i, int i2) {
        switch (i) {
            case 0:
                ADMOGO = "AdsMOGO SDK";
                switch (i2) {
                    case 0:
                        urlConfig = "http://cfg.adsmogo.com/getinfo.ashx?appid=%s&appver=%d&adtype=%s&client=2&country=%s";
                        urlAudiance = "http://cfg.adsmogo.com/Audiance.ashx?aid=%s&uid=%s&vr=%s&pn=%s&uv=%s&uc=%s&nt=%s&mn=%s&os=%s&dn=%s&si=%s%s&ra=%s&cn=%s&lc=%s&ll=%s";
                        urlUpdate = "http://cfg.adsmogo.com/AppVersion.ashx?appid=%s";
                        urlCustom = "http://cus.adsmogo.com/custom.ashx?appid=%s&nid=%s&uuid=%s&client=2&country=%s&adtype=%s&appver=293";
                        urlExchange = "http://cus.adsmogo.com/Exchange.ashx?appid=%s&adtype=%s&country=%s&client=2&uuid=%s&network=%s&appver=293";
                        urlMogo = "http://cus.adsmogo.com/MogoAD.ashx?appid=%s&nid=%s&adtype=%s&country=%s&client=2&uuid=%s&network=%s&bf=%d&ver=293";
                        urlPremium = "http://cus.adsmogo.com/Premium.ashx?appid=%s&nid=%s&uuid=%s&client=2&adtype=%s&country=%s&nt=%s&appver=293";
                        urlRecommend = "http://cus.adsmogo.com/Recommend.ashx?appid=%s&nid=%s&uuid=%s&client=2&adtype=%s&country=%s&nt=%s&appver=293";
                        urlRecordData = "http://cfg.adsmogo.com/batch.ashx";
                        urlImpression = "http://imp.adsmogo.com/exmet.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlClick = "http://clk.adsmogo.com/exclick.ashx?appid=%s&appver=%d&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s%s";
                        urlRequest = "http://req.adsmogo.com/exrequest.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlNull = "http://blk.adsmogo.com/blank.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlAction = "http://cus.adsmogo.com/Action.ashx?aid=%s&cid=%s&uid=%s&cn=%s&at=%s&t=%s&ct=%s";
                        urlGetIp = "http://cfg.adsmogo.com/GetIP.ashx";
                        return;
                    case 1:
                        urlConfig = "http://cfg.adsmogo.org/getinfo.ashx?appid=%s&appver=%d&adtype=%s&client=2&country=%s";
                        urlAudiance = "http://cfg.adsmogo.org/Audiance.ashx?aid=%s&uid=%s&vr=%s&pn=%s&uv=%s&uc=%s&nt=%s&mn=%s&os=%s&dn=%s&si=%s%s&ra=%s&cn=%s&lc=%s&ll=%s";
                        urlUpdate = "http://cfg.adsmogo.org/AppVersion.ashx?appid=%s";
                        urlCustom = "http://cus.adsmogo.org/custom.ashx?appid=%s&nid=%s&uuid=%s&client=2&country=%s&adtype=%s&appver=293";
                        urlExchange = "http://cus.adsmogo.org/Exchange.ashx?appid=%s&adtype=%s&country=%s&client=2&uuid=%s&network=%s&appver=293";
                        urlMogo = "http://cus.adsmogo.org/MogoAD.ashx?appid=%s&nid=%s&adtype=%s&country=%s&client=2&uuid=%s&network=%s&bf=%d&ver=293";
                        urlPremium = "http://cus.adsmogo.org/Premium.ashx?appid=%s&nid=%s&uuid=%s&client=2&adtype=%s&country=%s&nt=%s&appver=293";
                        urlRecommend = "http://cus.adsmogo.org/Recommend.ashx?appid=%s&nid=%s&uuid=%s&client=2&adtype=%s&country=%s&nt=%s&appver=293";
                        urlRecordData = "http://cfg.adsmogo.org/batch.ashx";
                        urlImpression = "http://imp.adsmogo.org/exmet.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlClick = "http://clk.adsmogo.org/exclick.ashx?appid=%s&appver=%d&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s%s";
                        urlRequest = "http://req.adsmogo.org/exrequest.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlNull = "http://blk.adsmogo.org/blank.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlAction = "http://cus.adsmogo.org/Action.ashx?aid=%s&cid=%s&uid=%s&cn=%s&at=%s&t=%s&ct=%s";
                        urlGetIp = "http://cfg.adsmogo.org/GetIP.ashx";
                        return;
                    case 2:
                        urlConfig = "http://cfg.adsmogo.net/getinfo.ashx?appid=%s&appver=%d&adtype=%s&client=2&country=%s";
                        urlAudiance = "http://cfg.adsmogo.net/Audiance.ashx?aid=%s&uid=%s&vr=%s&pn=%s&uv=%s&uc=%s&nt=%s&mn=%s&os=%s&dn=%s&si=%s%s&ra=%s&cn=%s&lc=%s&ll=%s";
                        urlUpdate = "http://cfg.adsmogo.net/AppVersion.ashx?appid=%s";
                        urlCustom = "http://cus.adsmogo.net/custom.ashx?appid=%s&nid=%s&uuid=%s&client=2&country=%s&adtype=%s&appver=293";
                        urlExchange = "http://cus.adsmogo.net/Exchange.ashx?appid=%s&adtype=%s&country=%s&client=2&uuid=%s&network=%s&appver=293";
                        urlMogo = "http://cus.adsmogo.net/MogoAD.ashx?appid=%s&nid=%s&adtype=%s&country=%s&client=2&uuid=%s&network=%s&bf=%d&ver=293";
                        urlPremium = "http://cus.adsmogo.net/Premium.ashx?appid=%s&nid=%s&uuid=%s&client=2&adtype=%s&country=%s&nt=%s&appver=293";
                        urlRecommend = "http://cus.adsmogo.net/Recommend.ashx?appid=%s&nid=%s&uuid=%s&client=2&adtype=%s&country=%s&nt=%s&appver=293";
                        urlRecordData = "http://cfg.adsmogo.net/batch.ashx";
                        urlImpression = "http://imp.adsmogo.net/exmet.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlClick = "http://clk.adsmogo.net/exclick.ashx?appid=%s&appver=%d&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s%s";
                        urlRequest = "http://req.adsmogo.net/exrequest.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlNull = "http://blk.adsmogo.net/blank.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlAction = "http://cus.adsmogo.net/Action.ashx?aid=%s&cid=%s&uid=%s&cn=%s&at=%s&t=%s&ct=%s";
                        urlGetIp = "http://cfg.adsmogo.net/GetIP.ashx";
                        return;
                    case 3:
                        urlConfig = "http://cfg.adsmogo.mobi/getinfo.ashx?appid=%s&appver=%d&adtype=%s&client=2&country=%s";
                        urlAudiance = "http://cfg.adsmogo.mobi/Audiance.ashx?aid=%s&uid=%s&vr=%s&pn=%s&uv=%s&uc=%s&nt=%s&mn=%s&os=%s&dn=%s&si=%s%s&ra=%s&cn=%s&lc=%s&ll=%s";
                        urlUpdate = "http://cfg.adsmogo.mobi/AppVersion.ashx?appid=%s";
                        urlCustom = "http://cus.adsmogo.mobi/custom.ashx?appid=%s&nid=%s&uuid=%s&client=2&country=%s&adtype=%s&appver=293";
                        urlExchange = "http://cus.adsmogo.mobi/Exchange.ashx?appid=%s&adtype=%s&country=%s&client=2&uuid=%s&network=%s&appver=293";
                        urlMogo = "http://cus.adsmogo.mobi/MogoAD.ashx?appid=%s&nid=%s&adtype=%s&country=%s&client=2&uuid=%s&network=%s&bf=%d&ver=293";
                        urlPremium = "http://cus.adsmogo.mobi/Premium.ashx?appid=%s&nid=%s&uuid=%s&client=2&adtype=%s&country=%s&nt=%s&appver=293";
                        urlRecommend = "http://cus.adsmogo.mobi/Recommend.ashx?appid=%s&nid=%s&uuid=%s&client=2&adtype=%s&country=%s&nt=%s&appver=293";
                        urlRecordData = "http://cfg.adsmogo.mobi/batch.ashx";
                        urlImpression = "http://imp.adsmogo.mobi/exmet.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlClick = "http://clk.adsmogo.mobi/exclick.ashx?appid=%s&appver=%d&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s%s";
                        urlRequest = "http://req.adsmogo.mobi/exrequest.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlNull = "http://blk.adsmogo.mobi/blank.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlAction = "http://cus.adsmogo.mobi/Action.ashx?aid=%s&cid=%s&uid=%s&cn=%s&at=%s&t=%s&ct=%s";
                        urlGetIp = "http://cfg.adsmogo.mobi/GetIP.ashx";
                        return;
                    default:
                        urlConfig = "http://cfg.adsmogo.com/getinfo.ashx?appid=%s&appver=%d&adtype=%s&client=2&country=%s";
                        urlAudiance = "http://cfg.adsmogo.com/Audiance.ashx?aid=%s&uid=%s&vr=%s&pn=%s&uv=%s&uc=%s&nt=%s&mn=%s&os=%s&dn=%s&si=%s%s&ra=%s&cn=%s&lc=%s&ll=%s";
                        urlUpdate = "http://cfg.adsmogo.com/AppVersion.ashx?appid=%s";
                        urlCustom = "http://cus.adsmogo.com/custom.ashx?appid=%s&nid=%s&uuid=%s&client=2&country=%s&adtype=%s&appver=293";
                        urlExchange = "http://cus.adsmogo.com/Exchange.ashx?appid=%s&adtype=%s&country=%s&client=2&uuid=%s&network=%s&appver=293";
                        urlMogo = "http://cus.adsmogo.com/MogoAD.ashx?appid=%s&nid=%s&adtype=%s&country=%s&client=2&uuid=%s&network=%s&bf=%d&ver=293";
                        urlPremium = "http://cus.adsmogo.com/Premium.ashx?appid=%s&nid=%s&uuid=%s&client=2&adtype=%s&country=%s&nt=%s&appver=293";
                        urlRecommend = "http://cus.adsmogo.com/Recommend.ashx?appid=%s&nid=%s&uuid=%s&client=2&adtype=%s&country=%s&nt=%s&appver=293";
                        urlRecordData = "http://cfg.adsmogo.com/batch.ashx";
                        urlImpression = "http://imp.adsmogo.com/exmet.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlClick = "http://clk.adsmogo.com/exclick.ashx?appid=%s&appver=%d&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s%s";
                        urlRequest = "http://req.adsmogo.com/exrequest.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlNull = "http://blk.adsmogo.com/blank.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                        urlAction = "http://cus.adsmogo.com/Action.ashx?aid=%s&cid=%s&uid=%s&cn=%s&at=%s&t=%s&ct=%s";
                        urlGetIp = "http://cfg.adsmogo.com/GetIP.ashx";
                        return;
                }
            case 1:
                ADMOGO = "himogo SDK";
                urlConfig = "http://cfg.himogo.com/getinfo.ashx?appid=%s&appver=%d&adtype=%s&client=2&country=%s";
                urlAudiance = "http://cfg.himogo.com/Audiance.ashx?aid=%s&uid=%s&vr=%s&pn=%s&uv=%s&uc=%s&nt=%s&mn=%s&os=%s&dn=%s&si=%s%s&ra=%s&cn=%s&lc=%s&ll=%s";
                urlUpdate = "http://cfg.himogo.com/AppVersion.ashx?appid=%s";
                urlCustom = "http://cus.himogo.com/custom.ashx?appid=%s&nid=%s&uuid=%s&client=2&country=%s&adtype=%s&appver=293";
                urlExchange = "http://cus.himogo.com/Exchange.ashx?appid=%s&adtype=%s&country=%s&client=2&uuid=%s&network=%s&appver=293";
                urlMogo = "http://cus.himogo.com/MogoAD.ashx?appid=%s&nid=%s&adtype=%s&country=%s&client=2&uuid=%s&network=%s&bf=%d&ver=293";
                urlPremium = "http://cus.himogo.com/Premium.ashx?appid=%s&nid=%s&uuid=%s&client=2&adtype=%s&country=%s&nt=%s&appver=293";
                urlRecommend = "http://cus.himogo.com/Recommend.ashx?appid=%s&nid=%s&uuid=%s&client=2&adtype=%s&country=%s&nt=%s&appver=293";
                urlRecordData = "http://cfg.himogo.com/batch.ashx";
                urlImpression = "http://imp.himogo.com/exmet.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                urlClick = "http://clk.himogo.com/exclick.ashx?appid=%s&appver=%d&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s%s";
                urlRequest = "http://req.himogo.com/exrequest.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                urlNull = "http://blk.himogo.com/blank.ashx?appid=%s&nid=%s&type=%d&uuid=%s&client=2&adtype=%s&bf=%d&country=%s";
                urlAction = "http://cus.himogo.com/Action.ashx?aid=%s&cid=%s&uid=%s&cn=%s&at=%s&t=%s&ct=%s";
                urlGetIp = "http://cfg.himogo.com/GetIP.ashx";
                return;
            default:
                return;
        }
    }

    public static String convertToHex(String str) {
        try {
            if (!TextUtils.isEmpty(str)) {
                if (str.equals("000000000000000")) {
                    return String.valueOf(str) + str + "00";
                }
                byte[] digest = MessageDigest.getInstance("MD5").digest(str.getBytes());
                StringBuffer stringBuffer = new StringBuffer();
                int i = 0;
                while (true) {
                    int i2 = i;
                    if (i2 >= digest.length) {
                        return stringBuffer.toString();
                    }
                    int i3 = digest[i2];
                    if (i3 < 0) {
                        i3 += 256;
                    }
                    if (i3 < 16) {
                        stringBuffer.append("0");
                    }
                    stringBuffer.append(Integer.toHexString(i3));
                    i = i2 + 1;
                }
            }
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return "";
    }

    public static double convertToScreenPixels(double d, double d2) {
        return d2 > 0.0d ? d * d2 : d;
    }

    public static int convertToScreenPixels(int i, double d) {
        return (int) convertToScreenPixels(i, d);
    }

    public static String getCountryCode(Context context) {
        Pattern compile = Pattern.compile("[a-z][a-z]");
        TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
        String deviceId = telephonyManager.getDeviceId();
        if (deviceId == null || deviceId.equals("000000000000000")) {
            String lowerCase = Locale.getDefault().getCountry().toLowerCase();
            if (compile.matcher(lowerCase).matches() && isCountryCode(lowerCase)) {
                return lowerCase;
            }
        } else {
            String lowerCase2 = telephonyManager.getNetworkCountryIso().toLowerCase();
            if (!compile.matcher(lowerCase2).matches()) {
                String lowerCase3 = Locale.getDefault().getCountry().toLowerCase();
                if (compile.matcher(lowerCase3).matches() && isCountryCode(lowerCase3)) {
                    return lowerCase3;
                }
            } else if (isCountryCode(lowerCase2)) {
                return lowerCase2;
            }
        }
        return "cn";
    }

    public static double getDensity(Activity activity) {
        if (density == -1.0d) {
            try {
                if (activity.getPackageManager().getApplicationInfo(activity.getPackageName(), 0).targetSdkVersion < 4) {
                    density = 1.0d;
                } else {
                    activity.getWindowManager().getDefaultDisplay().getMetrics(new DisplayMetrics());
                    density = r0.density;
                }
            } catch (Exception e) {
                Log.e(ADMOGO, "get density error", e);
                density = 1.0d;
            }
        }
        return density;
    }

    public static boolean isCountryCode(String str) {
        HashMap hashMap = new HashMap();
        hashMap.put("AO", true);
        hashMap.put("AF", true);
        hashMap.put("AL", true);
        hashMap.put("DZ", true);
        hashMap.put("AD", true);
        hashMap.put("AI", true);
        hashMap.put("AG", true);
        hashMap.put("AR", true);
        hashMap.put("AM", true);
        hashMap.put("AU", true);
        hashMap.put("AT", true);
        hashMap.put("AZ", true);
        hashMap.put("BS", true);
        hashMap.put("BH", true);
        hashMap.put("BD", true);
        hashMap.put("BB", true);
        hashMap.put("BY", true);
        hashMap.put("BE", true);
        hashMap.put("BZ", true);
        hashMap.put("BJ", true);
        hashMap.put("BM", true);
        hashMap.put("BO", true);
        hashMap.put("BW", true);
        hashMap.put("BR", true);
        hashMap.put("BN", true);
        hashMap.put("BG", true);
        hashMap.put("BF", true);
        hashMap.put("MM", true);
        hashMap.put("BI", true);
        hashMap.put("CM", true);
        hashMap.put("CA", true);
        hashMap.put("CF", true);
        hashMap.put("TD", true);
        hashMap.put("CL", true);
        hashMap.put("CN", true);
        hashMap.put("CO", true);
        hashMap.put("CG", true);
        hashMap.put("CK", true);
        hashMap.put("CR", true);
        hashMap.put("CU", true);
        hashMap.put("CY", true);
        hashMap.put("CZ", true);
        hashMap.put("DK", true);
        hashMap.put("DJ", true);
        hashMap.put("DO", true);
        hashMap.put("EC", true);
        hashMap.put("EG", true);
        hashMap.put("SV", true);
        hashMap.put("EE", true);
        hashMap.put("ET", true);
        hashMap.put("FJ", true);
        hashMap.put("FI", true);
        hashMap.put("FR", true);
        hashMap.put("GF", true);
        hashMap.put("GA", true);
        hashMap.put("GM", true);
        hashMap.put("GE", true);
        hashMap.put("DE", true);
        hashMap.put("GH", true);
        hashMap.put("GI", true);
        hashMap.put("GR", true);
        hashMap.put("GD", true);
        hashMap.put("GU", true);
        hashMap.put("GT", true);
        hashMap.put("GN", true);
        hashMap.put("GY", true);
        hashMap.put("HT", true);
        hashMap.put("HN", true);
        hashMap.put("HK", true);
        hashMap.put("HU", true);
        hashMap.put("IS", true);
        hashMap.put("IN", true);
        hashMap.put("ID", true);
        hashMap.put("IR", true);
        hashMap.put("IQ", true);
        hashMap.put("IE", true);
        hashMap.put("IL", true);
        hashMap.put("IT", true);
        hashMap.put("JM", true);
        hashMap.put("JP", true);
        hashMap.put("JO", true);
        hashMap.put("KH", true);
        hashMap.put("KZ", true);
        hashMap.put("KE", true);
        hashMap.put("KR", true);
        hashMap.put("KW", true);
        hashMap.put("KG", true);
        hashMap.put("LA", true);
        hashMap.put("LV", true);
        hashMap.put("LB", true);
        hashMap.put("LS", true);
        hashMap.put("LR", true);
        hashMap.put("LY", true);
        hashMap.put("LI", true);
        hashMap.put("LT", true);
        hashMap.put("LU", true);
        hashMap.put("MO", true);
        hashMap.put("MG", true);
        hashMap.put("MW", true);
        hashMap.put("MY", true);
        hashMap.put("MV", true);
        hashMap.put("ML", true);
        hashMap.put("MT", true);
        hashMap.put("MU", true);
        hashMap.put("MX", true);
        hashMap.put("MD", true);
        hashMap.put("MC", true);
        hashMap.put("MN", true);
        hashMap.put("MS", true);
        hashMap.put("MA", true);
        hashMap.put("MZ", true);
        hashMap.put("NA", true);
        hashMap.put("NR", true);
        hashMap.put("NP", true);
        hashMap.put("NL", true);
        hashMap.put("NZ", true);
        hashMap.put("NI", true);
        hashMap.put("NE", true);
        hashMap.put("NG", true);
        hashMap.put("KP", true);
        hashMap.put("NO", true);
        hashMap.put("OM", true);
        hashMap.put("PK", true);
        hashMap.put("PA", true);
        hashMap.put("PG", true);
        hashMap.put("PY", true);
        hashMap.put("PE", true);
        hashMap.put("PH", true);
        hashMap.put("PL", true);
        hashMap.put("PF", true);
        hashMap.put("PT", true);
        hashMap.put("PR", true);
        hashMap.put("QA", true);
        hashMap.put("RO", true);
        hashMap.put("RU", true);
        hashMap.put("LC", true);
        hashMap.put("VC", true);
        hashMap.put("SM", true);
        hashMap.put("ST", true);
        hashMap.put("SA", true);
        hashMap.put("SN", true);
        hashMap.put("SC", true);
        hashMap.put("SL", true);
        hashMap.put("SG", true);
        hashMap.put("SK", true);
        hashMap.put("SI", true);
        hashMap.put("SB", true);
        hashMap.put("SO", true);
        hashMap.put("ZA", true);
        hashMap.put("ES", true);
        hashMap.put("LK", true);
        hashMap.put("LC", true);
        hashMap.put("VC", true);
        hashMap.put("SD", true);
        hashMap.put("SR", true);
        hashMap.put("SZ", true);
        hashMap.put("SE", true);
        hashMap.put("CH", true);
        hashMap.put("SY", true);
        hashMap.put("TW", true);
        hashMap.put("TJ", true);
        hashMap.put("TZ", true);
        hashMap.put("TH", true);
        hashMap.put("TG", true);
        hashMap.put("TO", true);
        hashMap.put("TT", true);
        hashMap.put("TN", true);
        hashMap.put("TR", true);
        hashMap.put("TM", true);
        hashMap.put("UG", true);
        hashMap.put("UA", true);
        hashMap.put("AE", true);
        hashMap.put("GB", true);
        hashMap.put("US", true);
        hashMap.put("UY", true);
        hashMap.put("UZ", true);
        hashMap.put("VE", true);
        hashMap.put("VN", true);
        hashMap.put("YE", true);
        hashMap.put("YU", true);
        hashMap.put("ZA", true);
        hashMap.put("ZW", true);
        hashMap.put("ZR", true);
        hashMap.put("ZM", true);
        return hashMap.containsKey(str.toUpperCase());
    }
}