百度手机卫士 v8.1.5版本的 MD5 值为:15af71eae74e2f2b5b9f845fe77a4804

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


package dxoptimizer;

import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.text.TextUtils;
import com.baidu.sapi2.utils.SapiUtils;
import com.baidu.security.plugin.alarm.AlarmUtil;
import com.dianxinos.optimizer.utils.HttpUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class dcp {
    private Context a;

    public dcp(Context context) {
        this.a = context.getApplicationContext();
    }

    public void a(boolean z) {
        a(z, (String) null);
    }

    public void a(boolean z, String str) {
        if (hki.c(this.a)) {
            SQLiteDatabase a = dbz.a(this.a);
            dcj dcjVar = new dcj(this.a, a);
            if (TextUtils.isEmpty(str)) {
                long b = dcjVar.b("http://aip.dxsvr.com/aip/official/chk?detail=true");
                if (z && System.currentTimeMillis() - b < AlarmUtil.DAY) {
                    return;
                }
            }
            try {
                String a2 = a(str);
                if (a2 == null) {
                    return;
                }
                hmb.a(4100);
                String a3 = HttpUtils.a(this.a, "http://aip.dxsvr.com/aip/official/chk?detail=true", a2);
                hjk hjkVar = new hjk();
                JSONArray b2 = hjkVar.b(a3);
                if (hjkVar.a()) {
                    new dcb(this.a, a).a(a(b2));
                    dcjVar.a("http://aip.dxsvr.com/aip/official/chk?detail=true", System.currentTimeMillis(), null);
                    Intent intent = new Intent("com.dianxinos.optimizer.appmanager.action.COUNT_CHANGED");
                    intent.setPackage(this.a.getPackageName());
                    hnc.a(this.a, intent);
                    fnm.a(this.a).a(true);
                }
            } catch (HttpUtils.HttpStatusException e) {
            } catch (IOException e2) {
            } catch (JSONException e3) {
            } finally {
                hmb.a();
            }
        }
    }

    public dca a(ayn aynVar) {
        dca dcaVar = null;
        if (hki.c(this.a)) {
            new dcj(this.a, dbz.a(this.a));
            try {
                String b = b(aynVar);
                if (b != null) {
                    hmb.a(4101);
                    String a = HttpUtils.a(this.a, "http://aip.dxsvr.com/aip/official/chk?detail=true", b);
                    hjk hjkVar = new hjk();
                    JSONArray b2 = hjkVar.b(a);
                    if (hjkVar.a()) {
                        dcaVar = a(b2, aynVar);
                    }
                }
            } catch (HttpUtils.HttpStatusException e) {
            } catch (IOException e2) {
            } catch (JSONException e3) {
            } finally {
                hmb.a();
            }
        }
        return dcaVar;
    }

    private String b(ayn aynVar) {
        JSONArray jSONArray = new JSONArray();
        String b = aynVar.b(this.a);
        long c = aynVar.c(this.a);
        if (b == null || c == 0) {
            return null;
        }
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("pkg", aynVar.d());
        jSONObject.put(SapiUtils.KEY_QR_LOGIN_SIGN, b);
        jSONObject.put("ver", aynVar.h());
        jSONObject.put("vername", aynVar.g());
        jSONObject.put("signmd5", c);
        jSONArray.put(jSONObject);
        if (jSONArray.length() <= 0) {
            return null;
        }
        JSONObject jSONObject2 = new JSONObject();
        jSONObject2.put("apps", jSONArray);
        return jSONObject2.toString();
    }

    private String a(String str) {
        ArrayList<ayn> arrayList = new ArrayList();
        if (TextUtils.isEmpty(str)) {
            arrayList.addAll(ayo.a(this.a).d());
        } else {
            arrayList.add(ayo.a(this.a).b(str));
        }
        JSONArray jSONArray = new JSONArray();
        for (ayn aynVar : arrayList) {
            if (!aynVar.p() || aynVar.q()) {
                String b = aynVar.b(this.a);
                long c = aynVar.c(this.a);
                if (b != null && c != 0) {
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("pkg", aynVar.d());
                    jSONObject.put(SapiUtils.KEY_QR_LOGIN_SIGN, b);
                    jSONObject.put("ver", aynVar.h());
                    jSONObject.put("vername", aynVar.g());
                    jSONObject.put("signmd5", c);
                    jSONArray.put(jSONObject);
                }
            }
        }
        if (jSONArray.length() <= 0) {
            return null;
        }
        JSONObject jSONObject2 = new JSONObject();
        jSONObject2.put("apps", jSONArray);
        return jSONObject2.toString();
    }

    private dca a(JSONArray jSONArray, ayn aynVar) {
        int length = jSONArray.length();
        for (int i = 0; i < length; i++) {
            JSONObject jSONObject = jSONArray.getJSONObject(i);
            String string = jSONObject.getString("pkg");
            if (aynVar != null && string.equals(aynVar.d())) {
                dca dcaVar = new dca();
                dcaVar.a = jSONObject.getString("pkg");
                dcaVar.f = aynVar.m();
                dcaVar.h = jSONObject.optDouble("signrate", 0.0d);
                if (!jSONObject.isNull("isofficial")) {
                    if (jSONObject.getBoolean("isofficial")) {
                        dcaVar.g = 1;
                    } else {
                        dcaVar.g = 2;
                    }
                } else {
                    dcaVar.g = -1;
                }
                dcaVar.i = false;
                if (dcaVar.g == 2 && !jSONObject.isNull("official")) {
                    JSONObject jSONObject2 = jSONObject.getJSONObject("official");
                    if (jSONObject2.getBoolean("isofficial")) {
                        dcaVar.i = true;
                        dcaVar.j = jSONObject2.getString("downurl");
                        dcaVar.k = jSONObject2.getLong("size");
                        dcaVar.l = jSONObject2.getInt("vercode");
                        dcaVar.m = jSONObject2.getLong("signmd5");
                        dcaVar.n = jSONObject2.getString(SapiUtils.KEY_QR_LOGIN_SIGN);
                        dcaVar.o = jSONObject2.optDouble("signrate", 0.0d);
                        return dcaVar;
                    }
                    return dcaVar;
                }
                return dcaVar;
            }
        }
        return null;
    }

    private List a(JSONArray jSONArray) {
        ayo a = ayo.a(this.a);
        ArrayList arrayList = new ArrayList();
        int length = jSONArray.length();
        for (int i = 0; i < length; i++) {
            JSONObject jSONObject = jSONArray.getJSONObject(i);
            ayn c = a.c(jSONObject.getString("pkg"));
            if (c != null) {
                dca dcaVar = new dca();
                dcaVar.a = jSONObject.getString("pkg");
                dcaVar.f = c.m();
                dcaVar.h = jSONObject.optDouble("signrate", 0.0d);
                if (!jSONObject.isNull("isofficial")) {
                    if (jSONObject.getBoolean("isofficial")) {
                        dcaVar.g = 1;
                    } else {
                        dcaVar.g = 2;
                    }
                } else {
                    dcaVar.g = -1;
                }
                dcaVar.i = false;
                if (dcaVar.g == 2 && !jSONObject.isNull("official")) {
                    JSONObject jSONObject2 = jSONObject.getJSONObject("official");
                    if (jSONObject2.getBoolean("isofficial")) {
                        dcaVar.i = true;
                        dcaVar.j = jSONObject2.getString("downurl");
                        dcaVar.k = jSONObject2.getLong("size");
                        dcaVar.l = jSONObject2.getInt("vercode");
                        dcaVar.m = jSONObject2.getLong("signmd5");
                        dcaVar.n = jSONObject2.getString(SapiUtils.KEY_QR_LOGIN_SIGN);
                        dcaVar.o = jSONObject2.optDouble("signrate", 0.0d);
                    }
                }
                arrayList.add(dcaVar);
            }
        }
        return arrayList;
    }
}