QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

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


package c.t.m.g;

import android.content.Context;
import com.xiaomi.mipush.sdk.Constants;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class ev {

    private String f1573a = "ModuleUpadateImpl";

    private Context f1574b;

    public ev(Context context) {
        this.f1574b = context;
    }

    private boolean a(String str, ew ewVar) {
        File file;
        try {
            file = new File(str, ewVar.e + "." + ewVar.f);
        } catch (Exception e) {
            if (ey.f1586a) {
                ey.a(this.f1573a, e);
            }
        }
        if (!file.exists()) {
            if (ey.f1586a) {
                ey.b(this.f1573a, "checkIsDownLoadMoudle path is not exists," + file.getAbsolutePath());
            }
            return false;
        }
        long length = file.length();
        String a2 = fj.a(file);
        if (a2 != null && ewVar.f1578d == length && ewVar.e.equals(a2)) {
            if (!ey.f1586a) {
                return true;
            }
            ey.a(this.f1573a, "module to download is same to update dir ,so donot to download " + ewVar);
            return true;
        }
        return false;
    }

    private boolean a(String str, byte[] bArr, ew ewVar) {
        if (bArr == null || bArr.length == 0) {
            if (ey.f1586a) {
                ey.a(this.f1573a, "write to this path with data null," + str);
            }
            return false;
        }
        if (!new fi(str).a(bArr, false)) {
            if (ey.f1586a) {
                ey.a(this.f1573a, "write to this path failed !!!," + str);
            }
            return false;
        }
        String a2 = fj.a(new File(str));
        if (a2 == null || !ewVar.e.equals(a2)) {
            if (ey.f1586a) {
                ey.a(this.f1573a, "check data from server failed !!!," + str);
            }
            return false;
        }
        if (!ey.f1586a) {
            return true;
        }
        ey.a(this.f1573a, "download and check data from server success !!!," + str);
        return true;
    }

    private List<ew> b(List<ew> list, List<ew> list2) {
        boolean z;
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < list.size(); i++) {
            ew ewVar = list.get(i);
            int i2 = 0;
            while (true) {
                if (i2 >= list2.size()) {
                    z = false;
                    break;
                }
                if (ewVar.f1575a == list2.get(i2).f1575a) {
                    arrayList.add(list2.get(i2));
                    z = true;
                    break;
                }
                i2++;
            }
            if (!z) {
                arrayList.add(ewVar);
            }
        }
        return arrayList;
    }

    private synchronized boolean c(List<ew> list, List<ew> list2) {
        long d2 = fj.d();
        if (d2 < 10485760) {
            if (ey.f1586a) {
                ey.a(this.f1573a, "Not enough storage, cancel!");
            }
            eo.a().a("MDS", "NoSpaceEnough," + d2);
            return false;
        }
        String b2 = fj.b(this.f1574b, "TMLSDK_hp");
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < list.size(); i++) {
            ew ewVar = list.get(i);
            if (a(b2, ewVar)) {
                arrayList.add(ewVar);
                eo.a().a("MDS", "already," + ewVar.f1577c);
            } else {
                if (ey.f1586a) {
                    ey.b(this.f1573a, "current download module is " + ewVar.toString());
                }
                try {
                    String str = "https://maplbs-40171.sh.gfp.tencent-cloud.com/modules/" + ewVar.e;
                    if (ey.f1586a) {
                        ey.a(this.f1573a, "dex down load url is " + str);
                    }
                    byte[] a2 = fc.a(str);
                    if (a2 != null) {
                        boolean a3 = a(b2 + File.separator + ewVar.e + "." + ewVar.f, fj.a(fb.b(a2, fj.a("m_plugin_pwd", ff.n))), ewVar);
                        if (ey.f1586a) {
                            ey.a(this.f1573a, "down load so check result:" + a3);
                        }
                        eo.a().a("MDS", "download res," + a3 + Constants.ACCEPT_TIME_SEPARATOR_SP + ewVar.f1577c);
                        if (a3) {
                            arrayList.add(ewVar);
                        }
                    } else {
                        eo.a().a("MDS", "netError");
                        if (ey.f1586a) {
                            ey.a(this.f1573a, "down load module failed!!!," + str);
                        }
                    }
                } catch (Throwable th) {
                    if (ey.f1586a) {
                        ey.a(this.f1573a, th);
                    }
                }
            }
        }
        if (ey.f1586a) {
            String str2 = this.f1573a;
            StringBuilder sb = new StringBuilder();
            sb.append("all module download ");
            sb.append(list.size() == arrayList.size());
            ey.a(str2, sb.toString());
            ey.a(this.f1573a, "start rename download files");
        }
        eo.a().a("MDS", "should download," + list.size() + ",real download suc," + arrayList.size());
        if (list.size() != arrayList.size()) {
            return false;
        }
        String a4 = fj.a(b(list2, arrayList));
        boolean a5 = fj.a(this.f1574b, "SP_TMLSDK_MODULE_INFO", a4);
        if (ey.f1586a) {
            ey.b(this.f1573a, "module update success desc " + a4);
        }
        eo.a().a("MDS", "update result," + a5 + Constants.ACCEPT_TIME_SEPARATOR_SP + a4);
        return true;
    }

    public void a(List<ew> list, List<ew> list2) {
        try {
            fh.a(this.f1574b).a("update");
            for (int i = 0; i < 3; i++) {
                boolean c2 = c(list, list2);
                if (ey.f1586a) {
                    ey.a(this.f1573a, "down load new module result " + c2 + ", retry " + i);
                }
                if (c2) {
                    break;
                }
            }
            fh.a(this.f1574b).b("update");
            eo.a().d();
        } catch (Throwable th) {
            if (ey.f1586a) {
                ey.a(this.f1573a, th);
            }
        }
    }
}