package com.tencent.mm.plugin.mmsight.model;

import android.app.ActivityManager;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Point;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.compatible.e.q;
import com.tencent.mm.compatible.e.v;
import com.tencent.mm.modelcontrol.VideoTransPara;
import com.tencent.mm.plugin.mmsight.d;
import com.tencent.mm.plugin.mmsight.model.g.b;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.storage.ac.a;
import com.tencent.mm.storage.bs;
import com.tencent.mm.ui.base.t;
import com.tencent.ytcommon.BuildConfig;

public final class j {
    static int fXT;
    static double ouA;
    public static boolean ouw = true;
    public static boolean oux = false;
    public static boolean ouy = false;
    public static o ouz;

    public static boolean d(Point point) {
        AppMethodBeat.i(76526);
        if (oux) {
            Context context = ah.getContext();
            Resources resources = ah.getResources();
            Object[] objArr = new Object[1];
            objArr[0] = ouz == null ? BuildConfig.FLAVOR : Integer.valueOf(ouz.ouK);
            t.makeText(context, resources.getString(2131300602, objArr), 1).show();
            AppMethodBeat.o(76526);
            return false;
        }
        ab.i("MicroMsg.MMSightRecorderConfig", "checkMediaCodecHappy, deviceInfo recorderType: %s, recorderOption: %s, isUseRecorderOption: %s", new Object[]{Integer.valueOf(q.etj.etz), Integer.valueOf(q.etj.etG), Boolean.valueOf(ouy)});
        if (ouy) {
            AppMethodBeat.o(76526);
            return false;
        } else if (q.etj.etz != -1) {
            AppMethodBeat.o(76526);
            return true;
        } else if (ouz != null && 1 == ouz.etz) {
            AppMethodBeat.o(76526);
            return true;
        } else if (point == null) {
            AppMethodBeat.o(76526);
            return false;
        } else if (d.yO(point.x) && d.yO(point.y)) {
            AppMethodBeat.o(76526);
            return true;
        } else {
            if (ouz != null) {
                ab.i("MicroMsg.MMSightRecorderConfig", "checkMediaCodecHappy not happy %s", new Object[]{point.toString()});
                ouz.etz = 1;
            }
            AppMethodBeat.o(76526);
            return false;
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:52:0x017e  */
    /* JADX WARNING: Removed duplicated region for block: B:21:0x00de  */
    /* JADX WARNING: Removed duplicated region for block: B:68:0x01c4  */
    /* JADX WARNING: Removed duplicated region for block: B:21:0x00de  */
    /* JADX WARNING: Removed duplicated region for block: B:52:0x017e  */
    /* JADX WARNING: Removed duplicated region for block: B:31:0x00fd  */
    /* JADX WARNING: Removed duplicated region for block: B:64:0x01bb  */
    /* JADX WARNING: Removed duplicated region for block: B:68:0x01c4  */
    public static void a(android.hardware.Camera.Parameters r12, boolean r13) {
        /*
        r7 = 19;
        r11 = 76527; // 0x12aef float:1.07237E-40 double:3.78094E-319;
        r10 = -1;
        r1 = 0;
        r2 = 1;
        com.tencent.matrix.trace.core.AppMethodBeat.i(r11);
        r0 = oux;
        if (r0 == 0) goto L_0x003d;
    L_0x000f:
        r3 = com.tencent.mm.sdk.platformtools.ah.getContext();
        r4 = com.tencent.mm.sdk.platformtools.ah.getResources();
        r5 = 2131300602; // 0x7f0910fa float:1.8219238E38 double:1.0530024084E-314;
        r6 = new java.lang.Object[r2];
        r0 = ouz;
        if (r0 != 0) goto L_0x0034;
    L_0x0020:
        r0 = "";
    L_0x0023:
        r6[r1] = r0;
        r0 = r4.getString(r5, r6);
        r0 = com.tencent.mm.ui.base.t.makeText(r3, r0, r2);
        r0.show();
        com.tencent.matrix.trace.core.AppMethodBeat.o(r11);
    L_0x0033:
        return;
    L_0x0034:
        r0 = ouz;
        r0 = r0.ouK;
        r0 = java.lang.Integer.valueOf(r0);
        goto L_0x0023;
    L_0x003d:
        r0 = "MicroMsg.MMSightRecorderConfig";
        r3 = "autoConfig, recorderOption: %s, isUseRecorderOption: %s";
        r4 = 2;
        r4 = new java.lang.Object[r4];
        r5 = com.tencent.mm.compatible.e.q.etj;
        r5 = r5.etG;
        r5 = java.lang.Integer.valueOf(r5);
        r4[r1] = r5;
        r5 = ouy;
        r5 = java.lang.Boolean.valueOf(r5);
        r4[r2] = r5;
        com.tencent.mm.sdk.platformtools.ab.i(r0, r3, r4);
        r0 = ouy;
        if (r0 == 0) goto L_0x0063;
    L_0x005f:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r11);
        goto L_0x0033;
    L_0x0063:
        r4 = com.tencent.mm.plugin.mmsight.d.bPg();
        r0 = com.tencent.mm.plugin.mmsight.model.CaptureMMProxy.getInstance();
        r3 = "SightMediaCodecMinApiLevel";
        r0 = r0.getDynamicConfig(r3);
        r0 = com.tencent.mm.sdk.platformtools.bo.getInt(r0, r7);
        r3 = com.tencent.mm.plugin.mmsight.model.CaptureMMProxy.getInstance();
        r5 = "Sight1080pRecordMinApiLevel";
        r3 = r3.getDynamicConfig(r5);
        r3 = com.tencent.mm.sdk.platformtools.bo.getInt(r3, r7);
        r5 = com.tencent.mm.plugin.mmsight.model.CaptureMMProxy.getInstance();
        r6 = "Sight720pRecordMinApiLevel";
        r5 = r5.getDynamicConfig(r6);
        r5 = com.tencent.mm.sdk.platformtools.bo.getInt(r5, r7);
        r6 = "MicroMsg.MMSightRecorderConfig";
        r7 = "apiLevel: %s record1080pApiLevel: %s, record720pApiLevel: %s";
        r8 = 3;
        r8 = new java.lang.Object[r8];
        r0 = java.lang.Integer.valueOf(r0);
        r8[r1] = r0;
        r0 = java.lang.Integer.valueOf(r3);
        r8[r2] = r0;
        r0 = 2;
        r9 = java.lang.Integer.valueOf(r5);
        r8[r0] = r9;
        com.tencent.mm.sdk.platformtools.ab.i(r6, r7, r8);
        r0 = com.tencent.mm.compatible.e.q.etj;
        r0 = r0.etF;
        if (r0 == r10) goto L_0x00c1;
    L_0x00b9:
        r0 = com.tencent.mm.compatible.e.q.etj;
        r0 = r0.etF;
        r0 = r0 & 1;
        if (r0 == 0) goto L_0x01d0;
    L_0x00c1:
        r0 = com.tencent.mm.compatible.e.q.etj;
        r0 = r0.etF;
        if (r0 == r10) goto L_0x012c;
    L_0x00c7:
        r0 = com.tencent.mm.compatible.e.q.etj;
        r0 = r0.etF;
        r0 = r0 & 1;
        if (r0 == 0) goto L_0x012c;
    L_0x00cf:
        r0 = ouz;
        r0 = r0.bPG();
        r0.ouM = r2;
        r0 = r2;
    L_0x00d8:
        r3 = com.tencent.mm.compatible.e.q.etj;
        r3 = r3.etA;
        if (r3 == r10) goto L_0x017e;
    L_0x00de:
        r6 = ouz;
        r3 = com.tencent.mm.compatible.e.q.etj;
        r3 = r3.etA;
        if (r3 != r2) goto L_0x017b;
    L_0x00e6:
        r3 = r2;
    L_0x00e7:
        r6.ouL = r3;
    L_0x00e9:
        r3 = com.tencent.mm.compatible.e.q.etj;
        r3 = r3.etF;
        if (r3 == r10) goto L_0x00f7;
    L_0x00ef:
        r3 = com.tencent.mm.compatible.e.q.etj;
        r3 = r3.etF;
        r3 = r3 & 2;
        if (r3 == 0) goto L_0x0110;
    L_0x00f7:
        r3 = com.tencent.mm.compatible.e.q.etj;
        r3 = r3.etF;
        if (r3 == r10) goto L_0x0184;
    L_0x00fd:
        r3 = com.tencent.mm.compatible.e.q.etj;
        r3 = r3.etF;
        r3 = r3 & 2;
        if (r3 == 0) goto L_0x0184;
    L_0x0105:
        r0 = ouz;
        r0 = r0.bPE();
        r0.ouM = r1;
        r0.bPF();
    L_0x0110:
        r0 = ouz;
        r0.ouK = r10;
        r0 = "MicroMsg.MMSightRecorderConfig";
        r3 = "autoConfig parameter byserver %s";
        r2 = new java.lang.Object[r2];
        r4 = ouz;
        r4 = r4.toString();
        r2[r1] = r4;
        com.tencent.mm.sdk.platformtools.ab.i(r0, r3, r2);
        com.tencent.matrix.trace.core.AppMethodBeat.o(r11);
        goto L_0x0033;
    L_0x012c:
        r0 = com.tencent.mm.compatible.util.d.iW(r3);
        if (r0 == 0) goto L_0x01d0;
    L_0x0132:
        r0 = fXT;
        r3 = 512; // 0x200 float:7.175E-43 double:2.53E-321;
        if (r0 < r3) goto L_0x01d0;
    L_0x0138:
        r6 = ouA;
        r8 = 4655301445678006272; // 0x409af40000000000 float:0.0 double:1725.0;
        r0 = (r6 > r8 ? 1 : (r6 == r8 ? 0 : -1));
        if (r0 < 0) goto L_0x01d0;
    L_0x0143:
        r0 = r4.x;
        r3 = r4.y;
        r0 = java.lang.Math.min(r0, r3);
        r3 = 1080; // 0x438 float:1.513E-42 double:5.336E-321;
        if (r0 < r3) goto L_0x01d0;
    L_0x014f:
        r0 = ouz;
        r3 = com.tencent.mm.plugin.mmsight.d.bPg();
        r6 = r0.fcY;
        r6 = r6.width;
        r6 = r6 * 2;
        r3 = com.tencent.mm.plugin.mmsight.model.g.a(r12, r3, r6, r13);
        r0.ouP = r3;
        r3 = r0.ouP;
        if (r3 == 0) goto L_0x0179;
    L_0x0165:
        r0 = r0.ouP;
        r0 = r0.oum;
        if (r0 == 0) goto L_0x0179;
    L_0x016b:
        r0 = r2;
    L_0x016c:
        if (r0 == 0) goto L_0x01d0;
    L_0x016e:
        r0 = ouz;
        r0 = r0.bPG();
        r0.ouM = r2;
        r0 = r2;
        goto L_0x00d8;
    L_0x0179:
        r0 = r1;
        goto L_0x016c;
    L_0x017b:
        r3 = r1;
        goto L_0x00e7;
    L_0x017e:
        r3 = ouz;
        r3.ouL = r1;
        goto L_0x00e9;
    L_0x0184:
        if (r0 != 0) goto L_0x0110;
    L_0x0186:
        r0 = com.tencent.mm.compatible.util.d.iW(r5);
        if (r0 == 0) goto L_0x0110;
    L_0x018c:
        r0 = fXT;
        r3 = 512; // 0x200 float:7.175E-43 double:2.53E-321;
        if (r0 < r3) goto L_0x0110;
    L_0x0192:
        r6 = ouA;
        r8 = 4655301445678006272; // 0x409af40000000000 float:0.0 double:1725.0;
        r0 = (r6 > r8 ? 1 : (r6 == r8 ? 0 : -1));
        if (r0 < 0) goto L_0x0110;
    L_0x019d:
        r0 = r4.x;
        r3 = r4.y;
        r0 = java.lang.Math.min(r0, r3);
        r3 = 720; // 0x2d0 float:1.009E-42 double:3.557E-321;
        if (r0 < r3) goto L_0x0110;
    L_0x01a9:
        r0 = ouz;
        r3 = com.tencent.mm.plugin.mmsight.d.bPg();
        r4 = 720; // 0x2d0 float:1.009E-42 double:3.557E-321;
        r3 = com.tencent.mm.plugin.mmsight.model.g.a(r12, r3, r4, r13);
        r0.ouP = r3;
        r3 = r0.ouP;
        if (r3 == 0) goto L_0x01ce;
    L_0x01bb:
        r0 = r0.ouP;
        r0 = r0.oum;
        if (r0 == 0) goto L_0x01ce;
    L_0x01c1:
        r0 = r2;
    L_0x01c2:
        if (r0 == 0) goto L_0x0110;
    L_0x01c4:
        r0 = ouz;
        r0 = r0.bPE();
        r0.ouM = r2;
        goto L_0x0110;
    L_0x01ce:
        r0 = r1;
        goto L_0x01c2;
    L_0x01d0:
        r0 = r1;
        goto L_0x00d8;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.mmsight.model.j.a(android.hardware.Camera$Parameters, boolean):void");
    }

    public static void c(VideoTransPara videoTransPara) {
        int i;
        int i2;
        boolean z = true;
        AppMethodBeat.i(76528);
        a aVar = a.ouC;
        oux = false;
        ouy = false;
        fXT = ((ActivityManager) ah.getContext().getSystemService("activity")).getLargeMemoryClass();
        ouA = (double) d.ev(ah.getContext());
        String dut = bs.dut();
        ab.i("MicroMsg.MMSightRecorderConfig", "MXM_DynaCfg_AV_Item_Key_SightMediaCodecMinApiLevel: %s", new Object[]{Integer.valueOf(bo.getInt(CaptureMMProxy.getInstance().getDynamicConfig("SightMediaCodecMinApiLevel"), 19))});
        if (CaptureMMProxy.getInstance() != null) {
            q.ku(CaptureMMProxy.getInstance().getDeviceInfoConfig());
        }
        ab.i("MicroMsg.MMSightRecorderConfig", "init large memory class: %sMB, totalMemory: %sGB  fingerprint: %s mmSightRecorderInfo: %s", new Object[]{Integer.valueOf(fXT), Double.valueOf(ouA), dut, q.etj});
        if (CaptureMMProxy.getInstance() != null) {
            i = CaptureMMProxy.getInstance().getInt(a.xPh, -1);
            i2 = CaptureMMProxy.getInstance().getInt(a.xPk, 1);
        } else {
            i2 = 1;
            i = -1;
        }
        o a = o.a(i, videoTransPara);
        ouz = a;
        if (a != null) {
            ouz.ouN = i2 == 1;
            oux = true;
            Context context = ah.getContext();
            Resources resources = ah.getResources();
            Object[] objArr = new Object[1];
            objArr[0] = ouz == null ? BuildConfig.FLAVOR : Integer.valueOf(ouz.ouK);
            t.makeText(context, resources.getString(2131300602, objArr), 1).show();
            AppMethodBeat.o(76528);
            return;
        }
        switch (1.ouB[aVar.ordinal()]) {
            case 2:
                v vVar = q.etk;
                i = 12;
                break;
            default:
                i = q.etj.etG;
                break;
        }
        ab.i("MicroMsg.MMSightRecorderConfig", "recorderOption: %s", new Object[]{Integer.valueOf(i)});
        if (i != -1) {
            ouz = o.a(i, videoTransPara);
        }
        if (ouz != null) {
            if (i2 == 1) {
                ouz.ouN = true;
            } else {
                ouz.ouN = false;
            }
            ouy = true;
            AppMethodBeat.o(76528);
            return;
        }
        ouz = o.a(1, videoTransPara);
        if (i2 == 1) {
            ouz.ouN = true;
        } else {
            ouz.ouN = false;
        }
        if (q.etj.etz != -1) {
            ouz.etz = q.etj.etz;
        } else if (com.tencent.mm.compatible.util.d.iW(r6)) {
            ouz.etz = 2;
        } else {
            ouz.etz = 1;
        }
        if (q.etj.etC != -1) {
            ouw = q.etj.etC == 1;
        }
        if (q.etj.etA != -1) {
            o oVar = ouz;
            if (q.etj.etA != 1) {
                z = false;
            }
            oVar.ouL = z;
            AppMethodBeat.o(76528);
            return;
        }
        ouz.ouL = false;
        AppMethodBeat.o(76528);
    }

    public static void a(b bVar) {
        AppMethodBeat.i(76529);
        if (bVar.oum == null) {
            ab.i("MicroMsg.MMSightRecorderConfig", "checkMore start %s", new Object[]{bVar.toString()});
            bVar.oum = bVar.oup;
            bVar.oun = bVar.ouq;
            bVar.ouo = bVar.our;
            if (Math.min(bVar.oun.y, bVar.oun.x) >= ouz.fcY.width + 16) {
                ouz.bPF();
                ouz.ouM = false;
                ouz.ouL = false;
                ab.i("MicroMsg.MMSightRecorderConfig", "checkMore out %s", new Object[]{bVar.toString()});
            }
        }
        AppMethodBeat.o(76529);
    }

    public static void bPw() {
        AppMethodBeat.i(76530);
        ab.i("MicroMsg.MMSightRecorderConfig", "initSimple");
        o oVar = new o();
        ouz = oVar;
        oVar.ouL = false;
        ouz.ouM = false;
        if (com.tencent.mm.compatible.util.d.iW(19)) {
            ouz.etz = 2;
            AppMethodBeat.o(76530);
            return;
        }
        ouz.etz = 1;
        AppMethodBeat.o(76530);
    }
}
