百度手机卫士 v8.4.5版本的 MD5 值为:c65ef854a40bb6200c4d8c4603c58403

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


package dxoptimizer;

import android.content.Context;
import android.text.TextUtils;
import android.util.Pair;
import com.baidu.mobads.interfaces.error.XAdErrorCode;
import com.baidu.sapi2.utils.SapiUtils;
import com.dianxinos.optimizer.module.netflowmgr.util.Constant;
import com.dianxinos.optimizer.utils.HttpUtils;
import com.quickbird.mini.vpn.vpn.VpnWatchdogThread;
import com.quickbird.sdk.internal.HttpsClient;
import java.io.UnsupportedEncodingException;
import java.net.SocketTimeoutException;
import java.net.URLEncoder;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONObject;

public class fhl {
    public static void a(Context context, String str, String str2, fgy fgyVar) {
        int i;
        int i2;
        String str3;
        String str4 = null;
        if (!hqo.c(context)) {
            if (fgyVar != null) {
                fgyVar.a(null, 2);
                return;
            }
            return;
        }
        try {
            try {
                hsk.a(90117);
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("mobile", str);
                jSONObject.put("productCode", str2);
                JSONObject jSONObject2 = new JSONObject();
                long currentTimeMillis = System.currentTimeMillis();
                jSONObject2.put("createTime", currentTimeMillis);
                jSONObject2.put(XAdErrorCode.ERROR_CODE_MESSAGE, hsi.a(hhj.b, currentTimeMillis, jSONObject.toString()));
                String jSONObject3 = jSONObject2.toString();
                JSONObject jSONObject4 = new JSONObject(HttpUtils.b(context, hhj.L, jSONObject3, a(jSONObject3)));
                str3 = jSONObject4.optJSONObject("response").optString("orderNumber");
                JSONObject optJSONObject = jSONObject4.optJSONObject("responseHeader");
                int optInt = optJSONObject.optInt("errcode");
                if (optJSONObject != null) {
                    str4 = optJSONObject.toString();
                }
                if (optInt == 200) {
                    i2 = 0;
                } else {
                    String str5 = str4;
                    i2 = 1;
                    str3 = str5;
                }
            } catch (Exception e) {
                if (e instanceof SocketTimeoutException) {
                    i = 3;
                } else {
                    i = 4;
                }
                hsk.a();
                i2 = i;
                str3 = null;
            }
            if (fgyVar != null) {
                fgyVar.a(str3, i2);
            }
        } finally {
            hsk.a();
        }
    }

    private static String a(String str) {
        if (str.length() > 50) {
            str = str.substring(0, 50);
        }
        return "checkStr=" + hpp.a(str + "AYUEJ1AWWHKTYENYUG1RP1B52SY5R1OJ");
    }

    public static void a(Context context, String str, fgy fgyVar) {
        int i;
        int i2;
        String str2;
        if (!hqo.c(context)) {
            if (fgyVar != null) {
                fgyVar.a(null, 2);
                return;
            }
            return;
        }
        try {
            try {
                hsk.a(90118);
                JSONObject jSONObject = new JSONObject();
                JSONArray jSONArray = new JSONArray();
                jSONArray.put(str);
                jSONObject.put("phones", jSONArray);
                JSONObject jSONObject2 = new JSONObject();
                long currentTimeMillis = System.currentTimeMillis();
                jSONObject2.put("createTime", currentTimeMillis);
                jSONObject2.put(XAdErrorCode.ERROR_CODE_MESSAGE, hsi.a(hhj.b, currentTimeMillis, jSONObject.toString()));
                String jSONObject3 = jSONObject2.toString();
                JSONObject jSONObject4 = new JSONObject(HttpUtils.b(context, hhj.N, jSONObject3, a(jSONObject3)));
                JSONObject optJSONObject = jSONObject4.optJSONObject("responseHeader");
                if (optJSONObject.optInt(VpnWatchdogThread.VPN_WATCHDOG_STATUS) == 200) {
                    str2 = jSONObject4.optJSONObject("response").optJSONObject("datas").optJSONObject(str).getString("operation");
                    i2 = 0;
                } else {
                    str2 = optJSONObject.toString();
                    i2 = 1;
                }
            } catch (Exception e) {
                if (e instanceof SocketTimeoutException) {
                    i = 3;
                } else {
                    i = 4;
                }
                hsk.a();
                i2 = i;
                str2 = null;
            }
            if (fgyVar != null) {
                fgyVar.a(str2, i2);
            }
        } finally {
            hsk.a();
        }
    }

    public static void a(Context context, String str, String str2, String str3, String str4, fgy fgyVar) {
        int i;
        int i2;
        String str5;
        int i3;
        String str6 = null;
        if (!hqo.c(context)) {
            if (fgyVar != null) {
                fgyVar.a(null, 2);
                return;
            }
            return;
        }
        try {
            try {
                hsk.a(90119);
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("mobile", str);
                jSONObject.put("productCode", str4);
                jSONObject.put("paymentSmsCode", str2);
                jSONObject.put("orderNumber", str3);
                JSONObject jSONObject2 = new JSONObject();
                long currentTimeMillis = System.currentTimeMillis();
                jSONObject2.put("createTime", currentTimeMillis);
                jSONObject2.put(XAdErrorCode.ERROR_CODE_MESSAGE, hsi.a(hhj.b, currentTimeMillis, jSONObject.toString()));
                String jSONObject3 = jSONObject2.toString();
                JSONObject optJSONObject = new JSONObject(HttpUtils.b(context, hhj.O, jSONObject3, a(jSONObject3))).optJSONObject("responseHeader");
                int optInt = optJSONObject.optInt("errcode");
                if (optJSONObject != null) {
                    str6 = optJSONObject.toString();
                }
                if (optInt == 200) {
                    i3 = 0;
                } else {
                    i3 = 1;
                }
                hsk.a();
                String str7 = str6;
                i2 = i3;
                str5 = str7;
            } catch (Exception e) {
                if (e instanceof SocketTimeoutException) {
                    i = 3;
                } else {
                    i = 4;
                }
                hsk.a();
                i2 = i;
                str5 = null;
            }
            if (fgyVar != null) {
                fgyVar.a(str5, i2);
            }
        } catch (Throwable th) {
            hsk.a();
            throw th;
        }
    }

    public static void a(Context context, String[] strArr, fgy fgyVar) {
        int i;
        String str;
        evk evkVar;
        evk evkVar2 = null;
        int i2 = 4;
        int i3 = 0;
        JSONObject a = fhk.a(strArr);
        try {
            if (hqo.c(context)) {
                try {
                    JSONObject b = b(a.toString());
                    if (b != null) {
                        hsk.a(90112);
                        str = HttpUtils.b(context, a(), b.toString());
                    } else {
                        str = null;
                    }
                    if (str != null) {
                        JSONObject c = c(str);
                        if (c == null) {
                            fgyVar.a(null, 1);
                            return;
                        }
                        if (c.getString("result").equals(String.valueOf(1))) {
                            JSONArray jSONArray = c.getJSONArray("detailinfo");
                            if (jSONArray == null || jSONArray.length() == 0) {
                                fgyVar.a(null, 9);
                                return;
                            }
                            JSONObject jSONObject = (JSONObject) jSONArray.get(0);
                            String string = jSONObject.getString("warncode");
                            if (string.equals("0")) {
                                try {
                                    evkVar = fhk.a(jSONObject);
                                    i = 0;
                                } catch (Exception e) {
                                    e = e;
                                    if (e instanceof SocketTimeoutException) {
                                        i2 = 3;
                                    } else if (e instanceof HttpUtils.HttpStatusException) {
                                        i2 = ((HttpUtils.HttpStatusException) e).getStatusCode() == 404 ? 5 : i3;
                                    }
                                    hsk.a();
                                    i = i2;
                                    if (fgyVar == null) {
                                    }
                                }
                            } else if (string.equals("1")) {
                                i = 7;
                                evkVar = null;
                            } else if (string.equals("2")) {
                                i = 8;
                                evkVar = null;
                            } else {
                                i = 4;
                                evkVar = null;
                            }
                            hsk.a();
                            evkVar2 = evkVar;
                        }
                    }
                    i = 1;
                    evkVar = null;
                    hsk.a();
                    evkVar2 = evkVar;
                } catch (Exception e2) {
                    e = e2;
                    i3 = 1;
                }
            } else {
                i = 2;
            }
            if (fgyVar == null) {
                fgyVar.a(evkVar2, i);
            }
        } finally {
            hsk.a();
        }
    }

    public static void a(Context context, evk evkVar, String str, fgy fgyVar) {
        evk evkVar2;
        Exception e;
        int i;
        evk evkVar3;
        String str2;
        int i2 = 1;
        JSONObject a = fhk.a(context, evkVar, str);
        if (hqo.c(context)) {
            try {
                try {
                    JSONObject b = b(a.toString());
                    if (b != null) {
                        hsk.a(90113);
                        str2 = HttpUtils.b(context, a(), b.toString());
                    } else {
                        str2 = null;
                    }
                    if (str2 != null) {
                        JSONObject c = c(str2);
                        if (c == null) {
                            fgyVar.a(null, 1);
                            return;
                        }
                        if (c.getString("result").equals(String.valueOf(1))) {
                            String string = c.getString("errcode");
                            if (string.equals(String.valueOf(304002))) {
                                evkVar2 = fhk.a(new JSONArray(c.getJSONArray("detailinfo").toString()), evkVar);
                                try {
                                    String string2 = c.getString("extparam");
                                    if (!TextUtils.isEmpty(string2)) {
                                        ewg.a(context).a(evkVar.a, str, string2);
                                    }
                                    ewg.a(context).a(string2, evkVar.a, evkVar.h);
                                    i = 0;
                                    evkVar3 = evkVar2;
                                } catch (Exception e2) {
                                    e = e2;
                                    if (e instanceof SocketTimeoutException) {
                                        i2 = 3;
                                    } else if (!(e instanceof HttpUtils.HttpStatusException)) {
                                        i2 = 4;
                                    } else if (((HttpUtils.HttpStatusException) e).getStatusCode() == 404) {
                                        i2 = 5;
                                    }
                                    hsk.a();
                                    i = i2;
                                    evkVar3 = evkVar2;
                                    if (fgyVar == null) {
                                    }
                                }
                            } else if (string.equals(String.valueOf(304001))) {
                                evkVar3 = ewg.a(context).a(evkVar, str);
                                i = 6;
                            }
                        }
                    }
                    evkVar3 = null;
                    i = 1;
                } catch (Exception e3) {
                    evkVar2 = null;
                    e = e3;
                }
            } finally {
                hsk.a();
            }
        } else {
            evkVar3 = null;
            i = 2;
        }
        if (fgyVar == null) {
            fgyVar.a(evkVar3, i);
        }
    }

    public static void a(Context context, evk evkVar, String str, String str2, String str3, fgy fgyVar) {
        Object obj;
        JSONObject c;
        int i = 1;
        if (fgyVar == null) {
            throw new RuntimeException("call back object not allow null.");
        }
        if (context == null || evkVar == null || str == null || str2 == null || str3 == null) {
            fgyVar.a(null, 4);
        }
        if (!hqo.c(context)) {
            fgyVar.a(null, 2);
            return;
        }
        JSONObject a = fhk.a(context, evkVar, str, str2, str3);
        if (a == null) {
            fgyVar.a(null, 4);
            return;
        }
        try {
            try {
                hsk.a(90114);
                c = c(HttpUtils.b(context, a(), b(a.toString()).toString()));
            } catch (Exception e) {
                i = e instanceof SocketTimeoutException ? 3 : 4;
                hsk.a();
                obj = null;
            }
            if (c == null) {
                fgyVar.a(null, 1);
                return;
            }
            if (c.getString("result").equals(String.valueOf(1))) {
                obj = fhk.b(c.getJSONObject("detailinfo"));
                if (obj != null) {
                    i = 0;
                } else {
                    obj = null;
                }
            } else {
                obj = c.getString("errcode");
            }
            fgyVar.a(obj, i);
        } finally {
            hsk.a();
        }
    }

    public static void a(Context context, String str, String str2) {
        JSONObject a;
        if (context != null && str != null && str2 != null && hqo.c(context) && (a = fhk.a(str, str2)) != null) {
            try {
                hsk.a(90115);
                HttpUtils.b(context, a(), b(a.toString()).toString());
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                hsk.a();
            }
        }
    }

    public static void b(Context context, String str, fgy fgyVar) {
        evf evfVar;
        evf evfVar2 = null;
        int i = 1;
        if (context == null || str == null || fgyVar == null) {
            fgyVar.a(null, 4);
            return;
        }
        if (!hqo.c(context)) {
            fgyVar.a(null, 2);
            return;
        }
        JSONObject a = fhk.a(str);
        if (a != null) {
            try {
                hsk.a(90120);
                JSONObject c = c(HttpUtils.b(context, a(), b(a.toString()).toString()));
                if (c == null) {
                    fgyVar.a(null, 1);
                    return;
                }
                String string = c.getString("result");
                if (string == null) {
                    fgyVar.a(null, 1);
                    return;
                }
                if (string.equals(String.valueOf(1))) {
                    JSONObject optJSONObject = c.optJSONObject("detailinfo");
                    if (optJSONObject != null) {
                        evf evfVar3 = new evf();
                        fhk.a(evfVar3, optJSONObject);
                        if (evfVar3.a()) {
                            Pair a2 = hpl.a(context, evfVar3.a);
                            evfVar3.i = (String) a2.first;
                            evfVar3.j = (String) a2.second;
                        }
                        evfVar = evfVar3;
                    } else {
                        evfVar = null;
                    }
                    evfVar2 = evfVar;
                    i = 0;
                }
            } catch (Exception e) {
                i = e instanceof SocketTimeoutException ? 3 : 4;
            } finally {
                hsk.a();
            }
        }
        fgyVar.a(evfVar2, i);
    }

    public static void c(Context context, String str, fgy fgyVar) {
        ArrayList arrayList;
        ArrayList arrayList2 = null;
        int i = 1;
        if (context == null || str == null || fgyVar == null) {
            fgyVar.a(null, 4);
            return;
        }
        if (!hqo.c(context)) {
            fgyVar.a(null, 2);
            return;
        }
        JSONObject b = fhk.b(str);
        if (b != null) {
            try {
                hsk.a(90116);
                JSONObject c = c(HttpUtils.b(context, a(), b(b.toString()).toString()));
                if (c == null) {
                    fgyVar.a(null, 1);
                    return;
                }
                String string = c.getString("result");
                if (string == null) {
                    fgyVar.a(null, 1);
                    return;
                }
                if (string.equals(String.valueOf(1))) {
                    JSONArray optJSONArray = c.optJSONArray("detailinfo");
                    if (optJSONArray == null) {
                        fgyVar.a(null, 1);
                        return;
                    }
                    int length = optJSONArray.length();
                    if (length != 0) {
                        ArrayList arrayList3 = new ArrayList();
                        for (int i2 = 0; i2 < length; i2++) {
                            JSONObject jSONObject = (JSONObject) optJSONArray.get(i2);
                            evf evfVar = new evf();
                            fhk.a(evfVar, jSONObject);
                            if (evfVar.a()) {
                                Pair a = hpl.a(context, evfVar.a);
                                evfVar.i = (String) a.first;
                                evfVar.j = (String) a.second;
                                arrayList3.add(evfVar);
                            }
                        }
                        arrayList = arrayList3;
                    } else {
                        arrayList = null;
                    }
                    arrayList2 = arrayList;
                    i = 0;
                }
            } catch (Exception e) {
                i = e instanceof SocketTimeoutException ? 3 : 4;
            } finally {
                hsk.a();
            }
        }
        fgyVar.a(arrayList2, i);
    }

    private static JSONObject b(String str) {
        long currentTimeMillis = System.currentTimeMillis();
        JSONObject jSONObject = new JSONObject();
        String a = fhi.a(str, Constant.b);
        String a2 = fhi.a(new String[]{Constant.a, a, String.valueOf(currentTimeMillis)});
        jSONObject.put("partid", Constant.a);
        jSONObject.put("data", a);
        jSONObject.put(SapiUtils.KEY_QR_LOGIN_SIGN, a2);
        jSONObject.put("time", currentTimeMillis);
        return jSONObject;
    }

    private static JSONObject c(String str) {
        JSONObject jSONObject;
        String string;
        String string2;
        String string3;
        String string4;
        if (str == null) {
            return null;
        }
        try {
            JSONObject jSONObject2 = new JSONObject(str);
            string = jSONObject2.getString(SapiUtils.KEY_QR_LOGIN_SIGN);
            string2 = jSONObject2.getString("partid");
            string3 = jSONObject2.getString("data");
            string4 = jSONObject2.getString("time");
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (!TextUtils.isEmpty(string) && !TextUtils.isEmpty(string2) && !TextUtils.isEmpty(string3) && !TextUtils.isEmpty(string4)) {
            String a = fhi.a(new String[]{string2, string3, string4});
            if (!TextUtils.isEmpty(a) && a.equals(string)) {
                jSONObject = new JSONObject(fhi.b(string3, Constant.b));
                return jSONObject;
            }
        }
        jSONObject = null;
        return jSONObject;
    }

    private static String a() {
        try {
            StringBuilder sb = new StringBuilder();
            sb.append("https://shoujiweishi.baidu.com/rtsapi/2.0/rd").append("?").append("url").append("=").append(URLEncoder.encode(hhj.S, HttpsClient.HTTP_CHARSET));
            return sb.toString();
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }
}