小源钱包 v1.0.0版本的 MD5 值为:2fddb51fa9867693f901004082511bea

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


package com.mobile.auth.d;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkInfo;
import android.os.Build;
import android.text.TextUtils;
import com.jufu.kakahua.apiloan.ui.SupportBankCardActivity;
import com.mobile.auth.d.e;
import com.mobile.auth.d.i;
import com.mobile.auth.gatewayauth.ExceptionProcessor;
import com.nirvana.tools.core.MobileNetRequestManager;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public final class a {
    private static final String f15275a = "a";

    static String a() {
        try {
            return f15275a;
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    public static String a(Context context, String str, String str2, Network network) {
        try {
            return c(context, d.a(context, str, network), str2, network);
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    private String a(Context context, String str, String str2, String str3, Network network, String str4, String str5) {
        try {
            String b10 = b();
            String a10 = g.a(context, str, str2, str3, b10);
            String str6 = f15275a;
            com.mobile.auth.a.a.a(str6, "request params : ".concat(String.valueOf(a10)));
            String a11 = d.a(context, "https://id6.me/auth/preauth.do", a10, network, str4, str5);
            com.mobile.auth.a.a.a(str6, "request result : ".concat(String.valueOf(a11)));
            String b11 = b(context, a11, b10, network);
            if (TextUtils.isEmpty(b11)) {
                return "{\"result\":80001,\"msg\":\"请求异常\"}";
            }
            com.mobile.auth.c.e.a(str5, b11, a10);
            return b11;
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    private static String a(Context context, List<String> list, String str, Network network) {
        for (int i10 = 0; i10 < list.size(); i10++) {
            try {
                try {
                    String str2 = list.get(i10);
                    if (!TextUtils.isEmpty(list.get(i10)) && context != null && Build.VERSION.SDK_INT < 21) {
                        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
                        if (connectivityManager.getNetworkInfo(5).getState().compareTo(NetworkInfo.State.CONNECTED) == 0) {
                            int a10 = e.a(e.b(str2));
                            Class<?> cls = Class.forName("android.net.ConnectivityManager");
                            Class<?> cls2 = Integer.TYPE;
                            ((Boolean) cls.getMethod("requestRouteToHost", cls2, cls2).invoke(connectivityManager, 5, Integer.valueOf(a10))).booleanValue();
                        }
                    }
                    String a11 = a(context, list.get(i10), str, network);
                    try {
                        JSONObject jSONObject = !TextUtils.isEmpty(a11) ? new JSONObject(a11) : null;
                        if (jSONObject != null && jSONObject.getInt("result") == 0) {
                            return a11;
                        }
                    } catch (Exception e10) {
                        e10.printStackTrace();
                    }
                } catch (Exception e11) {
                    e11.printStackTrace();
                }
            } catch (Throwable th) {
                try {
                    ExceptionProcessor.processException(th);
                    return null;
                } catch (Throwable th2) {
                    ExceptionProcessor.processException(th2);
                    return null;
                }
            }
        }
        return null;
    }

    static String a(a aVar, Context context, String str, String str2, String str3, Network network, String str4, String str5) {
        try {
            return aVar.a(context, str, str2, str3, network, str4, str5);
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    public static String a(String str, String str2) {
        try {
            return com.mobile.auth.b.a.c(str, str2);
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    private void a(final Context context, final String str, final i.a aVar, final int i10, final com.mobile.auth.a.b bVar) {
        try {
            final Future b10 = i.a().b(aVar);
            i.a().a(new Runnable() {
                @Override
                public void run() {
                    try {
                        b10.get(i10, TimeUnit.MILLISECONDS);
                        Future future = b10;
                        if (future == null || future.isDone()) {
                            return;
                        }
                        b10.cancel(true);
                    } catch (Throwable th) {
                        try {
                            ExceptionProcessor.processException(th);
                        } catch (Throwable th2) {
                            ExceptionProcessor.processException(th2);
                        }
                    }
                }
            });
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
            }
        }
    }

    private String b() {
        try {
            String uuid = UUID.randomUUID().toString();
            if (TextUtils.isEmpty(uuid)) {
                return "";
            }
            String replace = uuid.replace("-", "");
            return replace.length() >= 16 ? replace.substring(0, 16) : replace;
        } catch (Throwable th) {
            try {
                com.mobile.auth.a.a.a(f15275a, "generateAesKey error", th);
                return "";
            } catch (Throwable th2) {
                try {
                    ExceptionProcessor.processException(th2);
                    return null;
                } catch (Throwable th3) {
                    ExceptionProcessor.processException(th3);
                    return null;
                }
            }
        }
    }

    private String b(Context context, String str, String str2, Network network) {
        try {
            if (TextUtils.isEmpty(str)) {
                return null;
            }
            JSONObject jSONObject = new JSONObject(str);
            int optInt = jSONObject.optInt("result");
            String optString = jSONObject.optString(SupportBankCardActivity.BUNDLE_KEY_NAME);
            if ((optInt == 0 || optInt == 30002) && !TextUtils.isEmpty(optString)) {
                String a10 = a(optString, str2);
                if (!TextUtils.isEmpty(a10)) {
                    try {
                        jSONObject.put(SupportBankCardActivity.BUNDLE_KEY_NAME, new JSONObject(a10));
                    } catch (JSONException e10) {
                        e10.printStackTrace();
                        jSONObject.put(SupportBankCardActivity.BUNDLE_KEY_NAME, a10);
                    }
                    if (optInt == 30002) {
                        ArrayList arrayList = new ArrayList();
                        JSONArray optJSONArray = ((JSONObject) jSONObject.opt(SupportBankCardActivity.BUNDLE_KEY_NAME)).optJSONArray("urls");
                        if (optJSONArray != null) {
                            for (int i10 = 0; i10 < optJSONArray.length(); i10++) {
                                arrayList.add(optJSONArray.getString(i10));
                            }
                        }
                        if (arrayList.isEmpty()) {
                            return null;
                        }
                        return a(context, arrayList, str2, network);
                    }
                    return jSONObject.toString();
                }
            }
            return jSONObject.toString();
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    private static String c(Context context, String str, String str2, Network network) {
        try {
            if (TextUtils.isEmpty(str)) {
                return null;
            }
            JSONObject jSONObject = new JSONObject(str);
            int optInt = jSONObject.optInt("result");
            String optString = jSONObject.optString(SupportBankCardActivity.BUNDLE_KEY_NAME);
            if (optInt == 0 && !TextUtils.isEmpty(optString)) {
                String a10 = a(optString, str2);
                if (!TextUtils.isEmpty(a10)) {
                    try {
                        jSONObject.put(SupportBankCardActivity.BUNDLE_KEY_NAME, new JSONObject(a10));
                    } catch (JSONException e10) {
                        e10.printStackTrace();
                        jSONObject.put(SupportBankCardActivity.BUNDLE_KEY_NAME, a10);
                    }
                }
            }
            return jSONObject.toString();
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    public final void a(final Context context, final String str, final String str2, final String str3, final com.mobile.auth.a.b bVar) {
        try {
            int i10 = com.mobile.auth.a.a.f15178b;
            int i11 = i10 <= 0 ? 10000 : i10;
            final String a10 = c.a();
            final String a11 = c.a(context);
            com.mobile.auth.c.e.a(a10).a(str).b(a11).d("preauth").c(f.f(context)).i(context.getPackageName());
            a(context, a10, new i.a() {
                @Override
                public void run() {
                    try {
                        String a12 = a.a(a.this, context, str, str2, str3, null, a11, a10);
                        if (a()) {
                            return;
                        }
                        com.mobile.auth.a.a.b(context, a12, a10, bVar);
                    } catch (Throwable th) {
                        try {
                            ExceptionProcessor.processException(th);
                        } catch (Throwable th2) {
                            ExceptionProcessor.processException(th2);
                        }
                    }
                }
            }, i11, bVar);
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
            }
        }
    }

    public final void b(final Context context, final String str, final String str2, final String str3, final com.mobile.auth.a.b bVar) {
        try {
            int i10 = com.mobile.auth.a.a.f15178b;
            int i11 = i10 <= 0 ? 10000 : i10;
            final String a10 = c.a();
            final String a11 = c.a(context);
            com.mobile.auth.c.e.a(a10).a(str).b(a11).d("preauth").c(f.f(context)).i(context.getPackageName());
            if (Build.VERSION.SDK_INT < 21) {
                a(context, a10, new i.a() {
                    @Override
                    public void run() {
                        try {
                            if (!new e().a(context, "https://id6.me/auth/preauth.do")) {
                                if (a()) {
                                    return;
                                }
                                com.mobile.auth.a.a.b(context, h.a(MobileNetRequestManager.CODE_SWITCH_TIMEOUT, MobileNetRequestManager.MSG_SWITCH_TIMEOUT), a10, bVar);
                            } else if (a()) {
                            } else {
                                String a12 = a.a(a.this, context, str, str2, str3, null, a11, a10);
                                if (a()) {
                                    return;
                                }
                                com.mobile.auth.a.a.b(context, a12, a10, bVar);
                            }
                        } catch (Throwable th) {
                            try {
                                ExceptionProcessor.processException(th);
                            } catch (Throwable th2) {
                                ExceptionProcessor.processException(th2);
                            }
                        }
                    }
                }, i11, bVar);
                return;
            }
            e eVar = new e();
            eVar.a(context, new e.a() {
                private boolean f15292i = false;
                private boolean f15293j = false;

                @Override
                public synchronized void a() {
                    try {
                        this.f15292i = true;
                        if (!this.f15293j) {
                            com.mobile.auth.c.e.a(a10, "{\"result\":80000,\"msg\":\"请求超时\"}", "");
                            com.mobile.auth.a.a.b(context, "{\"result\":80000,\"msg\":\"请求超时\"}", a10, bVar);
                        }
                    } catch (Throwable th) {
                        try {
                            ExceptionProcessor.processException(th);
                        } catch (Throwable th2) {
                            ExceptionProcessor.processException(th2);
                        }
                    }
                }

                @Override
                public synchronized void a(int i12, String str4, long j10) {
                    try {
                        if (!this.f15292i && !this.f15293j) {
                            this.f15293j = true;
                            com.mobile.auth.c.e.a(a10).h("switchToMobile_L  onFail()  expendTime : ".concat(String.valueOf(j10))).a(i12).f(str4).b(j10);
                            com.mobile.auth.a.a.b(context, h.a(i12, str4), a10, bVar);
                            String a12 = a.a();
                            com.mobile.auth.a.a.a(a12, "Switching network failed (L), errorMsg :" + str4 + " , expendTime :" + j10);
                        }
                    } catch (Throwable th) {
                        try {
                            ExceptionProcessor.processException(th);
                        } catch (Throwable th2) {
                            ExceptionProcessor.processException(th2);
                        }
                    }
                }

                @Override
                public void a(Network network, long j10) {
                    try {
                        com.mobile.auth.a.a.a(a.a(), "Switching network successfully (L) , expendTime :".concat(String.valueOf(j10)));
                        if (!this.f15292i && !this.f15293j) {
                            com.mobile.auth.c.e.a(a10).b(j10);
                            String a12 = a.a(a.this, context, str, str2, str3, network, a11, a10);
                            synchronized (this) {
                                if (!this.f15292i && !this.f15293j) {
                                    this.f15293j = true;
                                    com.mobile.auth.a.a.b(context, a12, a10, bVar);
                                }
                            }
                        }
                    } catch (Throwable th) {
                        try {
                            ExceptionProcessor.processException(th);
                        } catch (Throwable th2) {
                            ExceptionProcessor.processException(th2);
                        }
                    }
                }
            });
            eVar.a(i11);
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
            }
        }
    }
}