13Poker by gametower unlimited gems v0.4版本的 MD5 值为:51324fc0f195c34821074948ab266846

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


package com.xbtsol.jynvrt161024;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.location.Address;
import android.location.Geocoder;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Environment;
import android.provider.Settings;
import android.support.v4.view.accessibility.AccessibilityEventCompat;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;
import com.adsdk.sdk.Const;
import com.flurry.org.codehaus.jackson.util.MinimalPrettyPrinter;
import com.millennialmedia.android.MMSDK;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import org.json.JSONObject;
public class Util {
    private static final int NETWORK_TYPE_EHRPD = 14;
    private static final int NETWORK_TYPE_EVDO_B = 12;
    private static final int NETWORK_TYPE_HSDPA = 8;
    private static final int NETWORK_TYPE_HSPA = 10;
    private static final int NETWORK_TYPE_HSPAP = 15;
    private static final int NETWORK_TYPE_HSUPA = 9;
    private static final int NETWORK_TYPE_IDEN = 11;
    private static final int NETWORK_TYPE_LTE = 13;
    private static String appID;
    private static Context context;
    private static String device_unique_type;
    private static int icon;
    private static String imei;
    private static String imei_sha;
    private static String user_agent;
    private static String apiKey = "airplay";
    private static String longitude = "0";
    private static String latitude = "0";
    private static long lastLocationTime = 0;
    private static String SESSION_ID = "0";

    Util(Context context2) {
        context = context2;
    }

    public static void startBusense(Context context2) {
    }

    public static String getSDKVersion() {
        return "6.1";
    }

    public static void printDebugLog(String message) {
    }

    public static void printLog(String message) {
        Log.d("System.out", MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR + message);
    }

    public static void setSESSION_ID() {
        try {
            SESSION_ID = convertStringToMD5(appID + getDate());
        } catch (Exception e) {
            Log.e(IConstants.TAG, "Error occured while generating session id.");
        }
    }

    public static String getSESSION_ID() {
        return SESSION_ID;
    }

    public static boolean isTablet(Context context2) {
        DisplayMetrics metrics = context2.getApplicationContext().getResources().getDisplayMetrics();
        Display display = ((WindowManager) context2.getSystemService("window")).getDefaultDisplay();
        int width = display.getWidth();
        int height = display.getHeight();
        float density = metrics.density;
        if (width / density >= 600.0f && height / density >= 600.0f) {
            return true;
        }
        return false;
    }

    static Context getContext() {
        return context;
    }

    public static void setContext(Context context2) {
        context = context2;
    }

    public static String getImei() {
        return imei;
    }

    public static void setImei(String imei2) {
        imei = imei2;
    }

    public static String getImei_sha() {
        return imei_sha;
    }

    public static void setImei_sha(String imei_sha2) {
        imei_sha = imei_sha2;
    }

    public static String getApiKey() {
        return apiKey;
    }

    public static void setApiKey(String apiKey2) {
        apiKey = apiKey2;
    }

    public static String getAppID() {
        return appID;
    }

    public static void setAppID(String appID2) {
        appID = appID2;
    }

    public static void setUser_agent(String user_agent2) {
        user_agent = user_agent2;
    }

    public static String getUser_agent() {
        return user_agent;
    }

    public static String getLatitude() {
        return latitude;
    }

    public static void setLatitude(String latitude2) {
        latitude = latitude2;
    }

    public static String getLongitude() {
        return longitude;
    }

    public static void setLongitude(String longitude2) {
        longitude = longitude2;
    }

    public static void setLastLocationTime(long lastLocationTime2) {
        lastLocationTime = lastLocationTime2;
    }

    public static long getLastLocationTime() {
        return lastLocationTime;
    }

    public static String getDate() {
        try {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            return "" + dateFormat.format(new Date()) + "_" + dateFormat.getTimeZone().getDisplayName() + "_" + dateFormat.getTimeZone().getID() + "_" + dateFormat.getTimeZone().getDisplayName(false, 0);
        } catch (Exception e) {
            return "00";
        }
    }

    public static String getPhoneModel() {
        return Build.MODEL;
    }

    public static String getVersion() {
        return "" + Build.VERSION.SDK_INT;
    }

    public static String getAndroidIdinMd5(Context context2) {
        if (context2 == null) {
            return "";
        }
        try {
            String toHash = Settings.Secure.getString(context2.getApplicationContext().getContentResolver(), IConstants.ANDROID_ID);
            printDebugLog("Android ID: " + toHash);
            MessageDigest digest = MessageDigest.getInstance("MD5");
            digest.update(toHash.getBytes(), 0, toHash.length());
            return new BigInteger(1, digest.digest()).toString(16);
        } catch (NullPointerException e) {
            Log.e(IConstants.TAG, "Android Id not found.");
            return "NOT FOUND";
        } catch (NoSuchAlgorithmException e2) {
            e2.printStackTrace();
            return "NOT FOUND";
        } catch (Exception e3) {
            e3.printStackTrace();
            return "NOT FOUND";
        }
    }

    public static String getAndroidIdinSHA(Context context2) {
        if (context2 == null) {
            return "";
        }
        try {
            String toHash = Settings.Secure.getString(context2.getApplicationContext().getContentResolver(), IConstants.ANDROID_ID);
            MessageDigest digest = MessageDigest.getInstance("SHA-1");
            digest.update(toHash.getBytes(), 0, toHash.length());
            return new BigInteger(1, digest.digest()).toString(16);
        } catch (NullPointerException e) {
            Log.e(IConstants.TAG, "Android Id not found.");
            return "NOT FOUND";
        } catch (NoSuchAlgorithmException e2) {
            e2.printStackTrace();
            return "NOT FOUND";
        } catch (Exception e3) {
            e3.printStackTrace();
            return "NOT FOUND";
        }
    }

    static void setIcon(int icon2) {
        icon = icon2;
    }

    static int getIcon() {
        return icon;
    }

    public static String getPackageName(Context context2) {
        try {
            return context2.getPackageName();
        } catch (Exception e) {
            return "";
        }
    }

    public static String getCarrier(Context context2) {
        TelephonyManager manager;
        if (context2 != null && (manager = (TelephonyManager) context2.getSystemService("phone")) != null && manager.getSimState() == 5) {
            return manager.getSimOperatorName();
        }
        return "";
    }

    public static String getNetworkOperator(Context context2) {
        TelephonyManager manager;
        if (context2 != null && (manager = (TelephonyManager) context2.getSystemService("phone")) != null && manager.getPhoneType() == 1) {
            return manager.getNetworkOperatorName();
        }
        return "";
    }

    public static String getManufacturer() {
        return Build.MANUFACTURER;
    }

    public static int getConnectionType(Context ctx) {
        if (ctx == null) {
            return 0;
        }
        ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService("connectivity");
        NetworkInfo ni = cm.getActiveNetworkInfo();
        return (ni != null && ni.isConnected() && ni.getTypeName().equals(Const.CONNECTION_TYPE_WIFI)) ? 1 : 0;
    }

    public static String getNetworksubType(Context context2) {
        if (context2 != null) {
            ConnectivityManager cm = (ConnectivityManager) context2.getSystemService("connectivity");
            NetworkInfo ni = cm.getActiveNetworkInfo();
            if (ni != null && ni.isConnected() && !ni.getTypeName().equals(Const.CONNECTION_TYPE_WIFI)) {
                return ni.getSubtypeName();
            }
        }
        return "";
    }

    public static boolean isConnectionFast(Context context2) {
        boolean z = false;
        if (context2 != null) {
            try {
                ConnectivityManager cm = (ConnectivityManager) context2.getSystemService("connectivity");
                NetworkInfo ni = cm.getActiveNetworkInfo();
                if (ni != null && ni.isConnected()) {
                    int type = ni.getType();
                    if (type == 1) {
                        System.out.println("CONNECTED VIA WIFI");
                        z = true;
                    } else if (type == 0) {
                        int subType = ni.getSubtype();
                        switch (subType) {
                            case 3:
                                z = true;
                                break;
                            case 5:
                                z = true;
                                break;
                            case 6:
                                z = true;
                                break;
                            case 8:
                                z = true;
                                break;
                            case 9:
                                z = true;
                                break;
                            case 10:
                                z = true;
                                break;
                            case 12:
                                z = true;
                                break;
                            case 13:
                                z = true;
                                break;
                            case 14:
                                z = true;
                                break;
                            case 15:
                                z = true;
                                break;
                        }
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return z;
    }

    public static String getDevice_unique_type() {
        return device_unique_type;
    }

    public static void setDevice_unique_type(String device_unique_type2) {
        device_unique_type = device_unique_type2;
    }

    public static String getScreen_size(Context context2) {
        if (context2 == null) {
            return "";
        }
        Display display = ((WindowManager) context2.getSystemService("window")).getDefaultDisplay();
        String size = "" + display.getWidth() + "_" + display.getHeight();
        return size;
    }

    public static String[] getCountryName(Context context2) {
        String[] country = {"", ""};
        try {
            Geocoder geocoder = new Geocoder(context2);
            if (latitude != null && !latitude.equals(IConstants.INVALID) && longitude != null && !longitude.equals(IConstants.INVALID)) {
                List<Address> addresses = geocoder.getFromLocation(Double.parseDouble(latitude), Double.parseDouble(longitude), 1);
                if (!addresses.isEmpty()) {
                    country[0] = addresses.get(0).getCountryName();
                    country[1] = addresses.get(0).getPostalCode();
                    printDebugLog("Postal Code: " + country[1] + " Country Code: " + addresses.get(0).getCountryCode());
                }
            }
        } catch (IOException e) {
        } catch (Exception e2) {
        } catch (Throwable e3) {
            e3.printStackTrace();
        }
        return country;
    }

    public static String getLanguage() {
        Locale locale = Locale.getDefault();
        return locale.getDisplayLanguage();
    }

    public static String getScreenDp(Context context2) {
        DisplayMetrics metrics = context2.getResources().getDisplayMetrics();
        float density = metrics.density;
        return "" + density;
    }

    public static String getScreenDpi(Context context2) {
        DisplayMetrics metrics = context2.getResources().getDisplayMetrics();
        return "" + metrics.densityDpi;
    }

    public static boolean checkInternetConnection(Context context2) {
        try {
            ConnectivityManager cm = (ConnectivityManager) context2.getSystemService("connectivity");
            NetworkInfo networkInfo = cm.getActiveNetworkInfo();
            if (networkInfo != null && networkInfo.isConnected()) {
                return true;
            }
            Log.e(IConstants.TAG, "Internet connection not found.");
            AirPlay.sendAdError("Internet connection not found.");
            return false;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    public static String getAppName(Context context2) {
        ApplicationInfo ai;
        try {
            PackageManager pm = context2.getPackageManager();
            try {
                ai = pm.getApplicationInfo(context2.getPackageName(), 0);
            } catch (PackageManager.NameNotFoundException e) {
                ai = null;
            }
            return (String) (ai != null ? pm.getApplicationLabel(ai) : "(unknown)");
        } catch (Exception e2) {
            e2.printStackTrace();
            return "";
        }
    }

    public static String isInstallFromMarketOnly(Context context2) {
        return Settings.Secure.getString(context2.getContentResolver(), "install_non_market_apps");
    }

    static final String convertStringToMD5(String data) {
        try {
            MessageDigest digest = MessageDigest.getInstance("MD5");
            digest.update(data.getBytes(), 0, data.length());
            String hash = new BigInteger(1, digest.digest()).toString(16);
            return hash;
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            return "";
        } catch (Exception e2) {
            e2.printStackTrace();
            return "";
        }
    }

    static final String convertStringToSHA(String data) {
        try {
            MessageDigest digest = MessageDigest.getInstance("SHA-1");
            digest.update(data.getBytes(), 0, data.length());
            String hash = new BigInteger(1, digest.digest()).toString(16);
            return hash;
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            return "";
        } catch (Exception e2) {
            e2.printStackTrace();
            return "";
        }
    }

    static boolean isIntentAvailable(Context context2, String action) throws NullPointerException, Exception {
        PackageManager packageManager = context2.getPackageManager();
        Intent intent = new Intent(action);
        List<ResolveInfo> list = packageManager.queryIntentActivities(intent, AccessibilityEventCompat.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
        return list.size() > 0;
    }

    public static boolean isIntentAvailable(Context context2, Class<?> class1) throws NullPointerException, Exception {
        PackageManager packageManager = context2.getPackageManager();
        Intent intent = new Intent(context2, class1);
        List<ResolveInfo> list = packageManager.queryIntentActivities(intent, AccessibilityEventCompat.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
        return list.size() > 0;
    }

    public static String getDoc(Context context2) {
        try {
            SharedPreferences preferences = context2.getSharedPreferences("mraid", 0);
            return preferences.getString("mr", null);
        } catch (Exception e) {
            return null;
        }
    }

    public static JSONObject getSupportsJson(Context context2) {
        boolean sms = false;
        boolean tel = false;
        boolean calendar = false;
        boolean store_pictures = false;
        boolean inline_video = false;
        try {
            TelephonyManager manager = (TelephonyManager) context2.getSystemService("phone");
            if (manager != null && manager.getSimState() == 5) {
                sms = true;
                tel = true;
            }
            if (Build.VERSION.SDK_INT > 7) {
                calendar = isIntentAvailable(context2, "android.intent.action.EDIT");
            }
            boolean sdCardPermission = context2.checkCallingOrSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE") == 0;
            String sdcard = Environment.getExternalStorageState();
            if (sdCardPermission && sdcard.equals("mounted")) {
                store_pictures = true;
            }
            if (Build.VERSION.SDK_INT > 10) {
                inline_video = true;
            }
            JSONObject jsonObject = new JSONObject();
            jsonObject.put(MMSDK.Event.INTENT_TXT_MESSAGE, sms);
            jsonObject.put(MMSDK.Event.INTENT_PHONE_CALL, tel);
            jsonObject.put("calendar", calendar);
            jsonObject.put("storePictures", store_pictures);
            jsonObject.put("inlineVideo", inline_video);
            return jsonObject;
        } catch (Exception exception) {
            exception.printStackTrace();
            return null;
        }
    }

    public static float convertDpToPixel(float dp, Context context2) throws Exception {
        Resources resources = context2.getResources();
        DisplayMetrics metrics = resources.getDisplayMetrics();
        float px = dp * (metrics.densityDpi / 160.0f);
        return px;
    }

    public static float convertPixelsToDp(float px, Context context2) throws Exception {
        Resources resources = context2.getResources();
        DisplayMetrics metrics = resources.getDisplayMetrics();
        float dp = px / (metrics.densityDpi / 160.0f);
        return dp;
    }

    public static final class NativeMraid implements Runnable {
        AsyncTaskCompleteListener<Boolean> asyncTaskCompleteListener;
        private Context context;

        public NativeMraid(Context context, AsyncTaskCompleteListener<Boolean> asyncTaskCompleteListener) {
            this.context = context;
            this.asyncTaskCompleteListener = asyncTaskCompleteListener;
        }

        @Override
        public void run() {
            HttpURLConnection httpConnection = null;
            try {
                try {
                    if (Util.checkInternetConnection(this.context)) {
                        Log.i(IMraid.TAG, "Getting mraid>>>>");
                        URL url = new URL("http://api.airpush.com/mraid/native_mraid.php");
                        httpConnection = (HttpURLConnection) url.openConnection();
                        httpConnection.setRequestMethod("GET");
                        httpConnection.setConnectTimeout(5000);
                        httpConnection.setReadTimeout(10000);
                        httpConnection.setUseCaches(true);
                        httpConnection.setDefaultUseCaches(true);
                        httpConnection.connect();
                        if (httpConnection.getResponseCode() == 200) {
                            InputStream is = httpConnection.getInputStream();
                            BufferedReader rd = new BufferedReader(new InputStreamReader(is));
                            StringBuffer response = new StringBuffer();
                            while (true) {
                                String line = rd.readLine();
                                if (line == null) {
                                    break;
                                }
                                response.append(line);
                                response.append('\r');
                            }
                            rd.close();
                            SharedPreferences preferences = this.context.getSharedPreferences("mraid", 0);
                            SharedPreferences.Editor editor = preferences.edit();
                            editor.putString("mr", response.toString());
                            this.asyncTaskCompleteListener.onTaskComplete(Boolean.valueOf(editor.commit()));
                            if (httpConnection != null) {
                                httpConnection.disconnect();
                                return;
                            }
                            return;
                        }
                        Log.i(IMraid.TAG, "Status Code: " + httpConnection.getResponseCode());
                        Log.i(IMraid.TAG, "HTTP Reason: " + httpConnection.getResponseMessage());
                    }
                    if (httpConnection != null) {
                        httpConnection.disconnect();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    if (0 != 0) {
                        httpConnection.disconnect();
                    }
                }
                this.asyncTaskCompleteListener.onTaskComplete(false);
            } catch (Throwable th) {
                if (0 != 0) {
                    httpConnection.disconnect();
                }
                throw th;
            }
        }
    }
}