360手机助手 v3.3.0版本的 MD5 值为:127c345ad16bbebee6e347381328afd0

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


package com.qihoo.appstore.resource.app;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.Log;
import android.widget.ImageView;
import com.qihoo.appstore.AppStoreApplication;
import com.qihoo.appstore.activities.MainActivity;
import com.qihoo.appstore.express.PushMessageHandle;
import com.qihoo.appstore.f.cw;
import com.qihoo.appstore.ui.bu;
import com.qihoo.appstore.utils.bk;
import com.qihoo.appstore.utils.bw;
import com.qihoo.appstore.utils.db;
import com.qihoo.appstore.utils.de;
import com.qihoo.appstore.utils.l;
import com.qihoo.explorer.c.s;
import com.qihoo.express.mini.service.DaemonCoreService;
import com.qihoo.freewifi.push.R;
import com.qihoo.rtservice.RTServiceManager;
import com.qihoo.speedometer.Config;
import com.qihoo.speedometer.TraceFileUtil;
import com.qihoo360.mobilesafe.util.PatchUtil;
import com.qihoo360.mobilesafe.util.ah;
import com.qihoo360.mobilesafe.util.z;
import java.io.File;
import java.net.HttpURLConnection;
import java.net.URL;
import java.sql.Date;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.zip.GZIPInputStream;
import org.json.JSONArray;
import org.json.JSONObject;

public class App extends com.qihoo.appstore.e.a.b implements Parcelable, Comparable {
    public static Drawable[] aU;
    public static Drawable[] aV;
    public int aA;
    public int aB;
    public int aC;
    public boolean aD;
    public boolean aE;
    public String aF;
    public boolean aG;
    public String aH;
    public int aI;
    public DianJingAdStats aJ;
    public String aK;
    public String aL;
    public String aM;
    public String aN;
    public String aO;
    public String aP;
    public boolean aQ;
    public AppDetail aR;
    public UpdateInfo aS;
    protected String aT;
    public String aW;
    private String aX;
    private boolean aY;
    private int aZ;
    private String ac;
    private int ad;
    private String ae;
    private String af;
    private String ag;
    private String ah;
    private String ai;
    private String aj;
    private String ak;
    public String al;
    public String am;
    public int an;
    public String[] ao;
    public int ap;
    public String aq;
    public int ar;
    public String as;
    public String at;
    public String au;
    public int av;
    public String aw;
    public int ax;
    public boolean ay;
    public int az;
    private boolean bA;
    private boolean bB;
    private String bC;
    private boolean bD;
    private String bE;
    private com.qihoo.appstore.resource.a bF;
    private boolean bG;
    private JSONObject bH;
    private int bI;
    private long bJ;
    private Object bK;
    private String bL;
    private boolean bN;
    private String ba;
    private String bb;
    private long bc;
    private String bd;
    private String be;
    private String bf;
    private String bg;
    private String bh;
    private int bi;
    private int bj;
    private String bk;
    private int bl;
    private String bm;
    private String bn;
    private String bo;
    private String bp;
    private String bq;
    private int br;
    private boolean bs;
    private int bt;
    private String bu;
    private k bv;
    private String bw;
    private i bx;
    private boolean by;
    private boolean bz;
    private static String[] bM = {"9fae2c537de3bc929109e320f80f10fd"};
    public static final Parcelable.Creator CREATOR = new c();

    public class AppDetail implements Parcelable {
        public static final Parcelable.Creator CREATOR = new d();
        public String A;
        public String B;
        public String C;
        public String D;
        public String E;
        public String F;
        public String G;
        public String H;
        public String J;
        public InfoActivitys K;

        public String f3216a;

        public String f3217b;
        public String c;
        public String d;
        public String e;
        public String f;
        public String g;
        public String h;
        public String i;
        public String j;
        public String k;
        public int l;
        public int m;
        public String n;
        public String o;
        public String p;
        public String q;
        public String s;
        public String t;
        public String u;
        public String v;
        public String w;
        public String x;
        public String y;
        public String z;
        public int r = 0;
        public int I = 0;

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel parcel, int i) {
            parcel.writeString(this.f3216a);
            parcel.writeString(this.f3217b);
            parcel.writeString(this.c);
            parcel.writeString(this.d);
            parcel.writeString(this.h);
            parcel.writeString(this.k);
            parcel.writeInt(this.l);
            parcel.writeInt(this.m);
            parcel.writeString(this.n);
            parcel.writeString(this.o);
            parcel.writeString(this.p);
            parcel.writeString(this.q);
            parcel.writeString(this.s);
            parcel.writeString(this.t);
            parcel.writeString(this.u);
            parcel.writeString(this.v);
            parcel.writeString(this.w);
            parcel.writeString(this.x);
            parcel.writeString(this.y);
            parcel.writeString(this.z);
            parcel.writeString(this.A);
            parcel.writeString(this.B);
            parcel.writeString(this.D);
            parcel.writeString(this.C);
            parcel.writeString(this.E);
            parcel.writeString(this.H);
            parcel.writeString(this.F);
            parcel.writeString(this.G);
            parcel.writeString(this.e);
            parcel.writeString(this.f);
            parcel.writeString(this.g);
            parcel.writeString(this.i);
            parcel.writeString(this.j);
            parcel.writeInt(this.I);
            parcel.writeString(this.J);
        }
    }

    public class DianJingAdStats implements Parcelable {
        public static final Parcelable.Creator CREATOR = new e();

        public String f3218a;

        public String f3219b;
        public String c;
        public String d;
        public String e;
        public String f;

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel parcel, int i) {
            parcel.writeString(this.f3218a);
            parcel.writeString(this.f3219b);
            parcel.writeString(this.c);
            parcel.writeString(this.d);
            parcel.writeString(this.e);
            parcel.writeString(this.f);
        }
    }

    public class InfoActivitys implements Parcelable {

        public String f3220a;

        public String f3221b;
        public String c;
        public String d;
        public String e;
        public String f;

        public InfoActivitys(JSONObject jSONObject) {
            this.f3220a = Config.INVALID_IP;
            this.f3221b = Config.INVALID_IP;
            this.c = Config.INVALID_IP;
            this.d = Config.INVALID_IP;
            this.e = Config.INVALID_IP;
            this.f = Config.INVALID_IP;
            this.f3220a = jSONObject.optString("pname");
            this.f3221b = jSONObject.optString("img");
            this.c = jSONObject.optString("activity_title");
            this.d = jSONObject.optString("activity_desc");
            this.e = jSONObject.optString("url");
            this.f = jSONObject.optString("title");
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel parcel, int i) {
            parcel.writeString(this.f3220a);
            parcel.writeString(this.f3221b);
            parcel.writeString(this.c);
            parcel.writeString(this.d);
            parcel.writeString(this.e);
            parcel.writeString(this.f);
        }
    }

    public class UpdateInfo implements Parcelable {

        public String f3222a;

        public String f3223b;
        public int c;

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel parcel, int i) {
            parcel.writeString(this.f3222a);
            parcel.writeString(this.f3223b);
            parcel.writeInt(this.c);
        }
    }

    public App() {
        this.ah = Config.INVALID_IP;
        this.aj = Config.INVALID_IP;
        this.ak = Config.INVALID_IP;
        this.aX = Config.INVALID_IP;
        this.aY = false;
        this.bi = 0;
        this.bj = 0;
        this.bk = Config.INVALID_IP;
        this.bl = 0;
        this.bo = Config.INVALID_IP;
        this.bp = Config.INVALID_IP;
        this.br = -1;
        this.ap = 0;
        this.ar = 0;
        this.as = "0";
        this.at = "0";
        this.av = 0;
        this.aw = Config.INVALID_IP;
        this.by = false;
        this.bA = true;
        this.ax = -1;
        this.ay = false;
        this.az = 0;
        this.aA = 0;
        this.aC = -1;
        this.aD = false;
        this.aE = false;
        this.aF = Config.INVALID_IP;
        this.aG = false;
        this.aH = Config.INVALID_IP;
        this.aK = Config.INVALID_IP;
        this.aL = Config.INVALID_IP;
        this.aM = Config.INVALID_IP;
        this.aN = Config.INVALID_IP;
        this.aO = Config.INVALID_IP;
        this.aP = Config.INVALID_IP;
        this.aQ = false;
        this.bD = false;
        this.bE = Config.INVALID_IP;
        this.bG = true;
        this.bI = 0;
        this.bJ = -1L;
        this.bI = 0;
        this.c = Config.INVALID_IP;
        this.al = Config.INVALID_IP;
        this.e = Config.INVALID_IP;
        this.ac = Config.INVALID_IP;
        this.ae = Config.INVALID_IP;
        this.f1444b = Config.INVALID_IP;
        this.j = Config.INVALID_IP;
        this.af = Config.INVALID_IP;
        this.g = Config.INVALID_IP;
        this.ag = Config.INVALID_IP;
        this.v = 0L;
        this.q = 0L;
        this.bb = Config.INVALID_IP;
        this.bc = 0L;
        this.bd = Config.INVALID_IP;
        this.ao = new String[0];
        this.ap = 0;
        this.bt = 0;
        this.ar = 0;
        this.as = "0";
        this.at = "0";
        this.av = 0;
        this.aw = Config.INVALID_IP;
    }

    public App(App app) {
        super(app);
        this.ah = Config.INVALID_IP;
        this.aj = Config.INVALID_IP;
        this.ak = Config.INVALID_IP;
        this.aX = Config.INVALID_IP;
        this.aY = false;
        this.bi = 0;
        this.bj = 0;
        this.bk = Config.INVALID_IP;
        this.bl = 0;
        this.bo = Config.INVALID_IP;
        this.bp = Config.INVALID_IP;
        this.br = -1;
        this.ap = 0;
        this.ar = 0;
        this.as = "0";
        this.at = "0";
        this.av = 0;
        this.aw = Config.INVALID_IP;
        this.by = false;
        this.bA = true;
        this.ax = -1;
        this.ay = false;
        this.az = 0;
        this.aA = 0;
        this.aC = -1;
        this.aD = false;
        this.aE = false;
        this.aF = Config.INVALID_IP;
        this.aG = false;
        this.aH = Config.INVALID_IP;
        this.aK = Config.INVALID_IP;
        this.aL = Config.INVALID_IP;
        this.aM = Config.INVALID_IP;
        this.aN = Config.INVALID_IP;
        this.aO = Config.INVALID_IP;
        this.aP = Config.INVALID_IP;
        this.aQ = false;
        this.bD = false;
        this.bE = Config.INVALID_IP;
        this.bG = true;
        this.bI = 0;
        this.bJ = -1L;
        this.al = app.al;
        this.ac = app.ac;
        this.ad = app.ad;
        this.ae = app.ae;
        this.af = app.af;
        this.ag = app.ag;
        this.ah = app.ah;
        this.ai = app.ai;
        this.aj = app.aj;
        this.ak = app.ak;
        this.aX = app.aX;
        this.aY = app.aY;
        this.aZ = app.aZ;
        this.ba = app.ba;
        this.bb = app.bb;
        this.bc = app.bc;
        this.bd = app.bd;
        this.bi = app.bi;
        this.bj = app.bj;
        this.bk = app.bk;
        this.ao = app.ao;
        this.bp = app.bp;
        this.bo = app.bo;
        this.ap = app.ap;
        this.bt = app.bt;
        this.ar = app.ar;
        this.J = app.J;
        this.as = app.as;
        this.at = app.at;
        this.av = app.av;
        this.aw = app.aw;
        this.az = app.az;
        this.aA = app.aA;
        this.aB = app.aB;
        this.aC = app.aC;
        this.bB = app.bB;
        this.P = app.P;
    }

    private String V(String str) {
        return TextUtils.isEmpty(str) ? Config.INVALID_IP : str.replaceAll("Version ", Config.INVALID_IP).replaceAll("Version", Config.INVALID_IP);
    }

    private JSONObject a(JSONObject jSONObject, String str) {
        if (jSONObject == null) {
            return null;
        }
        try {
            Iterator<String> keys = jSONObject.keys();
            while (keys.hasNext()) {
                String next = keys.next();
                for (String str2 : next.split("\\|\\|")) {
                    if (str2.equalsIgnoreCase(str)) {
                        return jSONObject.getJSONObject(next);
                    }
                }
            }
        } catch (Exception e) {
        }
        return null;
    }

    public static void a(ImageView imageView, int i) {
        a(imageView, i, MainActivity.e());
    }

    public static void a(ImageView imageView, int i, Context context) {
        if (aU == null && context != null) {
            aU = new Drawable[11];
            for (int i2 = 0; i2 < 11; i2++) {
                aU[i2] = new bu(context, i2, true);
            }
        }
        if (imageView == null || aU == null) {
            return;
        }
        imageView.setImageDrawable(aU[Math.min(aU.length - 1, i)]);
    }

    public com.qihoo.appstore.resource.a aH() {
        try {
            String str = "http://intf.zsall.mobilem.360.cn/zsintf/getMatchDownloadUrl?soft_id=" + this.f1444b + "&renew=1";
            if (com.qihoo360.mobilesafe.a.a.f5313a) {
                bk.b("apkdata", str);
            }
            HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(db.a(str)).openConnection();
            httpURLConnection.setDoInput(true);
            httpURLConnection.setRequestMethod("GET");
            httpURLConnection.setRequestProperty("Connection", "close");
            httpURLConnection.setRequestProperty("Charset", "UTF-8");
            httpURLConnection.setRequestProperty("accept", "*/*");
            httpURLConnection.addRequestProperty("Accept-Encoding", "gzip,deflate");
            httpURLConnection.setConnectTimeout(45000);
            httpURLConnection.setReadTimeout(45000);
            httpURLConnection.setRequestProperty("http.useragent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.125 Safari/533.4, 360appstore");
            httpURLConnection.connect();
            String headerField = httpURLConnection.getHeaderField("content-encoding");
            if (httpURLConnection.getResponseCode() == 200) {
                String str2 = new String(de.a("gzip".equals(headerField) ? new GZIPInputStream(httpURLConnection.getInputStream()) : httpURLConnection.getInputStream()));
                if (com.qihoo360.mobilesafe.a.a.f5313a) {
                    bk.b("apkdata", str2);
                }
                JSONObject jSONObject = new JSONObject(str2).getJSONObject("ret").getJSONObject("soft");
                this.bG = true;
                JSONObject jSONObject2 = jSONObject.getJSONObject("cpu");
                String a2 = ah.a(AppStoreApplication.d());
                if (com.qihoo360.mobilesafe.a.a.f5313a) {
                    bk.b("apkdata", "cpu:" + a2);
                }
                JSONObject a3 = a(jSONObject2.optJSONObject("white"), a2);
                if (a3 != null) {
                    return c(a3);
                }
                if (com.qihoo360.mobilesafe.a.a.f5313a) {
                    bk.b("apkdata", "sdk:" + Build.VERSION.SDK);
                }
                JSONObject a4 = a(jSONObject.getJSONObject("rom").optJSONObject("white"), Build.VERSION.SDK);
                if (a4 != null) {
                    return c(a4);
                }
                if (com.qihoo360.mobilesafe.a.a.f5313a) {
                    bk.b("apkdata", "model:" + Build.MODEL);
                }
                JSONObject a5 = a(jSONObject.getJSONObject("model").optJSONObject("white"), Build.MODEL);
                if (a5 != null) {
                    return c(a5);
                }
                JSONObject jSONObject3 = jSONObject.getJSONObject("pix");
                String a6 = l.a();
                if (com.qihoo360.mobilesafe.a.a.f5313a) {
                    bk.b("apkdata", "pix:" + a6);
                }
                JSONObject a7 = a(jSONObject3.optJSONObject("white"), a6);
                if (a7 != null) {
                    return c(a7);
                }
                JSONObject optJSONObject = jSONObject.optJSONObject("default");
                if (optJSONObject != null) {
                    return c(optJSONObject);
                }
            }
        } catch (Exception e) {
        }
        return null;
    }

    private com.qihoo.appstore.resource.a b(JSONObject jSONObject) {
        try {
            com.qihoo.appstore.resource.a aVar = new com.qihoo.appstore.resource.a();
            aVar.o(Y() + AppStoreApplication.d().getString(R.string.data_pkg));
            String string = jSONObject.getString("download_url");
            aVar.q(string);
            aVar.s(this.g);
            aVar.a(this);
            aVar.b(Long.parseLong(jSONObject.optString("package_size", "10000")));
            aVar.y("/" + jSONObject.getString("apk_save_path").replace("\\", "/") + string.substring(string.lastIndexOf("/")));
            if (com.qihoo360.mobilesafe.a.a.f5313a) {
                bk.b("apkdata", "osavepath=" + aVar.S());
            }
            if (com.qihoo360.mobilesafe.a.a.f5313a) {
                bk.b("apkdata", "osize=" + aVar.Z());
            }
            if (!com.qihoo360.mobilesafe.a.a.f5313a) {
                return aVar;
            }
            bk.b("apkdata", "odstpath=" + aVar.aI());
            return aVar;
        } catch (Exception e) {
            bk.e("apkdata", e.toString());
            return null;
        }
    }

    public static void b(ImageView imageView, int i) {
        MainActivity e = MainActivity.e();
        if (aV == null && e != null) {
            aV = new Drawable[11];
            for (int i2 = 0; i2 < 11; i2++) {
                aV[i2] = new bu(e, i2, false);
            }
        }
        if (imageView == null || aV == null) {
            return;
        }
        imageView.setImageDrawable(aV[Math.min(aV.length - 1, i)]);
    }

    private com.qihoo.appstore.resource.a c(JSONObject jSONObject) {
        try {
            com.qihoo.appstore.resource.a aVar = new com.qihoo.appstore.resource.a();
            aVar.o(Y() + AppStoreApplication.d().getString(R.string.data_pkg));
            String string = jSONObject.getString("download_url");
            String string2 = jSONObject.getString("durl");
            if (!string2.replace("\\/", "/").contains(af())) {
                if (!com.qihoo360.mobilesafe.a.a.f5313a) {
                    return null;
                }
                bk.b("apkdata", "url is error: " + string2.replace("\\/", "/") + " || " + af());
                return null;
            }
            aVar.q(string);
            aVar.s(this.g);
            aVar.a(this);
            aVar.b(Long.parseLong(jSONObject.optString("package_size", "10000")));
            aVar.y("/" + jSONObject.getString("apk_save_path").replace("\\", "/") + string.substring(string.lastIndexOf("/")));
            if (com.qihoo360.mobilesafe.a.a.f5313a) {
                bk.b("apkdata", "savepath=" + aVar.S());
            }
            if (com.qihoo360.mobilesafe.a.a.f5313a) {
                bk.b("apkdata", "size=" + aVar.Z());
            }
            if (com.qihoo360.mobilesafe.a.a.f5313a) {
                bk.b("apkdata", "dstpath=" + aVar.aI());
            }
            File file = new File(aVar.aI());
            if (file.exists()) {
                if (!com.qihoo360.mobilesafe.a.a.f5313a) {
                    return null;
                }
                bk.b("apkdata", "apkdata exist");
                return null;
            }
            if (!de.a(file.getParent())) {
                if (!com.qihoo360.mobilesafe.a.a.f5313a) {
                    return null;
                }
                bk.b("apkdata", "create dst dir failed: " + aVar.aI());
                return null;
            }
            if (file.createNewFile()) {
                return aVar;
            }
            if (!com.qihoo360.mobilesafe.a.a.f5313a) {
                return null;
            }
            bk.b("apkdata", "create dst file failed: " + aVar.aI());
            return null;
        } catch (Exception e) {
            bk.e("apkdata", e.toString());
            return null;
        }
    }

    private void i(int i) {
        this.bI |= i;
    }

    private void i(Context context) {
        boolean z;
        PackageInfo packageArchiveInfo;
        try {
            boolean z2 = (!com.qihoo.appstore.utils.f.c(context) || b() || RTServiceManager.getRTService() == null) ? false : true;
            boolean z3 = this.K && y();
            Object[] objArr = new Object[5];
            objArr[0] = W();
            objArr[1] = Boolean.valueOf(this.K);
            objArr[2] = Boolean.valueOf(y());
            objArr[3] = Boolean.valueOf(!DaemonCoreService.b());
            objArr[4] = Boolean.valueOf(MainActivity.e() != null);
            z.a("INSTALL APP %s autoInstallIfRooted=%s , isSlientTask=%s not timeIsOKForInstallSilentUpdate=%s MainActivity is not null=%s...", objArr);
            if (z3 && !DaemonCoreService.b() && MainActivity.e() != null) {
                if (com.qihoo360.mobilesafe.a.a.f5313a) {
                    bk.b("installDownload", "time is not ok for silent install silent task");
                }
                z.a("INSTALL APP %s,return, time is not ok", W());
                return;
            }
            int R = y() ? R() : by();
            if (TextUtils.equals(this.j, context.getPackageName()) && (packageArchiveInfo = context.getPackageManager().getPackageArchiveInfo(this.m, 0)) != null && packageArchiveInfo.packageName != null && !TextUtils.equals(this.j, packageArchiveInfo.packageName)) {
                if (com.qihoo360.mobilesafe.a.a.f5313a) {
                    Log.e("installDownload", "忽略,因为apk已经被替换");
                }
                new File(this.m).delete();
                z.a("INSTALL APP %s,return, apk is not ok", W());
                return;
            }
            if (com.qihoo360.mobilesafe.a.a.f5313a) {
                bk.b("installDownload", "PackageName: " + W() + ", needSilentInstall=" + z3 + ", silentlyInstall=" + z2 + " , needNormalInstall=" + D());
            }
            if (z2 && cw.f(R) && !D()) {
                z.a("INSTALL APP %s,installSilently", W());
                bk();
                z = true;
            } else if (z3) {
                z.a("INSTALL APP %s,noInstall ", W());
                return;
            } else {
                z.a("INSTALL APP %s,normalInstall", W());
                b(context);
                z = false;
            }
            PushMessageHandle.a(bI(), z);
            com.qihoo.appstore.e.c.a.a(context, "para1", "&type=begin&pkg=" + bI() + "&installType=" + (z ? 1 : 0));
        } catch (Exception e) {
            z.a(e, "INSTALL APP %s,installDownload FAIL", W());
        }
    }

    private void r(int i) {
        this.bI &= i ^ (-1);
    }

    public void A(String str) {
        this.bo = str;
    }

    public void B(String str) {
        this.bp = str;
    }

    public void C(String str) {
        this.bC = str;
    }

    public void D(String str) {
        this.bh = str;
        if ("book".equals(str) || "ebook".equals(str)) {
            H();
        } else if ("game".equals(str)) {
            F();
        }
    }

    public void E(String str) {
        this.bm = str;
    }

    public void F(String str) {
        this.bg = str;
    }

    public void G(String str) {
        this.bn = str;
    }

    public void H(String str) {
        this.bE = str;
    }

    public void I(String str) {
        this.aj = str;
    }

    public void J(String str) {
        this.ak = str;
    }

    public void K(String str) {
        this.ba = str;
    }

    public void L(String str) {
        this.aX = str;
    }

    public void M(String str) {
        this.ah = str;
    }

    public void N(String str) {
        this.ai = str;
    }

    public void O(String str) {
        this.bb = str;
    }

    public void P(String str) {
        this.bd = str;
    }

    public void Q(String str) {
        this.al = str;
    }

    public void R(String str) {
        this.ac = V(str);
    }

    public void S(String str) {
        this.ae = str;
    }

    public void T(String str) {
        this.af = str;
    }

    public void U(String str) {
        this.ag = str;
    }

    @Override
    public String Y() {
        return this.c;
    }

    @Override
    public long Z() {
        return (bC() && by() == 200) ? bw() : super.Z();
    }

    @Override
    public int compareTo(App app) {
        long bL = bL() - app.bL();
        if (bL == 0) {
            return 0;
        }
        if (bL < 0) {
            return 1;
        }
        return bL > 0 ? -1 : 0;
    }

    @Override
    public void a(Context context) {
        try {
            i(context);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void a(i iVar) {
        this.bx = iVar;
    }

    public void a(k kVar) {
        this.bv = kVar;
    }

    public void a(JSONObject jSONObject) {
        try {
            if (jSONObject.optString("type", "soft").equalsIgnoreCase("game")) {
                F();
            }
            if (jSONObject.optString("needapkdata", "0").equals("1")) {
                bh();
            }
            if (jSONObject.optString("is_recommand", "0").equals("1")) {
                this.bD = true;
            }
            String optString = jSONObject.optString("ad_code");
            if (!TextUtils.isEmpty(optString)) {
                this.aT = optString;
                b("ad_code=" + optString);
            }
            try {
                JSONArray optJSONArray = jSONObject.optJSONArray("alert");
                if (optJSONArray != null) {
                    String[] strArr = new String[optJSONArray.length()];
                    for (int i = 0; i < optJSONArray.length(); i++) {
                        strArr[i] = optJSONArray.getString(i);
                    }
                    a(strArr);
                }
                this.as = jSONObject.optString("list_show_anva_white");
                this.at = jSONObject.optString("detail_show_anva_white");
                this.aw = jSONObject.optString("logo_url_160");
                this.P = jSONObject.optString("is_g");
            } catch (Exception e) {
            }
            this.bE = jSONObject.optString("apk_md5", Config.INVALID_IP);
        } catch (Exception e2) {
        }
    }

    public void a(String[] strArr) {
        this.ao = strArr;
    }

    @Override
    public boolean aD() {
        return true;
    }

    public boolean aI() {
        return this.bz;
    }

    public boolean aJ() {
        return this.by;
    }

    public i aK() {
        return this.bx;
    }

    public String aL() {
        return this.bw;
    }

    public k aM() {
        return this.bv;
    }

    public String aN() {
        return this.bq;
    }

    public int aO() {
        return this.an;
    }

    public String aP() {
        return this.bo;
    }

    public boolean aQ() {
        return "1".equalsIgnoreCase(this.bC);
    }

    public String aR() {
        return this.bh;
    }

    public boolean aS() {
        return this.bD;
    }

    public String aT() {
        return this.bm;
    }

    public int aU() {
        return this.bl;
    }

    public String aV() {
        return this.be;
    }

    public String aW() {
        return this.bf;
    }

    public String aX() {
        return this.bg;
    }

    public String aY() {
        return this.bn;
    }

    public boolean aZ() {
        return (bJ() || this.bF == null) ? false : true;
    }

    @Override
    public long ac() {
        return Z();
    }

    @Override
    public String ad() {
        return this.d;
    }

    @Override
    public String ah() {
        return TextUtils.isEmpty(this.g) ? this.aw : this.g;
    }

    @Override
    public boolean ay() {
        return (TextUtils.isEmpty(this.bE) || bC()) ? false : true;
    }

    @Override
    public boolean az() {
        return aa() == 0 && ar() && ac() > 0 && !w() && !x() && !l();
    }

    @Override
    public void b(long j) {
        super.b(j);
        this.be = de.b(AppStoreApplication.d(), j);
    }

    public void b(Context context) {
        Bundle bundle = new Bundle();
        bundle.putString("installPath", this.m);
        bundle.putString("pkg", this.j);
        com.qihoo.appstore.install.a.a.a().a(context, bundle);
    }

    public long bA() {
        if (bC()) {
            return this.q;
        }
        return 0L;
    }

    public boolean bB() {
        return bC() && by() != 200;
    }

    public boolean bC() {
        boolean z;
        com.qihoo.appstore.f.f j;
        try {
            j = com.qihoo.appstore.f.g.j(W());
        } catch (Exception e) {
            bk.d("zy needMerge", "needMerge=" + e.getMessage(), e);
        }
        if (j != null && j.v != this && ((App) j.v).bF() == bF()) {
            z = ((App) j.v).bC();
        } else if (!PatchUtil.a() || TextUtils.isEmpty(bx()) || this.e == null || !this.e.endsWith(".patch")) {
            if (this.e != null && this.e.endsWith(".patch")) {
                z = true;
            }
            z = false;
        } else {
            z = true;
        }
        return z;
    }

    public String bD() {
        return this.al;
    }

    public String bE() {
        return this.ac;
    }

    public int bF() {
        return this.ad;
    }

    public String bG() {
        return this.ae;
    }

    public String bH() {
        return this.af;
    }

    public String bI() {
        String W = W();
        return (W.indexOf(TraceFileUtil.FILE_EXTENSION_SEPARATOR) >= 0 || TextUtils.isEmpty(p())) ? W : p();
    }

    public boolean bJ() {
        return com.qihoo.appstore.l.d.c(bI());
    }

    public String bK() {
        return this.ag;
    }

    public long bL() {
        if (this.bJ != -1) {
            return this.bJ;
        }
        try {
            String[] split = this.af.split("-");
            int parseInt = Integer.parseInt(split[2]);
            int parseInt2 = Integer.parseInt(split[1]);
            int parseInt3 = Integer.parseInt(split[0]) - 1900;
            Date date = new Date(0L);
            date.setDate(parseInt);
            date.setMonth(parseInt2 - 1);
            date.setYear(parseInt3);
            this.bJ = date.getTime();
            return this.bJ;
        } catch (Exception e) {
            return 0L;
        }
    }

    public boolean bM() {
        return this.bN;
    }

    public List bN() {
        ArrayList arrayList = new ArrayList();
        if (this.aR != null && !TextUtils.isEmpty(this.aR.v)) {
            String[] split = this.aR.v.split(",");
            String[] split2 = this.aR.w.split(",");
            String[] split3 = this.aR.u.split(",");
            String[] split4 = this.aR.x.split(",");
            String[] split5 = this.aR.y.split(",");
            String[] split6 = this.aR.z.split(",");
            int a2 = de.a(split.length, split2.length, split3.length, split4.length, split5.length, split6.length);
            for (int i = 0; i < a2; i++) {
                f fVar = new f();
                fVar.f3227a = split[i];
                fVar.f3228b = split2[i];
                fVar.c = split4[i];
                fVar.d = split5[i];
                fVar.e = split6[i];
                long j = 0;
                try {
                    j = Long.valueOf(de.b(split3[i])).longValue();
                } catch (Exception e) {
                }
                fVar.f = j;
                arrayList.add(fVar);
            }
        }
        return arrayList;
    }

    public String[] bO() {
        return this.ao;
    }

    public String bP() {
        return this.aT;
    }

    public boolean bQ() {
        return this.bs;
    }

    public boolean bR() {
        return this.bB;
    }

    public int bS() {
        return this.aI;
    }

    public boolean ba() {
        return this.bF != null || this.bG;
    }

    public com.qihoo.appstore.resource.a bb() {
        return this.bF;
    }

    public boolean bc() {
        return this.bt > 0 && this.bt > s.f4410a;
    }

    public String bd() {
        return s.a(this.bt);
    }

    public int be() {
        return this.bt;
    }

    public String bf() {
        return this.bE;
    }

    public long bg() {
        try {
            File file = new File(this.m);
            if (file.exists()) {
                return file.length();
            }
            return 0L;
        } catch (Exception e) {
            return 0L;
        }
    }

    public void bh() {
        this.bG = false;
    }

    public void bi() {
        if (ba()) {
            return;
        }
        bw.a("App", new a(this)).start();
    }

    public boolean bj() {
        return com.qihoo.appstore.f.g.j(com.qihoo.appstore.resource.a.b(this)) != null;
    }

    public void bk() {
        if (com.qihoo360.mobilesafe.a.a.f5313a) {
            bk.b("installSilently", "begin install");
        }
        String p = (!am() || TextUtils.isEmpty(p())) ? this.j : p();
        Bundle bundle = new Bundle();
        bundle.putString("installPath", this.m);
        bundle.putString("apk", p);
        bundle.putString("name", this.c);
        bundle.putInt("versionCode", this.ad);
        if (!TextUtils.isEmpty(this.am)) {
            bundle.putString("installDst", this.am);
        }
        if (!y()) {
            String d = com.qihoo.appstore.utils.f.d(AppStoreApplication.d());
            if (!d.equals("default") && !d.equals(this.am)) {
                if (this.am.equals("-f")) {
                    com.qihoo.appstore.f.g.n(AppStoreApplication.d().getString(R.string.installing_2_memory));
                } else {
                    com.qihoo.appstore.f.g.n(AppStoreApplication.d().getString(R.string.installing_2_sdcard));
                }
            }
        } else if (com.qihoo360.mobilesafe.a.a.f5313a) {
            bk.a("正在秒装 " + this.j);
        }
        bundle.putBoolean("exist", com.qihoo.appstore.l.d.c(p));
        if (com.qihoo360.mobilesafe.a.a.f5313a) {
            bk.b("installSilently", "packageName=" + W() + ", installParams=" + bundle);
        }
        com.qihoo.appstore.install.silently.a.a(bundle, this);
    }

    public int bl() {
        return this.bj;
    }

    public String bm() {
        return this.bL;
    }

    public String bn() {
        return this.aj;
    }

    public String bo() {
        return this.ak;
    }

    public String bp() {
        return this.ba;
    }

    public int bq() {
        return this.aZ;
    }

    public boolean br() {
        return this.aY;
    }

    public String bs() {
        return this.aX;
    }

    public String bt() {
        return this.ah;
    }

    public String bu() {
        return this.ai;
    }

    public String bv() {
        return this.bb;
    }

    public long bw() {
        return this.bc;
    }

    public String bx() {
        return this.bd;
    }

    public int by() {
        com.qihoo.appstore.f.f j = com.qihoo.appstore.f.g.j(W());
        if (j != null) {
            if (this == j.v) {
                return this.p;
            }
            if (((App) j.v).bF() == bF()) {
                return j.l();
            }
        }
        return -2;
    }

    public long bz() {
        if (bC()) {
            return this.bc - this.q;
        }
        return 0L;
    }

    public void c(Context context) {
        long bz = bz();
        if (bz <= 0) {
            return;
        }
        if (c() || !b()) {
            AppStoreApplication.f593a.post(new b(this, context, context.getString(R.string.predict_save) + de.b(context, bz) + context.getString(R.string.no_flow)));
        }
    }

    public String d(Context context) {
        com.qihoo.appstore.l.a.c d = com.qihoo.appstore.l.d.d(context, W());
        return d == null ? Config.INVALID_IP : d.n();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void e(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        try {
            JSONObject jSONObject = new JSONObject(str);
            this.bH = jSONObject.optJSONObject("apkdata");
            if (this.bH != null) {
                this.bF = b(this.bH);
            }
            this.bG = jSONObject.optBoolean("haveFetchedMatchData", false);
            this.K = jSONObject.optBoolean("autoInstallIfRooted", false);
            this.bE = jSONObject.optString("wholeMd5", Config.INVALID_IP);
            this.ab = jSONObject.optInt("slientdownloadtime", 0);
            this.aE = jSONObject.optBoolean("startFromUpdateSilent", false);
            this.C = jSONObject.optString("log", Config.INVALID_IP);
            if (com.qihoo360.mobilesafe.a.a.f5313a) {
                bk.b("extradata", "extra1:" + str);
            }
        } catch (Exception e) {
        }
    }

    public boolean e(Context context) {
        if (com.qihoo.appstore.l.d.c(W())) {
            String f = de.f(context, W());
            bk.c("signature", W() + ":" + f + ":" + this.ag);
            if (!"sign_md5_default_value".equals(this.ag) && !Config.INVALID_IP.equals(this.ag) && !de.a(context, f, this.ag)) {
                return false;
            }
        }
        return true;
    }

    public boolean f(Context context) {
        String[] g = de.g(context, this.m);
        String str = g == null ? null : g[0];
        bk.b("signature", "signature for " + this.m + " is " + str);
        if (g != null) {
            bk.b("signature", "packageName: " + g[1]);
        }
        for (String str2 : bM) {
            if (str2.equalsIgnoreCase(str)) {
                return true;
            }
        }
        return false;
    }

    @Override
    public void g(long j) {
        super.g(j);
        this.bg = de.d(AppStoreApplication.d(), j);
    }

    public boolean g(Context context) {
        String[] g = de.g(context, this.m);
        String str = g == null ? null : g[0];
        if ("sign_md5_default_value".equals(this.ag) || Config.INVALID_IP.equals(this.ag) || de.a(context, str, this.ag)) {
            return true;
        }
        this.bL = g != null ? g[1] : null;
        return false;
    }

    public void h(long j) {
        this.bc = j;
        this.bf = de.b(AppStoreApplication.d(), j);
    }

    public boolean h(Context context) {
        com.qihoo.appstore.l.a.c d;
        return (com.qihoo.appstore.l.d.c(context, bI(), bF()) || (d = com.qihoo.appstore.l.d.d(context, bI())) == null || d.k() >= bF()) ? false : true;
    }

    public void j(int i) {
        this.br = i;
        this.bq = de.a((Context) AppStoreApplication.d(), i);
    }

    @Override
    public void j(String str) {
        this.m = str;
    }

    public void k(int i) {
        this.an = i;
    }

    public void l(int i) {
        this.bl = i;
    }

    public void l(boolean z) {
        this.bA = z;
    }

    public void m(int i) {
        this.bt = i;
    }

    public void m(boolean z) {
        this.by = z;
    }

    public void n(int i) {
        this.bj = i;
    }

    public void n(boolean z) {
        this.aY = z;
    }

    @Override
    public String o() {
        try {
            JSONObject jSONObject = new JSONObject();
            if (this.bH != null) {
                jSONObject.put("apkdata", this.bH);
            }
            jSONObject.put("haveFetchedMatchData", this.bG);
            jSONObject.put("wholeMd5", this.bE);
            jSONObject.put("slientdownloadtime", this.ab);
            jSONObject.put("log", this.C);
            jSONObject.put("autoInstallIfRooted", this.K);
            jSONObject.put("startFromUpdateSilent", this.aE);
            return jSONObject.toString();
        } catch (Exception e) {
            return Config.INVALID_IP;
        }
    }

    public void o(int i) {
        this.aZ = i;
    }

    @Override
    public void o(String str) {
        this.c = str;
    }

    public void o(boolean z) {
        if (z) {
            i(1);
        } else {
            r(1);
            r(2);
        }
    }

    public void p(int i) {
        this.ad = i;
    }

    @Override
    public void p(String str) {
        this.d = str;
    }

    public void p(boolean z) {
        if (z) {
            i(2);
        } else {
            r(2);
        }
    }

    public void q(int i) {
        this.aI = i;
    }

    public void q(boolean z) {
        this.bN = z;
    }

    public void r(boolean z) {
        this.bs = z;
    }

    public void s(boolean z) {
        this.bB = z;
    }

    public String toString() {
        return "App [id=" + this.f1444b + ", name=" + this.c + ", baike_name=" + this.al + ", path=" + this.e + ", version=" + this.ac + ", versionCode=" + this.ad + ", newFeature=" + this.ae + ", ApkId=" + this.j + ", date=" + this.af + ", icon=" + this.g + ", md5h=" + this.ag + ", rating=" + this.n + ", downloadCount=" + this.v + ", size=" + this.q + ", categoryBrief=" + this.i + ", promote=" + this.ah + ", largeLogoUrl=" + this.ai + ", isBigBanner=" + this.aj + ", categoryGroup=" + this.ak + ", category=" + this.aX + ", categoryCode=" + this.d + ", isSelected=" + this.aY + ", softOrder=" + this.aZ + ", lable=" + this.ba + ", marketId=" + this.k + ", marketName=" + this.l + ", mDownloadStatus=" + this.p + ", mCurrentBytes=" + this.r + ", mTotalBytes=" + this.t + ", otherFlag=" + this.w + ", mSavedPath=" + this.m + ", downLine=" + this.bi + ", makeInstall=" + this.bj + ", installFailuerType=" + this.bk + ", mAppDetail=" + this.aR + ", installedStatus=" + this.bI + ", bPackage=" + this.o + ", time=" + this.bJ + ", msg=" + this.bK + ", apkMD5=" + this.bb + ", wholeApkSize=" + this.bc + ", wholeApkUrl=" + this.bd + "bannerOpenUrl=" + this.bm + "type=" + this.bh + "iswebgame=" + this.ap + ", minSdkVersion=" + this.bt + "]";
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeString(this.c);
        parcel.writeString(this.al);
        parcel.writeString(this.e);
        parcel.writeString(this.ac);
        parcel.writeInt(this.ad);
        parcel.writeString(this.ae);
        parcel.writeString(this.f1444b);
        parcel.writeString(this.j);
        parcel.writeString(this.g);
        parcel.writeString(this.af);
        parcel.writeString(this.ag);
        parcel.writeInt(this.n);
        parcel.writeInt(this.o);
        parcel.writeInt(this.bI);
        parcel.writeLong(this.q);
        parcel.writeString(this.i);
        parcel.writeString(this.ah);
        parcel.writeString(this.ai);
        parcel.writeString(this.aX);
        parcel.writeInt(this.aZ);
        parcel.writeLong(this.v);
        parcel.writeString(this.ba);
        parcel.writeString(this.k);
        parcel.writeString(this.l);
        parcel.writeString(this.aj);
        parcel.writeString(this.ak);
        parcel.writeInt(this.bi);
        parcel.writeInt(this.bj);
        parcel.writeString(this.bk);
        parcel.writeString(this.d);
        parcel.writeString(this.bb);
        parcel.writeLong(this.bc);
        parcel.writeString(this.bd);
        parcel.writeString(this.be);
        parcel.writeString(this.bf);
        parcel.writeInt(this.bl);
        parcel.writeString(this.bm);
        parcel.writeString(this.bh);
        parcel.writeStringArray(this.ao);
        parcel.writeString(this.bp);
        parcel.writeString(this.bo);
        parcel.writeInt(this.D);
        parcel.writeString(this.E);
        if (this.aR != null) {
            parcel.writeInt(1);
            this.aR.writeToParcel(parcel, i);
        } else {
            parcel.writeInt(0);
        }
        parcel.writeString(this.aT);
        parcel.writeInt(this.ap);
        parcel.writeInt(this.bt);
        parcel.writeInt(this.ar);
        parcel.writeString(this.as);
        parcel.writeString(this.at);
        parcel.writeInt(this.av);
        parcel.writeString(this.aw);
        if (this.aJ != null) {
            parcel.writeInt(1);
            this.aJ.writeToParcel(parcel, i);
        } else {
            parcel.writeInt(0);
        }
        parcel.writeInt(this.az);
        parcel.writeInt(this.aA);
        parcel.writeInt(this.aB);
        parcel.writeInt(this.aC);
        parcel.writeString(this.P);
        parcel.writeString(this.Q);
    }

    public void y(String str) {
        this.bw = str;
    }

    public void z(String str) {
        this.bu = str;
    }
}