WeChat.apk(点击下载) / c.java


package y63;

import android.text.TextUtils;
import android.util.SparseArray;
import bw3.mc3;
import com.tencent.mars.cdn.CdnLogic;
import com.tencent.mm.R;
import com.tencent.mm.memory.n;
import com.tencent.mm.plugin.mmsight.segment.FFmpegMetadataRetriever;
import com.tencent.mm.plugin.report.service.q;
import com.tencent.mm.plugin.sns.model.f;
import com.tencent.mm.plugin.sns.model.f1;
import com.tencent.mm.plugin.sns.model.p;
import com.tencent.mm.plugin.sns.model.p2;
import com.tencent.mm.plugin.sns.ui.monitor.SnsMethodCalculate;
import com.tencent.mm.pluginsdk.model.a1;
import com.tencent.mm.sdk.http.HttpWrapperBase;
import com.tencent.mm.sdk.platformtools.ConnectivityCompat;
import com.tencent.mm.sdk.platformtools.Log;
import com.tencent.mm.sdk.platformtools.MMApplicationContext;
import com.tencent.mm.sdk.platformtools.NetStatusUtil;
import com.tencent.mm.sdk.platformtools.Util;
import com.tencent.mm.sdk.platformtools.WeChatHosts;
import com.tencent.mm.storage.o3;
import com.tencent.mm.vfs.u1;
import com.tencent.xweb.XWebFeature;
import d60.z;
import e73.j;
import e73.l;
import ie1.h;
import java.io.ByteArrayOutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import lh0.v;
import lh4.m;
import m60.d;
import p63.b0;
import p63.r;
import p63.w;
import vi.e;
import vi.f;
import vi.g;
import vi.h;
import vi.i;

public abstract class c extends a1<String, Integer, Integer> {

    /* renamed from: l  reason: collision with root package name */
    public static HashSet<String> f343826l = new HashSet<>();

    /* renamed from: c  reason: collision with root package name */
    public b f343827c;

    /* renamed from: d  reason: collision with root package name */
    public n f343828d = null;

    /* renamed from: e  reason: collision with root package name */
    public SparseArray<n> f343829e = new SparseArray<>();

    /* renamed from: f  reason: collision with root package name */
    public a f343830f;

    /* renamed from: g  reason: collision with root package name */
    public mc3 f343831g = null;

    /* renamed from: h  reason: collision with root package name */
    public long f343832h = -1;

    /* renamed from: i  reason: collision with root package name */
    public int f343833i = -1;

    /* renamed from: j  reason: collision with root package name */
    public int f343834j = 0;

    /* renamed from: k  reason: collision with root package name */
    public String f343835k = "";

    public class a implements i.a {

        /* renamed from: d  reason: collision with root package name */
        public final /* synthetic */ h f343836d;

        /* renamed from: e  reason: collision with root package name */
        public final /* synthetic */ long f343837e;

        /* renamed from: y63.c$a$a  reason: collision with other inner class name */
        public class RunnableC6280a implements Runnable {

            /* renamed from: d  reason: collision with root package name */
            public final /* synthetic */ String f343839d;

            /* renamed from: e  reason: collision with root package name */
            public final /* synthetic */ int f343840e;

            /* renamed from: f  reason: collision with root package name */
            public final /* synthetic */ f f343841f;

            public RunnableC6280a(String str, int i15, f fVar) {
                this.f343839d = str;
                this.f343840e = i15;
                this.f343841f = fVar;
            }

            public void run() {
                int i15;
                int i16;
                SnsMethodCalculate.markStartTimeMs("run", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase$1$1");
                a aVar = a.this;
                if (9 == c.this.f343830f.f343797f) {
                    g gVar = (g) aVar.f343836d;
                    if (gVar.f326316b1 == gVar.f326318d1) {
                        c.g().remove(c.this.f343830f.e());
                    }
                } else {
                    c.g().remove(c.this.f343830f.e());
                }
                w wVar = c.this.f343830f.f343799h;
                if (wVar == null) {
                    i15 = -1;
                } else {
                    i15 = wVar.a();
                }
                a aVar2 = c.this.f343830f;
                Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]download done result: %d, url:%s, mediaID:%s, totalSize: %d, runningTasksSize: %d decodetype:%d", "[image-flow]", this.f343839d, Integer.valueOf(this.f343840e), aVar2.f343794c, aVar2.f343793b, Long.valueOf(this.f343841f.field_fileLength), Integer.valueOf(c.g().size()), Integer.valueOf(i15));
                a aVar3 = c.this.f343830f;
                boolean z15 = aVar3.f343795d;
                if (!z15 || this.f343840e == 2) {
                    if (!z15 && ((i16 = aVar3.f343797f) == 4 || i16 == 6)) {
                        f1.gO0().F(c.this.f343830f.f343793b, c.this.f343830f.c() + b0.S(c.this.f343831g));
                    }
                } else if (9 == aVar3.f343797f) {
                    p2.e(aVar3.f343807p.get(this.f343841f.f326307h).f29560d, c.this.f343830f.f343805n);
                    c cVar = c.this;
                    int i17 = this.f343841f.f326307h;
                    cVar.getClass();
                    SnsMethodCalculate.markStartTimeMs("thumbAddDecode", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                    if (f1.RO0()) {
                        SnsMethodCalculate.markEndTimeMs("thumbAddDecode", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                    } else {
                        w wVar2 = cVar.f343830f.f343808q.get(i17);
                        mc3 mc32 = cVar.f343830f.f343807p.get(i17);
                        Log.i("MicroMsg.SnsCdnDownloadBase", "thumbAddDecode index: %d decodeType: %d.", Integer.valueOf(i17), Integer.valueOf(wVar2.a()));
                        f1.gO0().E(mc32.f29560d, cVar.f343829e.get(i17), wVar2.a());
                        String x15 = wVar2.a() == 0 ? b0.x(0, wVar2.c()) : null;
                        Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]thumbAddDecode cacheName2: %s.", "[image-flow]", mc32.f29560d, x15);
                        p gO0 = f1.gO0();
                        String str = mc32.f29560d;
                        gO0.getClass();
                        SnsMethodCalculate.markStartTimeMs("setRefImageView", "com.tencent.mm.plugin.sns.model.LazyerImageLoader2");
                        gO0.m0(str, x15, null);
                        SnsMethodCalculate.markEndTimeMs("setRefImageView", "com.tencent.mm.plugin.sns.model.LazyerImageLoader2");
                        SnsMethodCalculate.markEndTimeMs("thumbAddDecode", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                    }
                } else {
                    p2.e(aVar3.f343793b, aVar3.f343805n);
                    c.this.s();
                }
                a aVar4 = c.this.f343830f;
                int i18 = aVar4.f343797f;
                if (9 == i18) {
                    mc3 mc33 = aVar4.f343807p.get(this.f343841f.f326307h);
                    g gVar2 = (g) a.this.f343836d;
                    if ((gVar2.f326316b1 == gVar2.f326318d1) && !gVar2.f326319e1) {
                        gVar2.f326319e1 = true;
                        long milliSecondsToNow = Util.milliSecondsToNow(a.this.f343837e);
                        Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]group download, feed cost: %d.", "[image-flow]", this.f343839d, Long.valueOf(milliSecondsToNow));
                        q qVar = q.INSTANCE;
                        qVar.v(1040, 3, milliSecondsToNow);
                        qVar.t(XWebFeature.INTERFACE_SHOW_HIDE, 4);
                        qVar.v(1040, 9, milliSecondsToNow);
                        qVar.v(1040, 10, (long) gVar2.f326316b1);
                    }
                    c cVar2 = c.this;
                    b bVar = cVar2.f343827c;
                    int i19 = this.f343840e;
                    int d15 = cVar2.f343830f.d();
                    a aVar5 = c.this.f343830f;
                    boolean z16 = aVar5.f343795d;
                    String e15 = aVar5.e();
                    f fVar = this.f343841f;
                    ((com.tencent.mm.plugin.sns.model.f) bVar).t(i19, mc33, d15, z16, e15, (int) fVar.field_fileLength, fVar.f326307h, gVar2.f326316b1 == gVar2.f326318d1);
                } else {
                    if (1 == i18) {
                        com.tencent.mm.plugin.sns.model.f wO0 = f1.wO0();
                        String str2 = c.this.f343830f.f343793b;
                        wO0.getClass();
                        SnsMethodCalculate.markStartTimeMs("removeMediaId", "com.tencent.mm.plugin.sns.model.DownloadManager");
                        boolean remove = wO0.f147832s.remove(str2);
                        SnsMethodCalculate.markEndTimeMs("removeMediaId", "com.tencent.mm.plugin.sns.model.DownloadManager");
                        if (remove) {
                            long milliSecondsToNow2 = Util.milliSecondsToNow(a.this.f343837e);
                            Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]single download cost: %d.", "[image-flow]", this.f343839d, Long.valueOf(milliSecondsToNow2));
                            q qVar2 = q.INSTANCE;
                            qVar2.v(1040, 6, milliSecondsToNow2);
                            qVar2.t(XWebFeature.INTERFACE_SHOW_HIDE, 7);
                        }
                    }
                    if (c.this.f343830f.f343797f == 4) {
                        Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]sight download cost=" + Util.milliSecondsToNow(a.this.f343837e), "[image-flow]", c.this.f343830f.f343793b);
                    }
                    c cVar3 = c.this;
                    b bVar2 = cVar3.f343827c;
                    int i25 = this.f343840e;
                    mc3 mc34 = cVar3.f343831g;
                    int d16 = cVar3.f343830f.d();
                    a aVar6 = c.this.f343830f;
                    ((com.tencent.mm.plugin.sns.model.f) bVar2).t(i25, mc34, d16, aVar6.f343795d, aVar6.e(), (int) this.f343841f.field_fileLength, -1, true);
                }
                SnsMethodCalculate.markEndTimeMs("run", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase$1$1");
            }
        }

        public a(h hVar, long j15) {
            this.f343836d = hVar;
            this.f343837e = j15;
        }

        @Override // vi.i.a
        public void i(String str, ByteArrayOutputStream byteArrayOutputStream) {
            SnsMethodCalculate.markStartTimeMs("getCdnAuthInfo", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase$1");
            SnsMethodCalculate.markEndTimeMs("getCdnAuthInfo", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase$1");
        }

        /* JADX WARNING: Removed duplicated region for block: B:60:0x0341  */
        /* JADX WARNING: Removed duplicated region for block: B:61:0x0343  */
        /* JADX WARNING: Removed duplicated region for block: B:89:0x05a6 A[SYNTHETIC, Splitter:B:89:0x05a6] */
        @Override // vi.i.a
        public int j4(String str, int i15, e eVar, f fVar, boolean z15) {
            String str2;
            String str3;
            String str4;
            int i16;
            a aVar;
            int i17;
            boolean z16;
            String str5;
            String str6;
            String str7 = "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase$1";
            SnsMethodCalculate.markStartTimeMs("callback", str7);
            a aVar2 = c.this.f343830f;
            if (aVar2 == null) {
                Log.e("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]pack is null.", "[image-flow]", str);
                SnsMethodCalculate.markEndTimeMs("callback", str7);
                return 0;
            }
            if (fVar != null) {
                Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]download callback mediaId:%s, startRet:%s", "[image-flow]", str, str, Integer.valueOf(i15));
                c cVar = c.this;
                h hVar = this.f343836d;
                String str8 = "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase";
                SnsMethodCalculate.markStartTimeMs("access$000", str8);
                cVar.getClass();
                SnsMethodCalculate.markStartTimeMs("reportDownloadFinish", str8);
                a aVar3 = cVar.f343830f;
                if (9 != aVar3.f343797f) {
                    mc3 mc32 = cVar.f343831g;
                    if (mc32 != null) {
                        Log.i("MicroMsg.SnsCdnDownloadBase", "reportDownloadFinish:%s", mc32.f29560d);
                    }
                } else if (fVar.f326308i != null) {
                    CdnLogic.BatchSnsReqImageData[] batchSnsReqImageDataArr = ((g) hVar).f326317c1;
                    int i18 = 0;
                    for (int length = batchSnsReqImageDataArr.length; i18 < length; length = length) {
                        CdnLogic.BatchSnsReqImageData batchSnsReqImageData = batchSnsReqImageDataArr[i18];
                        int i19 = batchSnsReqImageData.picIndex;
                        if (i19 >= 0 && i19 < cVar.f343830f.f343807p.size()) {
                            Log.i("MicroMsg.SnsCdnDownloadBase", "reportDownloadFinish:%s", cVar.f343830f.f343807p.get(batchSnsReqImageData.picIndex).f29560d);
                        }
                        i18++;
                        batchSnsReqImageDataArr = batchSnsReqImageDataArr;
                    }
                } else {
                    int i25 = fVar.f326307h;
                    if (i25 >= 0 && i25 < aVar3.f343807p.size()) {
                        Log.i("MicroMsg.SnsCdnDownloadBase", "reportDownloadFinish:%s", cVar.f343830f.f343807p.get(fVar.f326307h).f29560d);
                    }
                }
                e73.f.j(fVar.f326300a, fVar.field_retCode);
                SnsMethodCalculate.markEndTimeMs("reportDownloadFinish", str8);
                SnsMethodCalculate.markEndTimeMs("access$000", str8);
                int i26 = fVar.field_retCode;
                if (i26 != 0) {
                    Log.e("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]download err, retCode: %d reqDownType: %d.", "[image-flow]", str, Integer.valueOf(i26), Integer.valueOf(c.this.f343830f.f343797f));
                    com.tencent.mm.network.c.g(fVar.field_serverIP);
                    if (9 == c.this.f343830f.f343797f) {
                        CdnLogic.BatchSnsReqImageData[] batchSnsReqImageDataArr2 = fVar.f326308i;
                        if (batchSnsReqImageDataArr2 == null || batchSnsReqImageDataArr2.length <= 0) {
                            str3 = "callback";
                            str2 = str7;
                            str4 = str8;
                            q.INSTANCE.t(XWebFeature.INTERFACE_SHOW_HIDE, 14);
                            Log.e("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]download error, totally re-download by single.", "[image-flow]", str);
                            g gVar = (g) this.f343836d;
                            gVar.f326318d1 = gVar.f326316b1;
                            CdnLogic.BatchSnsReqImageData[] batchSnsReqImageDataArr3 = gVar.f326317c1;
                            int i27 = 0;
                            for (int length2 = batchSnsReqImageDataArr3.length; i27 < length2; length2 = length2) {
                                int i28 = batchSnsReqImageDataArr3[i27].picIndex;
                                mc3 mc33 = c.this.f343830f.f343807p.get(i28);
                                w wVar = c.this.f343830f.f343808q.get(i28);
                                String str9 = mc33.f29560d;
                                e73.f fVar2 = e73.f.f205993a;
                                SnsMethodCalculate.markStartTimeMs("fallbackDownload", "com.tencent.mm.plugin.sns.report.SnsImageLoadReporter");
                                m.g(str9, "mediaId");
                                d.G("SnsImageLoadReporter", new l(str9));
                                SnsMethodCalculate.markEndTimeMs("fallbackDownload", "com.tencent.mm.plugin.sns.report.SnsImageLoadReporter");
                                f1.wO0().e(mc33, 1, wVar, c.this.f343830f.f343803l, gVar.Z0);
                                Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]group download err, retry single download. index: %d.", Integer.valueOf(i28), "[image-flow]", mc33.f29560d);
                                i27++;
                                batchSnsReqImageDataArr3 = batchSnsReqImageDataArr3;
                            }
                        } else {
                            str3 = "callback";
                            q.INSTANCE.t(XWebFeature.INTERFACE_SHOW_HIDE, 12);
                            g gVar2 = (g) this.f343836d;
                            Log.e("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]download err, taskInfo2 need inc counter, before: %d, inc: %d, count: %d.", "[image-flow]", str, Integer.valueOf(gVar2.f326318d1), Integer.valueOf(batchSnsReqImageDataArr2.length), Integer.valueOf(gVar2.f326316b1));
                            gVar2.f326318d1 += batchSnsReqImageDataArr2.length;
                            int length3 = batchSnsReqImageDataArr2.length;
                            int i29 = 0;
                            while (i29 < length3) {
                                CdnLogic.BatchSnsReqImageData batchSnsReqImageData2 = batchSnsReqImageDataArr2[i29];
                                if (batchSnsReqImageData2.retry) {
                                    int i35 = batchSnsReqImageData2.picIndex;
                                    mc3 mc34 = c.this.f343830f.f343807p.get(i35);
                                    str6 = str7;
                                    w wVar2 = c.this.f343830f.f343808q.get(i35);
                                    String str10 = mc34.f29560d;
                                    e73.f fVar3 = e73.f.f205993a;
                                    SnsMethodCalculate.markStartTimeMs("fallbackDownload", "com.tencent.mm.plugin.sns.report.SnsImageLoadReporter");
                                    m.g(str10, "mediaId");
                                    str5 = str8;
                                    d.G("SnsImageLoadReporter", new l(str10));
                                    SnsMethodCalculate.markEndTimeMs("fallbackDownload", "com.tencent.mm.plugin.sns.report.SnsImageLoadReporter");
                                    f1.wO0().e(mc34, 1, wVar2, c.this.f343830f.f343803l, gVar2.Z0);
                                    Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]group download err, retry single download. index: %d.", "[image-flow]", mc34.f29560d, Integer.valueOf(i35));
                                } else {
                                    str6 = str7;
                                    str5 = str8;
                                }
                                i29++;
                                length3 = length3;
                                batchSnsReqImageDataArr2 = batchSnsReqImageDataArr2;
                                str7 = str6;
                                str8 = str5;
                            }
                            str2 = str7;
                            str4 = str8;
                        }
                    } else {
                        str3 = "callback";
                        str2 = str7;
                        str4 = str8;
                        SnsMethodCalculate.markStartTimeMs("downloadFail", "com.tencent.mm.plugin.sns.report.SnsImageLoadReporter");
                        m.g(str, "mediaId");
                        d.G("SnsImageLoadReporter", new j(str));
                        SnsMethodCalculate.markEndTimeMs("downloadFail", "com.tencent.mm.plugin.sns.report.SnsImageLoadReporter");
                    }
                } else {
                    str3 = "callback";
                    str2 = str7;
                    str4 = str8;
                    Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]download succ, type: %d, mediaId:%s", "[image-flow]", str, Integer.valueOf(c.this.f343830f.f343797f), str);
                    c cVar2 = c.this;
                    cVar2.f343834j = (int) fVar.field_fileLength;
                    if (9 == cVar2.f343830f.f343797f) {
                        g gVar3 = (g) this.f343836d;
                        int i36 = gVar3.f326318d1 + 1;
                        gVar3.f326318d1 = i36;
                        Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]download succ, counter++, res: %d, count: %d.", "[image-flow]", str, Integer.valueOf(i36), Integer.valueOf(gVar3.f326316b1));
                        z16 = c.this.r(fVar.f326307h);
                    } else {
                        z16 = cVar2.q();
                    }
                    if (!z16) {
                        SnsMethodCalculate.markStartTimeMs("processFail", "com.tencent.mm.plugin.sns.report.SnsImageLoadReporter");
                        m.g(str, "mediaId");
                        d.G("SnsImageLoadReporter", new e73.q(str));
                        SnsMethodCalculate.markEndTimeMs("processFail", "com.tencent.mm.plugin.sns.report.SnsImageLoadReporter");
                    } else {
                        i16 = c.this.f343830f.f343795d ? 3 : 1;
                        c cVar3 = c.this;
                        cVar3.getClass();
                        SnsMethodCalculate.markStartTimeMs("reportDownloadRecord", str4);
                        int l15 = cVar3.l();
                        int i37 = cVar3.f343830f.f343797f;
                        int i38 = i37 != 8 ? 1 : (i37 == 6 || i37 == 4) ? 2 : i37 == 5 ? 4 : (i37 == 2 || i37 == 1 || i37 == 3) ? 0 : 5;
                        long j15 = fVar.field_recvedBytes;
                        int i39 = (j15 > 0 || (i17 = fVar.field_receiveCostTime) <= 0) ? 0 : (int) ((((float) j15) / 1024.0f) / (((float) (((i17 + fVar.field_waitResponseCostTime) + fVar.field_connectCostTime) + fVar.field_dnsCostTime)) / 1000.0f));
                        v vVar = new v();
                        vVar.a("20ImgSize", fVar.field_fileLength + ",");
                        vVar.a("21NetType", (NetStatusUtil.isWifi(MMApplicationContext.getContext()) ? 1 : 0) + ",");
                        vVar.a("22DelayTime", fVar.field_delayTime + ",");
                        vVar.a("23RetCode", fVar.field_retCode + ",");
                        vVar.a("24DnsCostTime", fVar.field_dnsCostTime + ",");
                        vVar.a("25ConnectCostTime", fVar.field_connectCostTime + ",");
                        vVar.a("26SendCostTime", ",");
                        vVar.a("27WaitResponseCostTime", fVar.field_waitResponseCostTime + ",");
                        vVar.a("28ReceiveCostTime", fVar.field_receiveCostTime + ",");
                        vVar.a("29ClientAddrIP(uint)", fVar.field_clientHostIP + ",");
                        vVar.a("30ServerAddrIP(uint)", fVar.field_serverHostIP + ",");
                        vVar.a("31dnstype", cVar3.f343833i + ",");
                        vVar.a("32signal(int)", ConnectivityCompat.Companion.getCompatMixStrength() + ",");
                        vVar.a("33host(string)", cVar3.f343835k + ",");
                        vVar.a("34MediaType", l15 + ",");
                        vVar.a("35X_Errno(string)", fVar.field_xErrorNo + ",");
                        vVar.a("36MaxPackageSize", ",");
                        vVar.a("37MaxPackageTimeStamp", ",");
                        vVar.a("38PackageRecordList", ",");
                        vVar.a("39ExpLayerId", "0,");
                        vVar.a("40ExpId", "0,");
                        vVar.a("41FeedId", ",");
                        vVar.a("42BizType", i38 + ",");
                        vVar.a("43CSeqCheck(uint)", fVar.field_cSeqCheck + ",");
                        vVar.a("44isPrivate(uint)", (fVar.field_usePrivateProtocol ? 1 : 0) + ",");
                        vVar.a("45mediaId(string)", fVar.f326300a + ",");
                        vVar.a("46download_speed(uint)", Integer.valueOf(i39));
                        Log.i("MicroMsg.SnsCdnDownloadBase", "report logbuffer(13480 TLMediaFielDownloadRecord): " + vVar.c());
                        q qVar = q.INSTANCE;
                        qVar.g(13480, vVar);
                        int i45 = fVar.field_retCode;
                        if (!(i45 == 200 || i45 == 0)) {
                            qVar.g(14071, vVar);
                        }
                        SnsMethodCalculate.markEndTimeMs("reportDownloadRecord", str4);
                        aVar = c.this.f343830f;
                        SnsMethodCalculate.markStartTimeMs("reportAdPicCDNDownload", "com.tencent.mm.plugin.sns.ad.timeline.helper.AdImgDownloadReporter");
                        if (aVar != null) {
                            try {
                                mc3 mc35 = aVar.f343792a;
                                if (mc35 != null && mc35.N) {
                                    int a15 = z43.f.a(aVar.f343798g);
                                    Log.i("AdImgDownloadReporter", "reportAdPicCDNDownload, result=" + fVar.field_retCode + ", requestKey=" + aVar.f343798g + ", reqDownType=" + aVar.f343797f + ", url=" + aVar.f343794c);
                                    if (a15 == 1 || a15 == 5) {
                                        if (fVar.field_retCode == 0) {
                                            z43.f.b(0, 0, 1, aVar.f343794c);
                                            z43.f.c(aVar);
                                        } else {
                                            z43.f.b(1, 0, 1, aVar.f343794c);
                                        }
                                    }
                                }
                            } catch (Throwable th5) {
                                Log.e("AdImgDownloadReporter", "reportAdPicCDNDownload, exp=" + th5.toString());
                            }
                        }
                        SnsMethodCalculate.markEndTimeMs("reportAdPicCDNDownload", "com.tencent.mm.plugin.sns.ad.timeline.helper.AdImgDownloadReporter");
                        Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]download succ start post to ui thread process, type: %d, mediaId:%s %s", "[image-flow]", str, Integer.valueOf(c.this.f343830f.f343797f), str, c.this.f343830f.f343793b);
                        f1.MO0().post(new RunnableC6280a(str, i16, fVar));
                    }
                }
                i16 = 2;
                c cVar32 = c.this;
                cVar32.getClass();
                SnsMethodCalculate.markStartTimeMs("reportDownloadRecord", str4);
                int l152 = cVar32.l();
                int i372 = cVar32.f343830f.f343797f;
                if (i372 != 8) {
                }
                long j152 = fVar.field_recvedBytes;
                if (j152 > 0) {
                }
                v vVar2 = new v();
                vVar2.a("20ImgSize", fVar.field_fileLength + ",");
                vVar2.a("21NetType", (NetStatusUtil.isWifi(MMApplicationContext.getContext()) ? 1 : 0) + ",");
                vVar2.a("22DelayTime", fVar.field_delayTime + ",");
                vVar2.a("23RetCode", fVar.field_retCode + ",");
                vVar2.a("24DnsCostTime", fVar.field_dnsCostTime + ",");
                vVar2.a("25ConnectCostTime", fVar.field_connectCostTime + ",");
                vVar2.a("26SendCostTime", ",");
                vVar2.a("27WaitResponseCostTime", fVar.field_waitResponseCostTime + ",");
                vVar2.a("28ReceiveCostTime", fVar.field_receiveCostTime + ",");
                vVar2.a("29ClientAddrIP(uint)", fVar.field_clientHostIP + ",");
                vVar2.a("30ServerAddrIP(uint)", fVar.field_serverHostIP + ",");
                vVar2.a("31dnstype", cVar32.f343833i + ",");
                vVar2.a("32signal(int)", ConnectivityCompat.Companion.getCompatMixStrength() + ",");
                vVar2.a("33host(string)", cVar32.f343835k + ",");
                vVar2.a("34MediaType", l152 + ",");
                vVar2.a("35X_Errno(string)", fVar.field_xErrorNo + ",");
                vVar2.a("36MaxPackageSize", ",");
                vVar2.a("37MaxPackageTimeStamp", ",");
                vVar2.a("38PackageRecordList", ",");
                vVar2.a("39ExpLayerId", "0,");
                vVar2.a("40ExpId", "0,");
                vVar2.a("41FeedId", ",");
                vVar2.a("42BizType", i38 + ",");
                vVar2.a("43CSeqCheck(uint)", fVar.field_cSeqCheck + ",");
                vVar2.a("44isPrivate(uint)", (fVar.field_usePrivateProtocol ? 1 : 0) + ",");
                vVar2.a("45mediaId(string)", fVar.f326300a + ",");
                vVar2.a("46download_speed(uint)", Integer.valueOf(i39));
                Log.i("MicroMsg.SnsCdnDownloadBase", "report logbuffer(13480 TLMediaFielDownloadRecord): " + vVar2.c());
                q qVar2 = q.INSTANCE;
                qVar2.g(13480, vVar2);
                int i452 = fVar.field_retCode;
                qVar2.g(14071, vVar2);
                SnsMethodCalculate.markEndTimeMs("reportDownloadRecord", str4);
                aVar = c.this.f343830f;
                SnsMethodCalculate.markStartTimeMs("reportAdPicCDNDownload", "com.tencent.mm.plugin.sns.ad.timeline.helper.AdImgDownloadReporter");
                if (aVar != null) {
                }
                SnsMethodCalculate.markEndTimeMs("reportAdPicCDNDownload", "com.tencent.mm.plugin.sns.ad.timeline.helper.AdImgDownloadReporter");
                Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]download succ start post to ui thread process, type: %d, mediaId:%s %s", "[image-flow]", str, Integer.valueOf(c.this.f343830f.f343797f), str, c.this.f343830f.f343793b);
                f1.MO0().post(new RunnableC6280a(str, i16, fVar));
            } else {
                str3 = "callback";
                str2 = str7;
                if (eVar != null) {
                    float f15 = ((float) eVar.field_finishedLength) / ((float) eVar.field_toltalLength);
                    if (aVar2.f343804m < f15) {
                        aVar2.f343804m = f15;
                        aVar2.d();
                        String str11 = c.this.f343830f.f343794c;
                    }
                }
            }
            if (i15 != 0) {
                Log.e("MicroMsg.SnsCdnDownloadBase", "task build error! startRet: %d, type: %d.", Integer.valueOf(i15), Integer.valueOf(c.this.f343830f.f343797f));
                if (9 == c.this.f343830f.f343797f) {
                    q.INSTANCE.t(XWebFeature.INTERFACE_SHOW_HIDE, 13);
                    c.g().remove(c.this.f343830f.e());
                    c cVar4 = c.this;
                    b bVar = cVar4.f343827c;
                    int d15 = cVar4.f343830f.d();
                    a aVar4 = c.this.f343830f;
                    ((com.tencent.mm.plugin.sns.model.f) bVar).t(2, null, d15, aVar4.f343795d, aVar4.e(), -1, -1, true);
                    g gVar4 = (g) this.f343836d;
                    for (CdnLogic.BatchSnsReqImageData batchSnsReqImageData3 : gVar4.f326317c1) {
                        int i46 = batchSnsReqImageData3.picIndex;
                        f1.wO0().e(c.this.f343830f.f343807p.get(i46), 1, c.this.f343830f.f343808q.get(i46), c.this.f343830f.f343803l, gVar4.Z0);
                        Log.i("MicroMsg.SnsCdnDownloadBase", "group download err, retry single download. index: %d.", Integer.valueOf(i46));
                    }
                }
            }
            SnsMethodCalculate.markEndTimeMs(str3, str2);
            return 0;
        }

        @Override // vi.i.a
        public byte[] k(String str, byte[] bArr) {
            SnsMethodCalculate.markStartTimeMs("decodePrepareResponse", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase$1");
            byte[] bArr2 = new byte[0];
            SnsMethodCalculate.markEndTimeMs("decodePrepareResponse", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase$1");
            return bArr2;
        }
    }

    public interface b {
    }

    public c(b bVar, a aVar) {
        this.f343827c = bVar;
        this.f343830f = aVar;
        if (aVar != null) {
            this.f343831g = aVar.f343792a;
            f343826l.add(aVar.e());
            aVar.g();
        }
    }

    public static /* synthetic */ HashSet g() {
        SnsMethodCalculate.markStartTimeMs("access$100", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        HashSet<String> hashSet = f343826l;
        SnsMethodCalculate.markEndTimeMs("access$100", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        return hashSet;
    }

    /* Return type fixed from 'java.lang.Object' to match base method */
    /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */
    @Override // com.tencent.mm.pluginsdk.model.a1
    public /* bridge */ /* synthetic */ Integer a(String[] strArr) {
        SnsMethodCalculate.markStartTimeMs("doInBackground", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        Integer k15 = k(strArr);
        SnsMethodCalculate.markEndTimeMs("doInBackground", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        return k15;
    }

    @Override // com.tencent.mm.pluginsdk.model.a1
    public ExecutorService b() {
        SnsMethodCalculate.markStartTimeMs("getExecutor", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        ExecutorService hO0 = f1.hO0();
        SnsMethodCalculate.markEndTimeMs("getExecutor", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        return hO0;
    }

    /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
    @Override // com.tencent.mm.pluginsdk.model.a1
    public /* bridge */ /* synthetic */ void c(Integer num) {
        SnsMethodCalculate.markStartTimeMs("onPostExecute", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        p(num);
        SnsMethodCalculate.markEndTimeMs("onPostExecute", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
    }

    public abstract String h(String str);

    public String i(String str, mc3 mc32) {
        SnsMethodCalculate.markStartTimeMs("appendUrlArg", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        SnsMethodCalculate.markEndTimeMs("appendUrlArg", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        return str;
    }

    public void j() {
        SnsMethodCalculate.markStartTimeMs("checkCdnPath", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        a aVar = this.f343830f;
        if (aVar != null) {
            Log.i("MicroMsg.SnsCdnDownloadBase", "checkCdnPath: %s", Boolean.valueOf(u1.v(aVar.c())));
        }
        SnsMethodCalculate.markEndTimeMs("checkCdnPath", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
    }

    /* JADX WARNING: Code restructure failed: missing block: B:138:0x0597, code lost:
        if (r2 != 9) goto L_0x0608;
     */
    /* JADX WARNING: Removed duplicated region for block: B:104:0x0450 A[Catch:{ MalformedURLException -> 0x062d }] */
    /* JADX WARNING: Removed duplicated region for block: B:123:0x0567  */
    /* JADX WARNING: Removed duplicated region for block: B:124:0x0574  */
    /* JADX WARNING: Removed duplicated region for block: B:161:0x065d  */
    /* JADX WARNING: Removed duplicated region for block: B:199:0x0747  */
    /* JADX WARNING: Removed duplicated region for block: B:200:0x0760  */
    /* JADX WARNING: Removed duplicated region for block: B:201:0x0778  */
    /* JADX WARNING: Removed duplicated region for block: B:55:0x01c3  */
    /* JADX WARNING: Removed duplicated region for block: B:58:0x0234  */
    /* JADX WARNING: Removed duplicated region for block: B:59:0x0245  */
    /* JADX WARNING: Removed duplicated region for block: B:62:0x0259  */
    /* JADX WARNING: Removed duplicated region for block: B:63:0x025c  */
    /* JADX WARNING: Removed duplicated region for block: B:65:0x0260  */
    /* JADX WARNING: Removed duplicated region for block: B:66:0x0263  */
    /* JADX WARNING: Removed duplicated region for block: B:69:0x02b8  */
    /* JADX WARNING: Removed duplicated region for block: B:72:0x02de  */
    /* JADX WARNING: Removed duplicated region for block: B:76:0x030b  */
    /* JADX WARNING: Removed duplicated region for block: B:82:0x0353  */
    public Integer k(String... strArr) {
        String str;
        a aVar;
        boolean z15;
        String str2;
        String str3;
        long b15;
        a aVar2;
        h hVar;
        String str4;
        String str5;
        boolean z16;
        int i15;
        int i16;
        int i17;
        Throwable th5;
        MalformedURLException e15;
        ArrayList arrayList;
        ArrayList arrayList2;
        int i18;
        boolean z17;
        String str6;
        int i19;
        int i25;
        ArrayList arrayList3;
        String str7;
        String str8;
        f.j jVar;
        SnsMethodCalculate.markStartTimeMs("doInBackground", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        z.h();
        if (!z.s().n() || this.f343830f == null) {
            SnsMethodCalculate.markEndTimeMs("doInBackground", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
            return 2;
        }
        if (o()) {
            if (9 == this.f343830f.f343797f) {
                for (int i26 = 0; i26 < this.f343830f.f343807p.size(); i26++) {
                    mc3 valueAt = this.f343830f.f343807p.valueAt(i26);
                    String str9 = this.f343830f.a(valueAt.f29560d) + this.f343830f.b(valueAt);
                    Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]delete sns exist:%b thumb1:[%s]", "[image-flow]", valueAt.f29560d, Boolean.valueOf(u1.k(str9)), str9);
                    u1.h(str9);
                }
            } else {
                String str10 = this.f343830f.f343800i + this.f343830f.f();
                Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]delete sns exist:%b thumb2:[%s]", "[image-flow]", this.f343831g.f29560d, Boolean.valueOf(u1.k(str10)), str10);
                u1.h(str10);
            }
        }
        long currentTimeMillis = System.currentTimeMillis();
        try {
            com.tencent.mm.plugin.sns.model.f wO0 = f1.wO0();
            String str11 = this.f343830f.f343793b;
            wO0.getClass();
            SnsMethodCalculate.markStartTimeMs("getReporter", "com.tencent.mm.plugin.sns.model.DownloadManager");
            if (!Util.isNullOrNil(str11)) {
                jVar = wO0.f147831r.get(str11);
                SnsMethodCalculate.markEndTimeMs("getReporter", "com.tencent.mm.plugin.sns.model.DownloadManager");
            } else {
                jVar = null;
                SnsMethodCalculate.markEndTimeMs("getReporter", "com.tencent.mm.plugin.sns.model.DownloadManager");
            }
            if (jVar != null) {
                jVar.getClass();
                SnsMethodCalculate.markStartTimeMs("isSetStartTime", "com.tencent.mm.plugin.sns.model.DownloadManager$SingleImgDownloadByFeedReporter");
                boolean z18 = jVar.f147851d;
                SnsMethodCalculate.markEndTimeMs("isSetStartTime", "com.tencent.mm.plugin.sns.model.DownloadManager$SingleImgDownloadByFeedReporter");
                if (!z18) {
                    jVar.a(currentTimeMillis);
                }
            }
        } catch (Exception e16) {
            Log.e("MicroMsg.SnsCdnDownloadBase", "exception msg: %s.", e16.getMessage());
        }
        SparseArray<mc3> sparseArray = this.f343830f.f343807p;
        Log.i("MicroMsg.SnsCdnDownloadBase", "to downloadBitmap pack.mediaId: " + this.f343830f.f343793b + " pack.mediaObjs.size: " + (sparseArray != null ? sparseArray.size() : 0) + " pack.snsId: " + this.f343830f.f343806o + " pack.isthumb: " + this.f343830f.f343795d + " type: " + this.f343830f.d());
        o3 o3Var = this.f343830f.f343803l;
        if (o3Var != null) {
            if (o3Var.equals(o3.f174910d)) {
                str = "album_friend";
            } else if (o3Var.equals(o3.f174911e)) {
                str = "album_self";
            } else if (o3Var.equals(o3.f174912f)) {
                str = "album_stranger";
            } else if (o3Var.equals(o3.f174913g)) {
                str = "profile_friend";
            } else if (o3Var.equals(o3.f174914h)) {
                str = "profile_stranger";
            } else if (o3Var.equals(o3.f174915i)) {
                str = FFmpegMetadataRetriever.METADATA_KEY_COMMENT;
            } else if (o3Var.equals(o3.f174909c)) {
                str = "timeline";
            }
            if (!Util.isNullOrNil(str)) {
                str = "&scene=" + str;
            }
            String format = String.format(HttpWrapperBase.PROTOCAL_HTTPS + WeChatHosts.domainString(R.string.fyt) + "/?version=%d&uin=%s&nettype=%d&signal=%d%s", Integer.valueOf(yv3.d.f349176g), gh.q.a(f1.oO0()), Integer.valueOf(NetStatusUtil.getNetTypeForStat(MMApplicationContext.getContext())), Integer.valueOf(ConnectivityCompat.Companion.getCompatMixStrength()), str);
            aVar = this.f343830f;
            if (9 != aVar.f343797f) {
                aVar.f343794c = i(aVar.f343794c, aVar.f343807p.get(0));
            } else {
                aVar.f343794c = h(aVar.f343794c);
            }
            this.f343832h = Util.nowMilliSecond();
            z15 = this.f343830f.f343796e;
            if (!z15) {
                str2 = "SnsSightDomainList";
            } else {
                str2 = "SnsAlbumDomainList";
            }
            if (!z15) {
                str3 = "SnsSightMainStandbyIpSwitchTime";
            } else {
                str3 = "SnsAlbumMainStandbyIpSwitchTime";
            }
            String d15 = ((jt3.b) z.q(jt3.b.class)).gv0().d(str2);
            b15 = (long) ((jt3.b) z.q(jt3.b.class)).gv0().b(str3, 0);
            a aVar3 = this.f343830f;
            Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]pack.isAlbum %s pack.isthumb %s hostvalue %s dcipTime %s", "[image-flow]", aVar3.f343793b, Boolean.valueOf(aVar3.f343796e), Boolean.valueOf(this.f343830f.f343795d), d15, Long.valueOf(b15));
            if (b15 <= 0) {
                b15 = 259200;
            }
            boolean n15 = n(o3Var, this.f343830f.f343794c, b15, d15);
            this.f343832h = Util.milliSecondsToNow(this.f343832h);
            aVar2 = this.f343830f;
            if (9 != aVar2.f343797f) {
                hVar = new g();
                hVar.f326323d = "task_SnsCdnDownloadBase_1";
                for (int i27 = 0; i27 < this.f343830f.f343807p.size(); i27++) {
                    u1.v(this.f343830f.a(this.f343830f.f343807p.valueAt(i27).f29560d));
                }
            } else {
                u1.v(aVar2.c());
                hVar = new h();
                hVar.f326323d = "task_SnsCdnDownloadBase_2";
            }
            str4 = "attachSnsImgTaskInfo";
            SnsMethodCalculate.markStartTimeMs(str4, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
            this.f343835k = new URL(this.f343830f.f343794c).getHost();
            ArrayList arrayList4 = new ArrayList();
            this.f343833i = com.tencent.mm.network.c.f(this.f343835k, false, arrayList4);
            ArrayList arrayList5 = new ArrayList();
            int f15 = com.tencent.mm.network.c.f(this.f343835k, true, arrayList5);
            if (9 != this.f343830f.f343797f) {
                hVar.field_mediaId = this.f343830f.f343806o + "_" + this.f343830f.f343797f;
                if (hVar instanceof g) {
                    g gVar = (g) hVar;
                    a aVar4 = this.f343830f;
                    str5 = "doInBackground";
                    try {
                        gVar.Z0 = aVar4.f343806o;
                        gVar.f326315a1 = aVar4.f343809r;
                        int size = aVar4.f343807p.size();
                        gVar.f326316b1 = size;
                        gVar.f326317c1 = new CdnLogic.BatchSnsReqImageData[size];
                        int i28 = 0;
                        while (i28 < gVar.f326316b1) {
                            int keyAt = this.f343830f.f343807p.keyAt(i28);
                            str6 = str4;
                            try {
                                mc3 mc32 = this.f343830f.f343807p.get(keyAt);
                                CdnLogic.BatchSnsReqImageData batchSnsReqImageData = new CdnLogic.BatchSnsReqImageData();
                                SnsMethodCalculate.markStartTimeMs("getURL", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                                String str12 = mc32.f29565i;
                                if (Util.isNullOrNil(str12)) {
                                    str8 = str12;
                                    arrayList3 = arrayList4;
                                    if (mc32.f29561e == 2) {
                                        str7 = mc32.f29563g;
                                        String i29 = i(str7, mc32);
                                        SnsMethodCalculate.markEndTimeMs("getURL", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                                        batchSnsReqImageData.url = i29;
                                        batchSnsReqImageData.picIndex = keyAt;
                                        batchSnsReqImageData.totalFileSize = 0;
                                        batchSnsReqImageData.decryptKey = mc32.L;
                                        batchSnsReqImageData.imageCachePath = u1.i(this.f343830f.a(mc32.f29560d) + this.f343830f.b(mc32), false);
                                        batchSnsReqImageData.fileKey = mc32.f29560d + "_" + this.f343830f.f343797f;
                                        gVar.f326317c1[i28] = batchSnsReqImageData;
                                        i28++;
                                        str4 = str6;
                                        n15 = n15;
                                        f15 = f15;
                                        arrayList5 = arrayList5;
                                        arrayList4 = arrayList3;
                                    }
                                } else {
                                    arrayList3 = arrayList4;
                                    str8 = str12;
                                }
                                str7 = str8;
                                String i292 = i(str7, mc32);
                                SnsMethodCalculate.markEndTimeMs("getURL", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                                batchSnsReqImageData.url = i292;
                                batchSnsReqImageData.picIndex = keyAt;
                                batchSnsReqImageData.totalFileSize = 0;
                                batchSnsReqImageData.decryptKey = mc32.L;
                                batchSnsReqImageData.imageCachePath = u1.i(this.f343830f.a(mc32.f29560d) + this.f343830f.b(mc32), false);
                                batchSnsReqImageData.fileKey = mc32.f29560d + "_" + this.f343830f.f343797f;
                                gVar.f326317c1[i28] = batchSnsReqImageData;
                                i28++;
                                str4 = str6;
                                n15 = n15;
                                f15 = f15;
                                arrayList5 = arrayList5;
                                arrayList4 = arrayList3;
                            } catch (MalformedURLException e17) {
                                e15 = e17;
                                str4 = str6;
                                Log.printErrStackTrace("MicroMsg.SnsCdnDownloadBase", e15, "[%s][media:%s]", "[image-flow]", hVar.field_mediaId);
                                Log.w("MicroMsg.SnsCdnDownloadBase", "attachSnsImgTaskInfo fail:" + e15);
                                SnsMethodCalculate.markEndTimeMs(str4, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                                z16 = false;
                                if (!z16) {
                                }
                                i15 = i16;
                                Integer valueOf = Integer.valueOf(i15);
                                SnsMethodCalculate.markEndTimeMs(str5, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                                return valueOf;
                            }
                        }
                        z17 = n15;
                        str6 = str4;
                        arrayList = arrayList4;
                        arrayList2 = arrayList5;
                        i18 = f15;
                    } catch (MalformedURLException e18) {
                        e15 = e18;
                        Log.printErrStackTrace("MicroMsg.SnsCdnDownloadBase", e15, "[%s][media:%s]", "[image-flow]", hVar.field_mediaId);
                        Log.w("MicroMsg.SnsCdnDownloadBase", "attachSnsImgTaskInfo fail:" + e15);
                        SnsMethodCalculate.markEndTimeMs(str4, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                        z16 = false;
                        if (!z16) {
                        }
                        i15 = i16;
                        Integer valueOf2 = Integer.valueOf(i15);
                        SnsMethodCalculate.markEndTimeMs(str5, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                        return valueOf2;
                    }
                } else {
                    z17 = n15;
                    str6 = str4;
                    arrayList = arrayList4;
                    arrayList2 = arrayList5;
                    i18 = f15;
                    str5 = "doInBackground";
                }
            } else {
                z17 = n15;
                str6 = str4;
                arrayList = arrayList4;
                arrayList2 = arrayList5;
                i18 = f15;
                str5 = "doInBackground";
                hVar.field_mediaId = this.f343830f.f343793b + "_" + this.f343830f.f343797f;
                StringBuilder sb5 = new StringBuilder();
                sb5.append(this.f343830f.c());
                sb5.append(this.f343830f.f());
                String sb6 = sb5.toString();
                hVar.Y = sb6;
                hVar.field_fullpath = sb6;
                a aVar5 = this.f343830f;
                if (aVar5.f343792a != null) {
                    Object[] objArr = new Object[7];
                    objArr[0] = "[image-flow]";
                    objArr[1] = hVar.field_mediaId;
                    try {
                        objArr[2] = Boolean.valueOf(aVar5.f343795d);
                        mc3 mc33 = this.f343830f.f343792a;
                        objArr[3] = mc33.L;
                        objArr[4] = mc33.I;
                        objArr[5] = Long.valueOf(mc33.E);
                        objArr[6] = Long.valueOf(this.f343830f.f343792a.E);
                        Log.i("MicroMsg.SnsCdnDownloadBase", "%s,downloadImage mediaId:%s, isThumb:%s, thumbEncKey:%s, urlEncKey:%s, enckey:%s", objArr);
                        a aVar6 = this.f343830f;
                        mc3 mc34 = aVar6.f343792a;
                        String str13 = mc34.I;
                        if (aVar6.f343795d) {
                            if (!Util.isNullOrNil(mc34.L)) {
                                str13 = this.f343830f.f343792a.L;
                            } else if (this.f343830f.f343792a.E != 0) {
                                str13 = this.f343830f.f343792a.E + "";
                            }
                        }
                        hVar.W0 = str13;
                    } catch (MalformedURLException e19) {
                        e15 = e19;
                        str4 = str6;
                        Log.printErrStackTrace("MicroMsg.SnsCdnDownloadBase", e15, "[%s][media:%s]", "[image-flow]", hVar.field_mediaId);
                        Log.w("MicroMsg.SnsCdnDownloadBase", "attachSnsImgTaskInfo fail:" + e15);
                        SnsMethodCalculate.markEndTimeMs(str4, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                        z16 = false;
                        if (!z16) {
                        }
                        i15 = i16;
                        Integer valueOf22 = Integer.valueOf(i15);
                        SnsMethodCalculate.markEndTimeMs(str5, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                        return valueOf22;
                    }
                }
            }
            hVar.V = this.f343830f.f343794c;
            hVar.W = this.f343835k;
            hVar.X = format;
            hVar.Z = m(arrayList);
            hVar.f326320p0 = m(arrayList2);
            hVar.f326321x0 = this.f343833i;
            hVar.f326322y0 = i18;
            hVar.T0 = z17;
            hVar.U0 = "" + ConnectivityCompat.Companion.getCompatMixStrength();
            a aVar7 = this.f343830f;
            hVar.V0 = aVar7.f343803l.f174922a;
            i19 = aVar7.f343797f;
            if (i19 != 8) {
                hVar.f326327h = 3;
                hVar.X0 = 109;
                hVar.Y0 = 20204;
            } else if (i19 == 6 || i19 == 4) {
                hVar.f326327h = 3;
                hVar.X0 = 105;
                hVar.Y0 = CdnLogic.kMediaTypeAdVideo;
            } else if (i19 == 5) {
                hVar.f326327h = 3;
                hVar.X0 = 150;
                hVar.Y0 = 20250;
            } else {
                if (i19 == 2 || i19 == 1) {
                    i25 = 3;
                } else {
                    i25 = 3;
                    if (i19 != 3) {
                    }
                }
                hVar.f326327h = i25;
                hVar.X0 = 100;
                hVar.Y0 = 20201;
                if (i19 == 1 && ((aVar7.f343794c.startsWith("http://wxapp.tc.qq.com") || this.f343830f.f343794c.startsWith("https://wxapp.tc.qq.com")) && ((ie1.h) yz3.j.c(ie1.h.class)).Xj0(h.c.f231855eq, 1) == 1)) {
                    hVar.f326327h = 3;
                    hVar.X0 = 150;
                    hVar.Y0 = 20201;
                }
                a aVar8 = this.f343830f;
                if (aVar8.f343797f == 3 && aVar8.f343794c.startsWith("https://wwfile.work.weixin.qq.com")) {
                    hVar.field_fileType = 19;
                    a aVar9 = this.f343830f;
                    hVar.field_aesKey = aVar9.f343810s;
                    hVar.field_authKey = aVar9.f343811t;
                    hVar.f326337u = hVar.V;
                    hVar.field_totalLen = 1;
                }
            }
            Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]attachSnsImgTaskInfo success reqDownType:%d taskInfo:%s", "[image-flow]", hVar.field_mediaId, Integer.valueOf(this.f343830f.f343797f), hVar);
            SnsMethodCalculate.markEndTimeMs(str6, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
            z16 = true;
            if (!z16) {
                a aVar10 = this.f343830f;
                if (aVar10 != null && aVar10.f343796e) {
                    mc3 mc35 = this.f343831g;
                    SnsMethodCalculate.markStartTimeMs("checkAdDeviceSupportH265", "com.tencent.mm.plugin.sns.ad.helper.AdH265Helper");
                    if (mc35 != null && mc35.N && !TextUtils.isEmpty(mc35.f29563g)) {
                        try {
                            if (mc35.f29563g.contains("svpuseh265flag=1")) {
                                boolean X80 = hg0.h.X80(6);
                                if (X80) {
                                    hVar.field_requestVideoFormat = 2;
                                } else {
                                    try {
                                        hVar.field_requestVideoFormat = 1;
                                        try {
                                            r.a("dev_disable_hevc", vj.r.k().toLowerCase(), 0, 0, "");
                                        } catch (Throwable th6) {
                                            Log.e("AdH265Helper", "checkAdDeviceSupportH265 report exp=" + th6.toString());
                                        }
                                    } catch (Throwable th7) {
                                        th5 = th7;
                                        i17 = 1;
                                        hVar.field_requestVideoFormat = i17;
                                        Log.e("AdH265Helper", "checkAppendAdH265Flag, exp=" + th5.toString());
                                        SnsMethodCalculate.markEndTimeMs("checkAdDeviceSupportH265", "com.tencent.mm.plugin.sns.ad.helper.AdH265Helper");
                                        hVar.f326325f = new a(hVar, currentTimeMillis);
                                        if (!((gp.l) yz3.j.c(gp.l.class)).xq(hVar)) {
                                        }
                                    }
                                }
                                Log.i("AdH265Helper", "checkAppendAdH265Flag, isDeviceSupportHevc=" + X80 + ", requestVideoFormat=" + hVar.field_requestVideoFormat + ", url=" + mc35.f29563g);
                                d23.q.g(false, true, X80);
                            } else {
                                try {
                                    hVar.field_requestVideoFormat = 1;
                                    Log.i("AdH265Helper", "checkAppendAdH265Flag, url has no h265 flag, url=" + mc35.f29563g);
                                    d23.q.g(false, false, false);
                                } catch (Throwable th8) {
                                    th5 = th8;
                                    i17 = 1;
                                    hVar.field_requestVideoFormat = i17;
                                    Log.e("AdH265Helper", "checkAppendAdH265Flag, exp=" + th5.toString());
                                    SnsMethodCalculate.markEndTimeMs("checkAdDeviceSupportH265", "com.tencent.mm.plugin.sns.ad.helper.AdH265Helper");
                                    hVar.f326325f = new a(hVar, currentTimeMillis);
                                    if (!((gp.l) yz3.j.c(gp.l.class)).xq(hVar)) {
                                    }
                                }
                            }
                        } catch (Throwable th9) {
                            th5 = th9;
                            i17 = 1;
                            hVar.field_requestVideoFormat = i17;
                            Log.e("AdH265Helper", "checkAppendAdH265Flag, exp=" + th5.toString());
                            SnsMethodCalculate.markEndTimeMs("checkAdDeviceSupportH265", "com.tencent.mm.plugin.sns.ad.helper.AdH265Helper");
                            hVar.f326325f = new a(hVar, currentTimeMillis);
                            if (!((gp.l) yz3.j.c(gp.l.class)).xq(hVar)) {
                            }
                        }
                    }
                    SnsMethodCalculate.markEndTimeMs("checkAdDeviceSupportH265", "com.tencent.mm.plugin.sns.ad.helper.AdH265Helper");
                }
                hVar.f326325f = new a(hVar, currentTimeMillis);
                if (!((gp.l) yz3.j.c(gp.l.class)).xq(hVar)) {
                    Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]SubCoreCdnTransport addRecvTask succ mediaId:%s", "[image-flow]", this.f343830f.f343793b, hVar.field_mediaId);
                    i15 = 1;
                    Integer valueOf222 = Integer.valueOf(i15);
                    SnsMethodCalculate.markEndTimeMs(str5, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                    return valueOf222;
                }
                i16 = 2;
                Log.w("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]SubCoreCdnTransport addRecvTask failed mediaId:%s", "[image-flow]", this.f343830f.f343793b, hVar.field_mediaId);
            } else {
                i16 = 2;
            }
            i15 = i16;
            Integer valueOf2222 = Integer.valueOf(i15);
            SnsMethodCalculate.markEndTimeMs(str5, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
            return valueOf2222;
        }
        str = "";
        if (!Util.isNullOrNil(str)) {
        }
        String format2 = String.format(HttpWrapperBase.PROTOCAL_HTTPS + WeChatHosts.domainString(R.string.fyt) + "/?version=%d&uin=%s&nettype=%d&signal=%d%s", Integer.valueOf(yv3.d.f349176g), gh.q.a(f1.oO0()), Integer.valueOf(NetStatusUtil.getNetTypeForStat(MMApplicationContext.getContext())), Integer.valueOf(ConnectivityCompat.Companion.getCompatMixStrength()), str);
        aVar = this.f343830f;
        if (9 != aVar.f343797f) {
        }
        this.f343832h = Util.nowMilliSecond();
        z15 = this.f343830f.f343796e;
        if (!z15) {
        }
        if (!z15) {
        }
        String d152 = ((jt3.b) z.q(jt3.b.class)).gv0().d(str2);
        b15 = (long) ((jt3.b) z.q(jt3.b.class)).gv0().b(str3, 0);
        a aVar32 = this.f343830f;
        Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]pack.isAlbum %s pack.isthumb %s hostvalue %s dcipTime %s", "[image-flow]", aVar32.f343793b, Boolean.valueOf(aVar32.f343796e), Boolean.valueOf(this.f343830f.f343795d), d152, Long.valueOf(b15));
        if (b15 <= 0) {
        }
        boolean n152 = n(o3Var, this.f343830f.f343794c, b15, d152);
        this.f343832h = Util.milliSecondsToNow(this.f343832h);
        aVar2 = this.f343830f;
        if (9 != aVar2.f343797f) {
        }
        str4 = "attachSnsImgTaskInfo";
        SnsMethodCalculate.markStartTimeMs(str4, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        try {
            this.f343835k = new URL(this.f343830f.f343794c).getHost();
            ArrayList arrayList42 = new ArrayList();
            this.f343833i = com.tencent.mm.network.c.f(this.f343835k, false, arrayList42);
            ArrayList arrayList52 = new ArrayList();
            int f152 = com.tencent.mm.network.c.f(this.f343835k, true, arrayList52);
            if (9 != this.f343830f.f343797f) {
            }
            hVar.V = this.f343830f.f343794c;
            hVar.W = this.f343835k;
            hVar.X = format2;
            hVar.Z = m(arrayList);
            hVar.f326320p0 = m(arrayList2);
            hVar.f326321x0 = this.f343833i;
            hVar.f326322y0 = i18;
            hVar.T0 = z17;
            hVar.U0 = "" + ConnectivityCompat.Companion.getCompatMixStrength();
            a aVar72 = this.f343830f;
            hVar.V0 = aVar72.f343803l.f174922a;
            i19 = aVar72.f343797f;
            if (i19 != 8) {
            }
            Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]attachSnsImgTaskInfo success reqDownType:%d taskInfo:%s", "[image-flow]", hVar.field_mediaId, Integer.valueOf(this.f343830f.f343797f), hVar);
            SnsMethodCalculate.markEndTimeMs(str6, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
            z16 = true;
        } catch (MalformedURLException e25) {
            e15 = e25;
            str5 = "doInBackground";
            Log.printErrStackTrace("MicroMsg.SnsCdnDownloadBase", e15, "[%s][media:%s]", "[image-flow]", hVar.field_mediaId);
            Log.w("MicroMsg.SnsCdnDownloadBase", "attachSnsImgTaskInfo fail:" + e15);
            SnsMethodCalculate.markEndTimeMs(str4, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
            z16 = false;
            if (!z16) {
            }
            i15 = i16;
            Integer valueOf22222 = Integer.valueOf(i15);
            SnsMethodCalculate.markEndTimeMs(str5, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
            return valueOf22222;
        }
        if (!z16) {
        }
        i15 = i16;
        Integer valueOf222222 = Integer.valueOf(i15);
        SnsMethodCalculate.markEndTimeMs(str5, "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        return valueOf222222;
    }

    public abstract int l();

    public final String[] m(List<String> list) {
        SnsMethodCalculate.markStartTimeMs("getStringArray", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        if (list == null) {
            String[] strArr = new String[0];
            SnsMethodCalculate.markEndTimeMs("getStringArray", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
            return strArr;
        }
        int size = list.size();
        String[] strArr2 = new String[size];
        for (int i15 = 0; i15 < size; i15++) {
            strArr2[i15] = list.get(i15);
        }
        SnsMethodCalculate.markEndTimeMs("getStringArray", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        return strArr2;
    }

    public boolean n(o3 o3Var, String str, long j15, String str2) {
        SnsMethodCalculate.markStartTimeMs("idDcIp", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        if (str == null) {
            SnsMethodCalculate.markEndTimeMs("idDcIp", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
            return false;
        }
        try {
            URL url = new URL(str);
            if (o3Var == null) {
                SnsMethodCalculate.markEndTimeMs("idDcIp", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                return false;
            } else if (str2 == null) {
                SnsMethodCalculate.markEndTimeMs("idDcIp", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                return false;
            } else if (str2.indexOf(url.getHost()) == -1) {
                SnsMethodCalculate.markEndTimeMs("idDcIp", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                return false;
            } else {
                int i15 = o3Var.f174923b;
                if (i15 == 0) {
                    SnsMethodCalculate.markEndTimeMs("idDcIp", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                    return false;
                } else if (Util.secondsToNow((long) i15) > j15) {
                    SnsMethodCalculate.markEndTimeMs("idDcIp", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                    return true;
                } else {
                    SnsMethodCalculate.markEndTimeMs("idDcIp", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                    return false;
                }
            }
        } catch (Exception e15) {
            Log.e("MicroMsg.SnsCdnDownloadBase", "error for check dcip %s", e15.getMessage());
            SnsMethodCalculate.markEndTimeMs("idDcIp", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
            return false;
        }
    }

    public boolean o() {
        SnsMethodCalculate.markStartTimeMs("isDelFileBeforeDownload", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        SnsMethodCalculate.markEndTimeMs("isDelFileBeforeDownload", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        return true;
    }

    public void p(Integer num) {
        SnsMethodCalculate.markStartTimeMs("onPostExecute", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        SnsMethodCalculate.markEndTimeMs("onPostExecute", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
    }

    public abstract boolean q();

    public boolean r(int i15) {
        SnsMethodCalculate.markStartTimeMs("processGroupDownloadSuccessData", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        SnsMethodCalculate.markEndTimeMs("processGroupDownloadSuccessData", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        return false;
    }

    public void s() {
        String str;
        SnsMethodCalculate.markStartTimeMs("thumbAddDecode", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
        if (f1.RO0()) {
            SnsMethodCalculate.markEndTimeMs("thumbAddDecode", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
            return;
        }
        System.currentTimeMillis();
        if (this.f343830f.f343799h.a() == 4) {
            Log.i("MicroMsg.SnsCdnDownloadBase", "decodeType blur thumb");
            String V = b0.V(this.f343831g);
            String str2 = this.f343830f.c() + V;
            this.f343828d = u63.a.b(str2, this.f343830f.c() + b0.N(this.f343831g));
            p gO0 = f1.gO0();
            a aVar = this.f343830f;
            gO0.E(aVar.f343793b, this.f343828d, aVar.f343799h.a());
        } else if (this.f343830f.f343799h.a() == 5) {
            Log.i("MicroMsg.SnsCdnDownloadBase", "decodeType blur grid");
            String V2 = b0.V(this.f343831g);
            String str3 = this.f343830f.c() + V2;
            this.f343828d = u63.a.b(str3, this.f343830f.c() + b0.M(this.f343831g));
            p gO02 = f1.gO0();
            a aVar2 = this.f343830f;
            gO02.E(aVar2.f343793b, this.f343828d, aVar2.f343799h.a());
        } else if (this.f343830f.f343799h.b().size() <= 1) {
            p gO03 = f1.gO0();
            a aVar3 = this.f343830f;
            gO03.E(aVar3.f343793b, this.f343828d, aVar3.f343799h.a());
        } else {
            f1.gO0().E(this.f343830f.f343793b, this.f343828d, 0);
            LinkedList linkedList = new LinkedList();
            int i15 = 0;
            while (i15 < this.f343830f.f343799h.b().size() && i15 < 4) {
                mc3 mc32 = this.f343830f.f343799h.b().get(i15);
                n h15 = f1.gO0().h(0, mc32.f29560d);
                if (b0.f(h15)) {
                    linkedList.add(h15);
                    Log.i("MicroMsg.SnsCdnDownloadBase", "merge bitmap from " + h15 + " " + mc32.f29560d);
                    i15++;
                } else {
                    SnsMethodCalculate.markEndTimeMs("thumbAddDecode", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
                    return;
                }
            }
            this.f343828d = n.c(b0.p0(linkedList, f1.iO0()));
            Log.i("MicroMsg.SnsCdnDownloadBase", "merge bitmap " + this.f343830f.f343799h.c() + " " + this.f343828d);
            f1.gO0().E(this.f343830f.f343799h.c(), this.f343828d, this.f343830f.f343799h.a());
        }
        if (this.f343830f.f343799h.a() == 0) {
            str = "0-" + this.f343830f.f343799h.c();
        } else if (this.f343830f.f343799h.a() == 1) {
            str = "1-" + this.f343830f.f343799h.c();
        } else if (this.f343830f.f343799h.a() == 4) {
            str = "4-" + this.f343830f.f343799h.c();
        } else if (this.f343830f.f343799h.a() == 5) {
            str = "5-" + this.f343830f.f343799h.c();
        } else {
            str = this.f343830f.f343799h.a() == 3 ? b0.x(3, this.f343830f.f343799h.c()) : null;
        }
        Log.i("MicroMsg.SnsCdnDownloadBase", "[%s][media:%s]thumbAddDecode cacheName1: %s.", "[image-flow]", this.f343830f.f343793b, str);
        p gO04 = f1.gO0();
        String str4 = this.f343830f.f343793b;
        gO04.getClass();
        SnsMethodCalculate.markStartTimeMs("setRefImageView", "com.tencent.mm.plugin.sns.model.LazyerImageLoader2");
        gO04.m0(str4, str, null);
        SnsMethodCalculate.markEndTimeMs("setRefImageView", "com.tencent.mm.plugin.sns.model.LazyerImageLoader2");
        SnsMethodCalculate.markEndTimeMs("thumbAddDecode", "com.tencent.mm.plugin.sns.model.download.SnsCdnDownloadBase");
    }
}