package com.tencent.mm.ah;

import android.annotation.SuppressLint;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.compatible.util.g;
import com.tencent.mm.model.ao;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.az.a;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.vfs.e;

@SuppressLint({"DefaultLocale"})
class e$b implements a {
    public boolean aAR = true;
    public String frH = null;
    String frI;
    final /* synthetic */ e frJ;
    private g.a frK;
    boolean frq = false;
    public h frs = null;

    public e$b(e eVar, h hVar) {
        this.frJ = eVar;
        AppMethodBeat.i(77907);
        this.frs = hVar;
        o.acd();
        this.frH = d.C(hVar.getUsername(), true);
        this.frI = this.frH + ".tmp";
        this.frK = new g.a();
        AppMethodBeat.o(77907);
    }

    /* JADX WARNING: Removed duplicated region for block: B:80:0x0279 A:{SYNTHETIC, Splitter:B:80:0x0279} */
    /* JADX WARNING: Removed duplicated region for block: B:83:0x0280 A:{Catch:{ Exception -> 0x028c }} */
    /* JADX WARNING: Removed duplicated region for block: B:85:0x0285 A:{Catch:{ Exception -> 0x028c }} */
    /* JADX WARNING: Removed duplicated region for block: B:80:0x0279 A:{SYNTHETIC, Splitter:B:80:0x0279} */
    /* JADX WARNING: Removed duplicated region for block: B:83:0x0280 A:{Catch:{ Exception -> 0x028c }} */
    /* JADX WARNING: Removed duplicated region for block: B:85:0x0285 A:{Catch:{ Exception -> 0x028c }} */
    /* JADX WARNING: Removed duplicated region for block: B:80:0x0279 A:{SYNTHETIC, Splitter:B:80:0x0279} */
    /* JADX WARNING: Removed duplicated region for block: B:83:0x0280 A:{Catch:{ Exception -> 0x028c }} */
    /* JADX WARNING: Removed duplicated region for block: B:85:0x0285 A:{Catch:{ Exception -> 0x028c }} */
    /* JADX WARNING: Removed duplicated region for block: B:67:0x021a A:{SYNTHETIC, Splitter:B:67:0x021a} */
    /* JADX WARNING: Removed duplicated region for block: B:70:0x0221 A:{Catch:{ Exception -> 0x022a }} */
    /* JADX WARNING: Removed duplicated region for block: B:72:0x0226 A:{Catch:{ Exception -> 0x022a }} */
    /* JADX WARNING: Removed duplicated region for block: B:80:0x0279 A:{SYNTHETIC, Splitter:B:80:0x0279} */
    /* JADX WARNING: Removed duplicated region for block: B:83:0x0280 A:{Catch:{ Exception -> 0x028c }} */
    /* JADX WARNING: Removed duplicated region for block: B:85:0x0285 A:{Catch:{ Exception -> 0x028c }} */
    public final boolean acf() {
        /*
        r13 = this;
        r12 = 2;
        r10 = 0;
        r11 = 77908; // 0x13054 float:1.09172E-40 double:3.84917E-319;
        r9 = 1;
        r8 = 0;
        com.tencent.matrix.trace.core.AppMethodBeat.i(r11);
        r0 = r13.frs;
        if (r0 != 0) goto L_0x0013;
    L_0x000e:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r11);
        r0 = r8;
    L_0x0012:
        return r0;
    L_0x0013:
        r0 = r13.frs;
        r1 = r0.ack();
        r0 = com.tencent.mm.plugin.emoji.b.c.class;
        r0 = com.tencent.mm.kernel.g.K(r0);
        r0 = (com.tencent.mm.plugin.emoji.b.c) r0;
        r2 = r0.biY();
        r0 = com.tencent.mm.plugin.expt.a.a.class;
        r0 = com.tencent.mm.kernel.g.K(r0);
        r0 = (com.tencent.mm.plugin.expt.a.a) r0;
        r3 = com.tencent.mm.plugin.expt.a.a$a.clicfg_avatar_download_big_hevc;
        r0 = r0.a(r3, r8);
        if (r2 == 0) goto L_0x02cb;
    L_0x0035:
        if (r0 == 0) goto L_0x02cb;
    L_0x0037:
        r0 = "MicroMsg.GetHDHeadImgHelper";
        r2 = "GetHeadImgObj: get hevc";
        com.tencent.mm.sdk.platformtools.ab.i(r0, r2);
        r0 = "?";
        r0 = r1.contains(r0);
        if (r0 == 0) goto L_0x0106;
    L_0x0049:
        r0 = new java.lang.StringBuilder;
        r0.<init>();
        r0 = r0.append(r1);
        r1 = "&tp=wxpic";
        r0 = r0.append(r1);
        r0 = r0.toString();
    L_0x005d:
        r1 = com.tencent.mm.plugin.report.service.h.pYm;
        r2 = 138; // 0x8a float:1.93E-43 double:6.8E-322;
        r4 = 60;
        r6 = 1;
        r1.k(r2, r4, r6);
    L_0x0068:
        r1 = "";
        r2 = com.tencent.mm.kernel.g.RN();
        r2 = r2.QY();
        if (r2 == 0) goto L_0x00b1;
    L_0x0075:
        r1 = "http://weixin.qq.com/?version=%d&uin=%s&nettype=%d&signal=%d";
        r2 = 4;
        r2 = new java.lang.Object[r2];
        r3 = com.tencent.mm.protocal.d.vxo;
        r3 = java.lang.Integer.valueOf(r3);
        r2[r8] = r3;
        com.tencent.mm.kernel.g.RN();
        r3 = com.tencent.mm.kernel.a.QF();
        r3 = com.tencent.mm.a.p.getString(r3);
        r2[r9] = r3;
        r3 = com.tencent.mm.sdk.platformtools.ah.getContext();
        r3 = com.tencent.mm.sdk.platformtools.at.getNetTypeForStat(r3);
        r3 = java.lang.Integer.valueOf(r3);
        r2[r12] = r3;
        r3 = 3;
        r4 = com.tencent.mm.sdk.platformtools.ah.getContext();
        r4 = com.tencent.mm.sdk.platformtools.at.getStrength(r4);
        r4 = java.lang.Integer.valueOf(r4);
        r2[r3] = r4;
        r1 = java.lang.String.format(r1, r2);
    L_0x00b1:
        r2 = "MicroMsg.GetHDHeadImgHelper";
        r3 = "dkreferer dkavatar user: %s referer: %s  url:%s";
        r4 = 3;
        r4 = new java.lang.Object[r4];
        r5 = r13.frs;
        r5 = r5.getUsername();
        r4[r8] = r5;
        r4[r9] = r1;
        r4[r12] = r0;
        com.tencent.mm.sdk.platformtools.ab.d(r2, r3, r4);
        r13.aAR = r9;
        r2 = 0;
        r3 = com.tencent.mm.network.b.a(r0, r2);	 Catch:{ Exception -> 0x02bc, all -> 0x0273 }
        r2 = "GET";
        r3.setRequestMethod(r2);	 Catch:{ Exception -> 0x02c2, all -> 0x02b0 }
        r2 = "referer";
        r3.setRequestProperty(r2, r1);	 Catch:{ Exception -> 0x02c2, all -> 0x02b0 }
        r1 = 5000; // 0x1388 float:7.006E-42 double:2.4703E-320;
        r3.setConnectTimeout(r1);	 Catch:{ Exception -> 0x02c2, all -> 0x02b0 }
        r1 = 5000; // 0x1388 float:7.006E-42 double:2.4703E-320;
        r3.setReadTimeout(r1);	 Catch:{ Exception -> 0x02c2, all -> 0x02b0 }
        r1 = com.tencent.mm.network.b.a(r3);	 Catch:{ Exception -> 0x02c2, all -> 0x02b0 }
        if (r1 == 0) goto L_0x0140;
    L_0x00ec:
        r1 = "MicroMsg.GetHDHeadImgHelper";
        r2 = "checkHttpConnection failed! url:%s";
        r4 = 1;
        r4 = new java.lang.Object[r4];	 Catch:{ Exception -> 0x02c2, all -> 0x02b0 }
        r5 = 0;
        r4[r5] = r0;	 Catch:{ Exception -> 0x02c2, all -> 0x02b0 }
        com.tencent.mm.sdk.platformtools.ab.e(r1, r2, r4);	 Catch:{ Exception -> 0x02c2, all -> 0x02b0 }
        r0 = r3.connection;	 Catch:{ Exception -> 0x011c }
        r0.disconnect();	 Catch:{ Exception -> 0x011c }
    L_0x0100:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r11);
        r0 = r9;
        goto L_0x0012;
    L_0x0106:
        r0 = new java.lang.StringBuilder;
        r0.<init>();
        r0 = r0.append(r1);
        r1 = "?tp=wxpic";
        r0 = r0.append(r1);
        r0 = r0.toString();
        goto L_0x005d;
    L_0x011c:
        r0 = move-exception;
        r1 = "MicroMsg.GetHDHeadImgHelper";
        r2 = "exception:%s";
        r3 = new java.lang.Object[r9];
        r4 = com.tencent.mm.sdk.platformtools.bo.l(r0);
        r3[r8] = r4;
        com.tencent.mm.sdk.platformtools.ab.e(r1, r2, r3);
        r1 = "MicroMsg.GetHDHeadImgHelper";
        r2 = "close conn failed : %s";
        r3 = new java.lang.Object[r9];
        r0 = r0.getMessage();
        r3[r8] = r0;
        com.tencent.mm.sdk.platformtools.ab.e(r1, r2, r3);
        goto L_0x0100;
    L_0x0140:
        r1 = "X-Enc";
        r2 = 0;
        r1 = r3.getHeaderFieldInt(r1, r2);	 Catch:{ Exception -> 0x02c2, all -> 0x02b0 }
        if (r1 != r9) goto L_0x0172;
    L_0x014a:
        r1 = r9;
    L_0x014b:
        r13.frq = r1;	 Catch:{ Exception -> 0x02c2, all -> 0x02b0 }
        r1 = r3.getInputStream();	 Catch:{ Exception -> 0x02c2, all -> 0x02b0 }
        if (r1 != 0) goto L_0x0198;
    L_0x0153:
        r2 = "MicroMsg.GetHDHeadImgHelper";
        r4 = "getInputStream failed. url:%s";
        r5 = 1;
        r5 = new java.lang.Object[r5];	 Catch:{ Exception -> 0x02c7, all -> 0x02b4 }
        r6 = 0;
        r5[r6] = r0;	 Catch:{ Exception -> 0x02c7, all -> 0x02b4 }
        com.tencent.mm.sdk.platformtools.ab.d(r2, r4, r5);	 Catch:{ Exception -> 0x02c7, all -> 0x02b4 }
        r0 = r3.connection;	 Catch:{ Exception -> 0x0174 }
        r0.disconnect();	 Catch:{ Exception -> 0x0174 }
        if (r1 == 0) goto L_0x016c;
    L_0x0169:
        r1.close();	 Catch:{ Exception -> 0x0174 }
    L_0x016c:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r11);
        r0 = r9;
        goto L_0x0012;
    L_0x0172:
        r1 = r8;
        goto L_0x014b;
    L_0x0174:
        r0 = move-exception;
        r1 = "MicroMsg.GetHDHeadImgHelper";
        r2 = "exception:%s";
        r3 = new java.lang.Object[r9];
        r4 = com.tencent.mm.sdk.platformtools.bo.l(r0);
        r3[r8] = r4;
        com.tencent.mm.sdk.platformtools.ab.e(r1, r2, r3);
        r1 = "MicroMsg.GetHDHeadImgHelper";
        r2 = "close conn failed : %s";
        r3 = new java.lang.Object[r9];
        r0 = r0.getMessage();
        r3[r8] = r0;
        com.tencent.mm.sdk.platformtools.ab.e(r1, r2, r3);
        goto L_0x016c;
    L_0x0198:
        r0 = 1024; // 0x400 float:1.435E-42 double:5.06E-321;
        r2 = new byte[r0];	 Catch:{ Exception -> 0x02c7, all -> 0x02b4 }
        r0 = r13.frI;	 Catch:{ Exception -> 0x02c7, all -> 0x02b4 }
        r4 = 0;
        r10 = com.tencent.mm.vfs.e.L(r0, r4);	 Catch:{ Exception -> 0x02c7, all -> 0x02b4 }
        r0 = r8;
    L_0x01a4:
        r4 = r1.read(r2);	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        r5 = -1;
        if (r4 == r5) goto L_0x01b1;
    L_0x01ab:
        r5 = 0;
        r10.write(r2, r5, r4);	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        r0 = r0 + r4;
        goto L_0x01a4;
    L_0x01b1:
        r2 = "Size";
        r4 = r3.connection;	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        r4 = r4.getContentLength();	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        r2 = r3.getHeaderFieldInt(r2, r4);	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        if (r0 != r2) goto L_0x01d8;
    L_0x01c0:
        r0 = 0;
        r13.aAR = r0;	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
    L_0x01c3:
        r0 = r3.connection;	 Catch:{ Exception -> 0x024e }
        r0.disconnect();	 Catch:{ Exception -> 0x024e }
        if (r1 == 0) goto L_0x01cd;
    L_0x01ca:
        r1.close();	 Catch:{ Exception -> 0x024e }
    L_0x01cd:
        if (r10 == 0) goto L_0x01d2;
    L_0x01cf:
        r10.close();	 Catch:{ Exception -> 0x024e }
    L_0x01d2:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r11);
        r0 = r9;
        goto L_0x0012;
    L_0x01d8:
        r2 = "MicroMsg.GetHDHeadImgHelper";
        r4 = "download size error. %d, %s, %d";
        r5 = 3;
        r5 = new java.lang.Object[r5];	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        r6 = 0;
        r0 = java.lang.Integer.valueOf(r0);	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        r5[r6] = r0;	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        r0 = 1;
        r6 = "Size";
        r6 = r3.getHeaderField(r6);	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        r5[r0] = r6;	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        r0 = 2;
        r6 = r3.connection;	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        r6 = r6.getContentLength();	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        r6 = java.lang.Integer.valueOf(r6);	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        r5[r0] = r6;	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        com.tencent.mm.sdk.platformtools.ab.e(r2, r4, r5);	 Catch:{ Exception -> 0x0203, all -> 0x02b7 }
        goto L_0x01c3;
    L_0x0203:
        r0 = move-exception;
        r2 = r10;
    L_0x0205:
        r4 = "MicroMsg.GetHDHeadImgHelper";
        r5 = "exception:%s";
        r6 = 1;
        r6 = new java.lang.Object[r6];	 Catch:{ all -> 0x02ba }
        r7 = 0;
        r0 = com.tencent.mm.sdk.platformtools.bo.l(r0);	 Catch:{ all -> 0x02ba }
        r6[r7] = r0;	 Catch:{ all -> 0x02ba }
        com.tencent.mm.sdk.platformtools.ab.e(r4, r5, r6);	 Catch:{ all -> 0x02ba }
        if (r3 == 0) goto L_0x021f;
    L_0x021a:
        r0 = r3.connection;	 Catch:{ Exception -> 0x022a }
        r0.disconnect();	 Catch:{ Exception -> 0x022a }
    L_0x021f:
        if (r1 == 0) goto L_0x0224;
    L_0x0221:
        r1.close();	 Catch:{ Exception -> 0x022a }
    L_0x0224:
        if (r2 == 0) goto L_0x01d2;
    L_0x0226:
        r2.close();	 Catch:{ Exception -> 0x022a }
        goto L_0x01d2;
    L_0x022a:
        r0 = move-exception;
        r1 = "MicroMsg.GetHDHeadImgHelper";
        r2 = "exception:%s";
        r3 = new java.lang.Object[r9];
        r4 = com.tencent.mm.sdk.platformtools.bo.l(r0);
        r3[r8] = r4;
        com.tencent.mm.sdk.platformtools.ab.e(r1, r2, r3);
        r1 = "MicroMsg.GetHDHeadImgHelper";
        r2 = "close conn failed : %s";
        r3 = new java.lang.Object[r9];
        r0 = r0.getMessage();
        r3[r8] = r0;
        com.tencent.mm.sdk.platformtools.ab.e(r1, r2, r3);
        goto L_0x01d2;
    L_0x024e:
        r0 = move-exception;
        r1 = "MicroMsg.GetHDHeadImgHelper";
        r2 = "exception:%s";
        r3 = new java.lang.Object[r9];
        r4 = com.tencent.mm.sdk.platformtools.bo.l(r0);
        r3[r8] = r4;
        com.tencent.mm.sdk.platformtools.ab.e(r1, r2, r3);
        r1 = "MicroMsg.GetHDHeadImgHelper";
        r2 = "close conn failed : %s";
        r3 = new java.lang.Object[r9];
        r0 = r0.getMessage();
        r3[r8] = r0;
        com.tencent.mm.sdk.platformtools.ab.e(r1, r2, r3);
        goto L_0x01d2;
    L_0x0273:
        r0 = move-exception;
        r1 = r10;
        r2 = r10;
        r3 = r10;
    L_0x0277:
        if (r3 == 0) goto L_0x027e;
    L_0x0279:
        r3 = r3.connection;	 Catch:{ Exception -> 0x028c }
        r3.disconnect();	 Catch:{ Exception -> 0x028c }
    L_0x027e:
        if (r1 == 0) goto L_0x0283;
    L_0x0280:
        r1.close();	 Catch:{ Exception -> 0x028c }
    L_0x0283:
        if (r2 == 0) goto L_0x0288;
    L_0x0285:
        r2.close();	 Catch:{ Exception -> 0x028c }
    L_0x0288:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r11);
        throw r0;
    L_0x028c:
        r1 = move-exception;
        r2 = "MicroMsg.GetHDHeadImgHelper";
        r3 = "exception:%s";
        r4 = new java.lang.Object[r9];
        r5 = com.tencent.mm.sdk.platformtools.bo.l(r1);
        r4[r8] = r5;
        com.tencent.mm.sdk.platformtools.ab.e(r2, r3, r4);
        r2 = "MicroMsg.GetHDHeadImgHelper";
        r3 = "close conn failed : %s";
        r4 = new java.lang.Object[r9];
        r1 = r1.getMessage();
        r4[r8] = r1;
        com.tencent.mm.sdk.platformtools.ab.e(r2, r3, r4);
        goto L_0x0288;
    L_0x02b0:
        r0 = move-exception;
        r1 = r10;
        r2 = r10;
        goto L_0x0277;
    L_0x02b4:
        r0 = move-exception;
        r2 = r10;
        goto L_0x0277;
    L_0x02b7:
        r0 = move-exception;
        r2 = r10;
        goto L_0x0277;
    L_0x02ba:
        r0 = move-exception;
        goto L_0x0277;
    L_0x02bc:
        r0 = move-exception;
        r1 = r10;
        r2 = r10;
        r3 = r10;
        goto L_0x0205;
    L_0x02c2:
        r0 = move-exception;
        r1 = r10;
        r2 = r10;
        goto L_0x0205;
    L_0x02c7:
        r0 = move-exception;
        r2 = r10;
        goto L_0x0205;
    L_0x02cb:
        r0 = r1;
        goto L_0x0068;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.ah.e$b.acf():boolean");
    }

    public final boolean acg() {
        AppMethodBeat.i(77909);
        if (this.frJ.frF) {
            AppMethodBeat.o(77909);
            return false;
        } else if (this.aAR || bo.isNullOrNil(this.frH)) {
            this.frJ.frD.cr(4, -1);
            AppMethodBeat.o(77909);
            return false;
        } else {
            ab.d("MicroMsg.GetHDHeadImgHelper", "dkavatar user:" + this.frs.getUsername() + " urltime:" + this.frK.Mr());
            if (ao.a.flv != null) {
                ao.a.flv.cm((int) e.asZ(this.frI), 0);
            }
            this.frJ.frG.e(new e$a(this.frJ, this.frJ.fro, this.frH, this.frI));
            AppMethodBeat.o(77909);
            return true;
        }
    }
}
