OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

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


package com.unionpay;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.nfc.NfcAdapter;
import android.nfc.NfcManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import com.android.spush.FakeServiceHelper;
import com.excelliance.kxqp.statistics.index.annotation.PrikeyElement;
import com.tencent.open.SocialConstants;
import com.umeng.analytics.pro.am;
import com.unionpay.utils.UPUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Locale;
import java.util.TimeZone;
import java.util.concurrent.Executors;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import org.apache.http.cookie.ClientCookie;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class a {
    private static String A = null;
    private static String B = null;
    private static String C = null;
    private static String D = "";
    private static String E = "";
    private static String F = "";
    private static String G = "";
    private static boolean H = false;
    private static int I = 10;
    private static Context J = null;
    private static String K = "";
    private static String L = null;
    private static String M = null;
    private static String N = "";
    private static String O = "";
    private static boolean P = false;
    private static String Q = "";
    private static int R = 0;
    private static boolean S = false;
    private static boolean T = false;
    private static com.unionpay.a.d U = null;
    private static Handler V = null;
    private static String W = "[{\"type\":\"app\",\"sort\":100,\"package_info\":[{\"schema\":\"com.unionpay\",\"version\":\"^[5-9]{1}+(.[0-9]{1})+(.[0-9]{1,3})?$\",\"sign\":\"536C79B93ACFBEA950AE365D8CE1AEF91FEA9535\",\"sort\":101}],\"need_install\":false,\"install_msg\":\"请先安装银联在线支付服务,安装完成后重新发起付款\",\"url\":\"https://mobile.unionpay.com/getclient?platform=android&type=securepayplugin\",\"download_app\":\"UPPayPluginEx.apk\",\"download_title\":\"银联在线支付服务\",\"download_desp\":\"正在下载银联在线支付服务…\",\"md5\":\"D75BB2802E61738A9A03BF014F927D9A\"},{\"type\":\"jar\",\"sort\":200}]";
    private static String X = "[{\"type\":\"app\",\"sort\":100,\"package_info\":[{\"schema\":\"com.unionpay.tsmservice\",\"version\":\"^[1-9].*|^0[2-9].*|^01\\.[1-9].*|^01\\.0[1-9].*|^01\\.00\\.[2-9].*|^01\\.00\\.1[012789].*|^01\\.00\\.0[8-9].*\",\"sign\":\"536C79B93ACFBEA950AE365D8CE1AEF91FEA9535\",\"sort\":102},{\"schema\":\"com.unionpay.tsmservice.mi\",\"version\":\"^[1-9].*|^0[2-9].*|^01\\.[1-9].*|^01\\.0[1-9].*|^01\\.00\\.[1-9].*|^01\\.00\\.0[8-9].*\",\"sign\":\"536C79B93ACFBEA950AE365D8CE1AEF91FEA9535\",\"sort\":103}],\"need_install\":false,\"install_msg\":\"请先安装银联在线支付服务,安装完成后重新发起付款\",\"url\":\"https://mobile.unionpay.com/getclient?platform=android&type=securepayplugin\",\"download_app\":\"UPPayPluginEx.apk\",\"download_title\":\"银联在线支付服务\",\"download_desp\":\"正在下载银联在线支付服务…\",\"md5\":\"D75BB2802E61738A9A03BF014F927D9A\"}]";
    private static JSONArray Y = null;
    private static final Handler.Callback Z = new c();

    private static String f17828a = "SpId";

    private static String f17829b = "paydata";
    private static String c = "SysProvide";
    private static String d = "UseTestMode";
    private static String e = "SecurityChipType";
    private static String f = "uppayuri";
    private static String g = "resultIntentAction";
    private static String h = "reqOriginalId";
    private static String i = "wapurl";
    private static String j = "actionType";
    private static String k = "dlgstyle";
    private static String l = "com.unionpay.uppay";
    private static String m = "com.unionpay.uppay.PayActivity";
    private static String n = "com.huawei.wallet";
    private static String o = "com.huawei.wallet.action.onlinepay.startpay";
    private static String p = "ex_mode";
    private static String q = "server";
    private static String r = "source";
    private static String s = "samsung_out";
    private static String t = "se_type";
    private static String u = "se_title_logo";
    private static String v = "se_loading_logo";
    private static String w = "se_title_bg_color";
    private static String x = "se_cancel_bg_color";
    private static String y = "02";
    private static String z;

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

    private static String a(Context context, boolean z2, String str) {
        int i2;
        NfcAdapter defaultAdapter;
        String str2;
        JSONObject jSONObject = new JSONObject();
        try {
            try {
                try {
                    i2 = Integer.parseInt(N);
                } catch (Exception unused) {
                }
            } catch (NumberFormatException unused2) {
                i2 = 0;
            }
            if (!z2) {
                jSONObject.put("tn", UPUtils.forWap(i2, com.unionpay.utils.b.a(K)));
            }
            jSONObject.put(am.aE, "1.4");
            jSONObject.put("imei", com.unionpay.utils.e.b(context));
            jSONObject.put("locale", Locale.getDefault().toString().startsWith("zh") ? "zh_CN" : "en_US");
            jSONObject.put("terminal_version", "3.5.2");
            jSONObject.put("terminal_resolution", (context.getResources().getDisplayMetrics().widthPixels + PrikeyElement.WAIT + context.getResources().getDisplayMetrics().heightPixels).trim());
            jSONObject.put("os_name", "android");
            jSONObject.put(am.y, Build.VERSION.RELEASE.trim());
            String trim = Build.MODEL.trim();
            if (trim != null) {
                trim.replace(" ", "");
            }
            jSONObject.put("device_model", trim);
            jSONObject.put("mac", com.unionpay.utils.e.a(context));
            try {
                jSONObject.put("time_zone", TimeZone.getDefault().getDisplayName(false, 0));
            } catch (Exception e2) {
                e2.printStackTrace();
            }
            try {
                NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService(FakeServiceHelper.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();
                if (activeNetworkInfo == null || !activeNetworkInfo.isAvailable()) {
                    str2 = "disConnect";
                } else if (activeNetworkInfo.getType() != 0) {
                    str2 = activeNetworkInfo.getType() == 1 ? "wifi" : "other";
                } else if (activeNetworkInfo.getState() == NetworkInfo.State.CONNECTED) {
                    str2 = "mobile:" + activeNetworkInfo.getExtraInfo();
                } else {
                    str2 = "mobile";
                }
                jSONObject.put("network_mode", str2);
            } catch (Exception e3) {
                e3.printStackTrace();
            }
            try {
                jSONObject.put("imsi", com.unionpay.utils.e.c(context));
            } catch (Exception e4) {
                e4.printStackTrace();
            }
            try {
                jSONObject.put("baseband_version", d(com.unionpay.utils.e.a()));
            } catch (Exception e5) {
                e5.printStackTrace();
            }
            try {
                jSONObject.put("root", new File("/system/bin/su").exists() ? "1" : "0");
            } catch (Exception e6) {
                e6.printStackTrace();
            }
            try {
                StringBuffer stringBuffer = new StringBuffer("000");
                if (Build.VERSION.SDK_INT >= 10 && (defaultAdapter = ((NfcManager) context.getSystemService("nfc")).getDefaultAdapter()) != null) {
                    if (defaultAdapter.isEnabled()) {
                        stringBuffer.setCharAt(0, '1');
                    } else {
                        stringBuffer.setCharAt(0, '2');
                    }
                    if (Build.VERSION.SDK_INT >= 19 && context.getPackageManager().hasSystemFeature("android.hardware.nfc.hce")) {
                        stringBuffer.setCharAt(1, '1');
                    }
                }
                jSONObject.put("support_map", stringBuffer.toString());
            } catch (Exception e7) {
                e7.printStackTrace();
            }
            jSONObject.put(am.O, d(Locale.getDefault().getCountry()));
            String packageName = ((Activity) context).getPackageName();
            if (packageName == null) {
                packageName = "";
            }
            jSONObject.put("package", d(packageName));
            Location d2 = com.unionpay.utils.e.d(context);
            jSONObject.put("latitude", d(d2 != null ? Double.valueOf(d2.getLatitude()).toString() : ""));
            Location d3 = com.unionpay.utils.e.d(context);
            jSONObject.put("longitude", d(d3 != null ? Double.valueOf(d3.getLongitude()).toString() : ""));
            jSONObject.put("tel", d(com.unionpay.utils.e.e(context)));
            if (z2) {
                try {
                    Class.forName("com.unionpay.uppay.PayActivity");
                    jSONObject.put("has_sdk", "1");
                } catch (ClassNotFoundException unused3) {
                    jSONObject.put("has_sdk", "0");
                }
            }
            jSONObject.put("seType", com.unionpay.utils.b.b(D));
            jSONObject.put("isLimitSe", G);
            jSONObject.put("vendorCapacity", str);
            jSONObject.put("sdkVerMode", "01");
        } catch (PatternSyntaxException e8) {
            e8.printStackTrace();
        } catch (JSONException e9) {
            e9.printStackTrace();
        }
        return jSONObject.toString();
    }

    public static void a(Context context, JSONArray jSONArray, int i2) {
        while (jSONArray != null && i2 < jSONArray.length()) {
            Object a2 = com.unionpay.utils.i.a(jSONArray, i2);
            if (a2 == null) {
                return;
            }
            JSONObject jSONObject = (JSONObject) a2;
            String a3 = com.unionpay.utils.i.a(jSONObject, "type");
            if ("app".equals(a3)) {
                JSONArray b2 = com.unionpay.utils.i.b(jSONObject, "package_info");
                String a4 = com.unionpay.utils.i.a(jSONObject, "app_server");
                JSONArray b3 = b(b2, "sort");
                boolean z2 = false;
                if (b3.length() > 0) {
                    int length = b3.length();
                    int i3 = 0;
                    while (true) {
                        if (i3 >= length) {
                            break;
                        }
                        Object a5 = com.unionpay.utils.i.a(b3, i3);
                        if (a5 != null) {
                            JSONObject jSONObject2 = (JSONObject) a5;
                            String a6 = com.unionpay.utils.i.a(jSONObject2, "schema");
                            String a7 = com.unionpay.utils.i.a(jSONObject2, "sign");
                            String a8 = com.unionpay.utils.i.a(jSONObject2, ClientCookie.VERSION_ATTR);
                            if (com.unionpay.utils.b.a(context, a6) && a7.equalsIgnoreCase(com.unionpay.utils.b.b(context, a6)) && com.unionpay.utils.b.c(context, a6).matches(a8)) {
                                try {
                                    Bundle bundle = new Bundle();
                                    a(K, bundle, N);
                                    bundle.putString(f17828a, L);
                                    bundle.putString(c, M);
                                    bundle.putString(f17829b, K);
                                    bundle.putString(r, E);
                                    bundle.putString(t, F);
                                    if (!TextUtils.isEmpty(F)) {
                                        bundle.putString(u, z);
                                        bundle.putString(v, A);
                                        bundle.putString(w, B);
                                        bundle.putString(x, C);
                                    }
                                    bundle.putBoolean(k, H);
                                    bundle.putString(q, a4);
                                    bundle.putString(e, null);
                                    bundle.putInt(h, 0);
                                    Intent intent = new Intent();
                                    intent.putExtras(bundle);
                                    if (n.equals(a6)) {
                                        intent.setAction(o);
                                        intent.setPackage(a6);
                                    } else {
                                        intent.setClassName(a6, m);
                                    }
                                    if (J instanceof Activity) {
                                        ((Activity) J).startActivityForResult(intent, I);
                                    } else {
                                        intent.addFlags(268435456);
                                        J.startActivity(intent);
                                    }
                                    z2 = true;
                                } catch (Exception e2) {
                                    e2.printStackTrace();
                                }
                            }
                        }
                        i3++;
                    }
                }
                if (z2) {
                    return;
                }
            } else {
                if (!"wap".equals(a3)) {
                    if ("jar".equals(a3)) {
                        a(com.unionpay.utils.i.a(jSONObject, "app_server"));
                        return;
                    } else {
                        if ("link".equals(a3)) {
                            String str = "";
                            try {
                                str = jSONObject.getString(SocialConstants.PARAM_URL);
                            } catch (Exception unused) {
                            }
                            a(str, "link");
                            return;
                        }
                        return;
                    }
                }
                if (!s.equals(E)) {
                    String str2 = "";
                    try {
                        str2 = (String) jSONObject.get(SocialConstants.PARAM_URL);
                    } catch (Exception unused2) {
                    }
                    a(str2, "wap");
                    return;
                }
            }
            jSONArray = Y;
            i2 = R + 1;
            R = i2;
        }
    }

    public static void a(String str) {
        Bundle bundle = new Bundle();
        a(K, bundle, N);
        bundle.putString(f17828a, L);
        bundle.putString(c, M);
        bundle.putString(f17829b, K);
        bundle.putString(r, E);
        bundle.putString(t, F);
        if (!TextUtils.isEmpty(F)) {
            bundle.putString(u, z);
            bundle.putString(v, A);
            bundle.putString(w, B);
            bundle.putString(x, C);
        }
        bundle.putString(q, str);
        bundle.putBoolean(k, H);
        bundle.putInt(h, 2);
        try {
            Class<?> cls = Class.forName("com.unionpay.uppay.PayActivity");
            Intent intent = new Intent();
            intent.putExtras(bundle);
            intent.setClass(J, cls);
            if (J instanceof Activity) {
                ((Activity) J).startActivityForResult(intent, I);
            } else {
                intent.addFlags(268435456);
                J.startActivity(intent);
            }
        } catch (ClassNotFoundException unused) {
        }
    }

    private static void a(String str, Bundle bundle, String str2) {
        if (str == null || str.trim().length() <= 0) {
            return;
        }
        if (str.trim().charAt(0) != '<') {
            bundle.putString(p, str2);
        } else if (str2 == null || !str2.trim().equalsIgnoreCase("00")) {
            bundle.putBoolean(d, true);
        } else {
            bundle.putBoolean(d, false);
        }
    }

    private static void a(String str, String str2) {
        Bundle bundle = new Bundle();
        if (!"link".equals(str2)) {
            a(K, bundle, N);
            bundle.putString(f17828a, L);
            bundle.putString(c, M);
            int i2 = 0;
            try {
                i2 = Integer.parseInt(N);
            } catch (NumberFormatException unused) {
            }
            bundle.putString(f17829b, UPUtils.forWap(i2, com.unionpay.utils.b.a(K)));
        }
        bundle.putString("magic_data", "949A1CC");
        bundle.putString(i, str);
        bundle.putString(j, str2);
        try {
            Intent intent = new Intent();
            intent.putExtras(bundle);
            intent.setClass(J, UPPayWapActivity.class);
            ((Activity) J).startActivityForResult(intent, 100);
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static JSONArray b(JSONArray jSONArray, String str) {
        ArrayList arrayList = new ArrayList();
        for (int i2 = 0; jSONArray != null && i2 < jSONArray.length(); i2++) {
            arrayList.add(jSONArray.optJSONObject(i2));
        }
        Collections.sort(arrayList, new e(str));
        JSONArray jSONArray2 = new JSONArray();
        for (int i3 = 0; i3 < arrayList.size(); i3++) {
            jSONArray2.put((JSONObject) arrayList.get(i3));
        }
        return jSONArray2;
    }

    public static void b(Context context, String str) {
        int i2;
        try {
            i2 = Integer.parseInt(N);
        } catch (NumberFormatException unused) {
            i2 = 0;
        }
        String forUrl = UPUtils.forUrl(i2);
        com.unionpay.utils.j.a("uppay", "url: " + forUrl);
        U = new com.unionpay.a.d(forUrl);
        U.a(a(context, false, str));
        if (V == null) {
            V = new Handler(Z);
        }
        Executors.newSingleThreadExecutor().execute(new d());
    }

    public static void c(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            z = jSONObject.getString("titleLogo");
            A = jSONObject.getString("loadingLogo");
            B = jSONObject.getString("backGroundColor");
            C = jSONObject.getString("textColor");
        } catch (Exception unused) {
        }
    }

    private static String d(String str) {
        return str != null ? Pattern.compile("[\":,\\[\\]{}]").matcher(str).replaceAll("").trim() : "";
    }

    public static boolean i() {
        S = true;
        return true;
    }

    public static boolean l() {
        T = true;
        return true;
    }
}