package com.ss.android.ttvecamera;

import X.C0338ICz;
import X.C0349IDk;
import X.C0401IFk;
import X.C0402IFl;
import X.C0403IFm;
import X.C0407IFq;
import X.C0408IFr;
import X.C0409IFs;
import X.C3052JJj;
import X.I7S;
import X.ICU;
import X.ID9;
import X.IE6;
import X.IEI;
import X.IFL;
import X.IG8;
import X.IHJ;
import X.UDY;
import android.content.Context;
import android.graphics.SurfaceTexture;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.params.Face;
import android.os.Bundle;
import android.os.Handler;
import android.util.Size;
import com.bytedance.bpea.basics.Cert;
import com.bytedance.covode.number.Covode;
import com.bytedance.netecho.Netecho;
import com.ss.android.vendorcamera.VendorActionStateCallback;
import com.ss.android.vendorcamera.VendorBufferCallback;
import com.ss.android.vendorcamera.VendorCamera;
import com.ss.android.vendorcamera.VendorCameraEvents;
import com.ss.android.vendorcamera.VendorCameraFocusSettings;
import com.ss.android.vendorcamera.VendorCameraFrame;
import com.ss.android.vendorcamera.VendorCameraKey;
import com.ss.android.vendorcamera.VendorCameraLog;
import com.ss.android.vendorcamera.VendorCameraSetting;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;

public class TEVendorCamera extends IEI {
    public static VendorCamera LIZIZ;
    public final int LIZ;
    public IFL LIZJ;
    public int LIZLLL;
    public VendorCameraSetting LJ;
    public float LJFF = 1.0f;
    public final VendorBufferCallback LJI;
    public final VendorActionStateCallback LJII;
    public final VendorCameraEvents LJIIIIZZ;

    static {
        Covode.recordClassIndex(49526);
    }

    private int LJFF(int i) {
        if (i == 0) {
            return 1;
        }
        if (i == 1) {
            return 2;
        }
        if (i == 2) {
            return 3;
        }
        return i == 3 ? 0 : -200;
    }

    public final void LIZ(C0401IFk iFk) {
    }

    public final void LIZ(String str) {
    }

    public final void LIZ(boolean z) {
    }

    public final float[] LJIIIZ() {
        return new float[0];
    }

    public final void LJIIJ() {
    }

    public final boolean LJIILIIL() {
        return false;
    }

    public final boolean LJIILL() {
        return false;
    }

    public final void LIZ(Bundle bundle) {
        VendorCamera vendorCamera = LIZIZ;
        if (vendorCamera != null) {
            vendorCamera.setFeatureParameters(bundle);
        }
    }

    public final int LIZJ() {
        return this.LJIILL.LIZJ;
    }

    public final int LJJIIJZLJL() {
        return LIZIZ.getCurrentISOValue();
    }

    public final void LJJII() {
        super.LJJII();
        C0349IDk.LIZIZ("TEVendorCamera", "destroy");
        LIZIZ.destroy();
    }

    public final void LIZIZ() {
        C0349IDk.LIZ("TEVendorCamera", "stopCapture");
        LIZIZ.stopCapture();
        if (this.LJIIZILJ != null) {
            this.LJIIZILJ.LIZIZ("TEVendorCamera preview stopped");
        }
    }

    public final void LJIIJJI() {
        C0349IDk.LIZIZ("TEVendorCamera", "enableCaf ret = ".concat(String.valueOf(LIZIZ.setFocus(4, (VendorCameraFocusSettings) null))));
    }

    public final List<TEFrameSizei> LJIJ() {
        VendorCamera vendorCamera = LIZIZ;
        if (vendorCamera == null) {
            return null;
        }
        return IG8.LIZ((List<Size>) vendorCamera.getSupportedPreviewSizes(SurfaceTexture.class));
    }

    public final List<TEFrameSizei> LJIJI() {
        VendorCamera vendorCamera = LIZIZ;
        if (vendorCamera == null) {
            return null;
        }
        return IG8.LIZ((List<Size>) vendorCamera.getSupportedCaptureSizes(C3052JJj.LIZIZ));
    }

    private int LJJI() {
        List featureParameterRange = LIZIZ.getFeatureParameterRange(VendorCameraKey.FACE_DETECT, this.LJIILL.LJ, this.LJIILL.LJJIIJ);
        if (featureParameterRange.size() <= 0) {
            C0349IDk.LIZLLL("TEVendorCamera", "Face detection mode is null");
            return -200;
        } else if (!featureParameterRange.contains(1)) {
            C0349IDk.LIZLLL("TEVendorCamera", "Do not supported face detection");
            return -200;
        } else {
            Bundle bundle = new Bundle();
            bundle.putInt("face_detect", 1);
            LIZ(bundle);
            return 0;
        }
    }

    public final boolean LJIILLIIL() {
        if (LIZIZ.getFeatureParameterRange(VendorCameraKey.FLASH_MODE, this.LJIILL.LJ, this.LJIILL.LJJIIJ).size() <= 0) {
            this.LJIIZILJ.LIZ(-419, -419, "Flash mode is null");
            return false;
        }
        Bundle bundle = this.LJJIIZI.get(this.LJIILL.LJJIJIIJIL);
        if (bundle == null) {
            return false;
        }
        return bundle.getBoolean("camera_torch_supported", false);
    }

    public final void LJIJJLI() {
        List<TEFrameSizei> LIZ2 = IG8.LIZ((List<Size>) LIZIZ.getSupportedPreviewSizes(SurfaceTexture.class));
        C0403IFm iFm = this.LJJIJIIJIL;
        C0408IFr iFr = C0408IFr.PREVIEW_SIZE;
        C0407IFq iFq = C0407IFq.STRING;
        iFm.LIZ(new C0409IFs(iFr, iFq, this.LJIILL.LJJIJIIJIL + "=" + LIZ2.toString()));
        this.LJJIJIIJIL.LIZ();
    }

    public final float[] LJJIIZI() {
        List featureParameterRange = LIZIZ.getFeatureParameterRange(VendorCameraKey.APERTURE, this.LJIILL.LJ, this.LJIILL.LJJIIJ);
        int size = featureParameterRange.size();
        float[] fArr = new float[size];
        for (int i = 0; i < size; i++) {
            fArr[i] = ((Float) featureParameterRange.get(i)).floatValue();
        }
        return fArr;
    }

    public final int LJI() {
        Integer num;
        int LIZ2 = IG8.LIZ(this.LJIJI);
        this.LJIJJLI = this.LJIL;
        VendorCamera vendorCamera = LIZIZ;
        if (!(vendorCamera == null || (num = (Integer) vendorCamera.get(CameraCharacteristics.SENSOR_ORIENTATION)) == null)) {
            this.LIZLLL = num.intValue();
        }
        C0349IDk.LIZIZ("TEVendorCamera", "getFrameOrientation, degrees = " + LIZ2 + ", mSensorOrientation = " + this.LIZLLL);
        if (this.LJIJJLI == 1) {
            this.LJJ = (this.LIZLLL + LIZ2) % 360;
            this.LJJ = ((360 - this.LJJ) + 180) % 360;
        } else {
            this.LJJ = ((this.LIZLLL - LIZ2) + 360) % 360;
        }
        if (!(this.LJIJJ == null || this.LJIJJ.LIZJ() == 1)) {
            this.LJJ = (360 - this.LJJ) % 360;
        }
        return this.LJJ;
    }

    public final int[] LJJIIJ() {
        List featureParameterRange = LIZIZ.getFeatureParameterRange(VendorCameraKey.ISO, this.LJIILL.LJ, this.LJIILL.LJJIIJ);
        if (featureParameterRange == null || featureParameterRange.size() < 2) {
            return new int[]{-1, -1};
        }
        Collections.sort(featureParameterRange, new Comparator<Long>() {
            static {
                Covode.recordClassIndex(49533);
            }

            public final /* synthetic */ int compare(Object obj, Object obj2) {
                return (int) (((Long) obj2).longValue() - ((Long) obj).longValue());
            }
        });
        C0349IDk.LIZ("TEVendorCamera", "getISORange after sort isoRange = ".concat(String.valueOf(featureParameterRange)));
        int[] iArr = new int[featureParameterRange.size()];
        for (int i = 0; i < featureParameterRange.size(); i++) {
            iArr[i] = ((Long) featureParameterRange.get(i)).intValue();
        }
        return iArr;
    }

    public final Bundle LJIIZILJ() {
        float[] supportedZoom;
        Bundle LJIIZILJ = super.LJIIZILJ();
        if (LJIIZILJ != null) {
            LJIIZILJ.putBoolean("camera_torch_supported", LIZIZ.getFeatureParameterRange(VendorCameraKey.FLASH_MODE, this.LJIILL.LJ, this.LJIILL.LJJIIJ).contains(3));
            if (this.LJIILL.LIZJ == 11) {
                List<String> allSupportedFeature = LIZIZ.getAllSupportedFeature(this.LJIILL.LJ, this.LJIILL.LJJIIJ);
                if (allSupportedFeature != null && allSupportedFeature.size() > 0) {
                    for (String str : allSupportedFeature) {
                        str.hashCode();
                        switch (str.hashCode()) {
                            case -1997085601:
                                if (str.equals("enable_video_stabilization")) {
                                    LJIIZILJ.putInt("device_support_antishake_mode", 1);
                                    break;
                                } else {
                                    break;
                                }
                            case -131659207:
                                if (str.equals("enable_ai_night_video")) {
                                    LJIIZILJ.putInt("device_support_ai_night_video", 1);
                                    break;
                                } else {
                                    break;
                                }
                            case 136680226:
                                if (str.equals("device_support_wide_angle_mode")) {
                                    LJIIZILJ.putInt("device_support_wide_angle_mode", 1);
                                    break;
                                } else {
                                    break;
                                }
                        }
                    }
                }
            } else if (this.LJIILL.LIZJ == 10 && (supportedZoom = LIZIZ.getSupportedZoom()) != null && supportedZoom.length >= 2 && Math.abs(supportedZoom[1] - 1.0f) < 0.01f && this.LJIILL.LJ == 1) {
                LJIIZILJ.putBoolean("device_should_use_shader_zoom", true);
            }
        }
        C0349IDk.LIZ("TEVendorCamera", "fillFeatures, feature bundle = ".concat(String.valueOf(LJIIZILJ)));
        return LJIIZILJ;
    }

    /* JADX WARNING: Removed duplicated region for block: B:39:0x0195 A[Catch:{ all -> 0x028a }] */
    /* JADX WARNING: Removed duplicated region for block: B:42:0x01aa A[Catch:{ all -> 0x028a }] */
    /* JADX WARNING: Removed duplicated region for block: B:45:0x01c8 A[Catch:{ all -> 0x028a }] */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ() {
        /*
            r12 = this;
            java.lang.String r4 = "TEVendorCamera"
            java.lang.String r0 = "Camera startCapture..."
            X.C0349IDk.LIZ(r4, r0)
            X.IFV r0 = r12.LJIJJ
            if (r0 != 0) goto L_0x0011
            java.lang.String r0 = "ProviderManager is null."
            X.C0349IDk.LIZLLL(r4, r0)
            return
        L_0x0011:
            r3 = 0
            X.ICU r1 = r12.LJIILL     // Catch:{ all -> 0x028a }
            int r0 = r12.LJI()     // Catch:{ all -> 0x028a }
            r1.LJFF = r0     // Catch:{ all -> 0x028a }
            X.IFV r0 = r12.LJIJJ     // Catch:{ all -> 0x028a }
            r8 = 256(0x100, float:3.59E-43)
            r5 = 0
            if (r0 != 0) goto L_0x002c
            java.lang.String r0 = "_prepareProvider, ProviderManager is null."
            X.C0349IDk.LIZLLL(r4, r0)     // Catch:{ all -> 0x028a }
            java.lang.String r0 = "Camera _prepareProvider failed..."
            X.C0349IDk.LIZ(r4, r0)     // Catch:{ all -> 0x028a }
            return
        L_0x002c:
            com.ss.android.vendorcamera.VendorCamera r1 = LIZIZ     // Catch:{ all -> 0x028a }
            java.lang.Class<android.graphics.SurfaceTexture> r0 = android.graphics.SurfaceTexture.class
            java.util.List r0 = r1.getSupportedPreviewSizes(r0)     // Catch:{ all -> 0x028a }
            java.util.List r7 = X.IG8.LIZ((java.util.List<android.util.Size>) r0)     // Catch:{ all -> 0x028a }
            X.IFV r0 = r12.LJIJJ     // Catch:{ all -> 0x028a }
            r0.LIZ((java.util.List<com.ss.android.ttvecamera.TEFrameSizei>) r7, (com.ss.android.ttvecamera.TEFrameSizei) r3)     // Catch:{ all -> 0x028a }
            X.IFV r0 = r12.LJIJJ     // Catch:{ all -> 0x028a }
            X.IFS r0 = r0.LIZIZ     // Catch:{ all -> 0x028a }
            boolean r0 = r0.LJIIIZ     // Catch:{ all -> 0x028a }
            if (r0 == 0) goto L_0x006a
            X.ICU r1 = r12.LJIILL     // Catch:{ all -> 0x028a }
            X.IFV r0 = r12.LJIJJ     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = r0.LJI()     // Catch:{ all -> 0x028a }
            r1.LJIIZILJ = r0     // Catch:{ all -> 0x028a }
        L_0x004f:
            com.ss.android.vendorcamera.VendorCamera r0 = LIZIZ     // Catch:{ all -> 0x028a }
            java.util.List r0 = r0.getSupportedCaptureSizes(r8)     // Catch:{ all -> 0x028a }
            java.util.List r6 = X.IG8.LIZ((java.util.List<android.util.Size>) r0)     // Catch:{ all -> 0x028a }
            boolean r0 = r6.isEmpty()     // Catch:{ all -> 0x028a }
            if (r0 != 0) goto L_0x008f
            X.IE6 r0 = r12.LJJIII     // Catch:{ all -> 0x028a }
            if (r0 == 0) goto L_0x007e
            X.IE6 r0 = r12.LJJIII     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r1 = r0.LIZ(r6, r7)     // Catch:{ all -> 0x028a }
            goto L_0x007c
        L_0x006a:
            java.lang.String r0 = "_prepareProvider, This provider is not used for preview, calculate preview size separately."
            X.C0349IDk.LIZJ(r4, r0)     // Catch:{ all -> 0x028a }
            X.ICU r1 = r12.LJIILL     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = r0.LJIIZILJ     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = X.IG8.LIZIZ((java.util.List<com.ss.android.ttvecamera.TEFrameSizei>) r7, (com.ss.android.ttvecamera.TEFrameSizei) r0)     // Catch:{ all -> 0x028a }
            r1.LJIIZILJ = r0     // Catch:{ all -> 0x028a }
            goto L_0x004f
        L_0x007c:
            if (r1 != 0) goto L_0x008b
        L_0x007e:
            X.ICU r1 = r12.LJIILL     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = r0.LJIJ     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = X.IG8.LIZ((java.util.List<com.ss.android.ttvecamera.TEFrameSizei>) r6, (com.ss.android.ttvecamera.TEFrameSizei) r0)     // Catch:{ all -> 0x028a }
            r1.LJIJ = r0     // Catch:{ all -> 0x028a }
            goto L_0x008f
        L_0x008b:
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            r0.LJIJ = r1     // Catch:{ all -> 0x028a }
        L_0x008f:
            com.ss.android.vendorcamera.VendorCamera r2 = LIZIZ     // Catch:{ all -> 0x028a }
            java.lang.Class<android.media.MediaRecorder> r1 = android.media.MediaRecorder.class
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameRateRange r0 = r0.LIZLLL     // Catch:{ all -> 0x028a }
            int r0 = r0.LIZIZ     // Catch:{ all -> 0x028a }
            java.util.List r0 = r2.getSupportedVideoSizes(r1, r0)     // Catch:{ all -> 0x028a }
            java.util.List r2 = X.IG8.LIZ((java.util.List<android.util.Size>) r0)     // Catch:{ all -> 0x028a }
            boolean r0 = r2.isEmpty()     // Catch:{ all -> 0x028a }
            if (r0 != 0) goto L_0x00b3
            X.ICU r1 = r12.LJIILL     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = r0.LJIIZILJ     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = X.IG8.LIZ((java.util.List<com.ss.android.ttvecamera.TEFrameSizei>) r2, (com.ss.android.ttvecamera.TEFrameSizei) r0)     // Catch:{ all -> 0x028a }
            r1.LJIJI = r0     // Catch:{ all -> 0x028a }
        L_0x00b3:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x028a }
            java.lang.String r0 = "configSize, previewSizes: "
            r1.<init>(r0)     // Catch:{ all -> 0x028a }
            r1.append(r7)     // Catch:{ all -> 0x028a }
            java.lang.String r0 = ", pictureSizes: "
            r1.append(r0)     // Catch:{ all -> 0x028a }
            r1.append(r6)     // Catch:{ all -> 0x028a }
            java.lang.String r0 = ", videoSizes: "
            r1.append(r0)     // Catch:{ all -> 0x028a }
            r1.append(r2)     // Catch:{ all -> 0x028a }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x028a }
            X.C0349IDk.LIZ(r4, r0)     // Catch:{ all -> 0x028a }
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x028a }
            java.lang.String r0 = "configSize, videoSize: "
            r1.<init>(r0)     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = r0.LJIJI     // Catch:{ all -> 0x028a }
            r1.append(r0)     // Catch:{ all -> 0x028a }
            java.lang.String r0 = ", previewSize: "
            r1.append(r0)     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = r0.LJIIZILJ     // Catch:{ all -> 0x028a }
            r1.append(r0)     // Catch:{ all -> 0x028a }
            java.lang.String r0 = ", pictureSize: "
            r1.append(r0)     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = r0.LJIJ     // Catch:{ all -> 0x028a }
            r1.append(r0)     // Catch:{ all -> 0x028a }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x028a }
            X.C0349IDk.LIZ(r4, r0)     // Catch:{ all -> 0x028a }
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x028a }
            java.lang.String r0 = "_prepareProvider, previewSize: "
            r1.<init>(r0)     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = r0.LJIIZILJ     // Catch:{ all -> 0x028a }
            r1.append(r0)     // Catch:{ all -> 0x028a }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x028a }
            X.C0349IDk.LIZIZ(r4, r0)     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = r0.LJIIZILJ     // Catch:{ all -> 0x028a }
            if (r0 == 0) goto L_0x012b
            X.IFl r2 = r12.LJIIZILJ     // Catch:{ all -> 0x028a }
            r1 = 50
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = r0.LJIIZILJ     // Catch:{ all -> 0x028a }
            java.lang.String r0 = r0.toString()     // Catch:{ all -> 0x028a }
            r2.LIZ(r1, r5, r0)     // Catch:{ all -> 0x028a }
        L_0x012b:
            X.IFV r0 = r12.LJIJJ     // Catch:{ all -> 0x028a }
            int r0 = r0.LIZJ()     // Catch:{ all -> 0x028a }
            java.lang.String r1 = "current provider type = "
            java.lang.String r0 = java.lang.String.valueOf(r0)     // Catch:{ all -> 0x028a }
            java.lang.String r0 = r1.concat(r0)     // Catch:{ all -> 0x028a }
            X.C0349IDk.LIZIZ(r4, r0)     // Catch:{ all -> 0x028a }
            com.ss.android.vendorcamera.VendorCamera r0 = LIZIZ     // Catch:{ all -> 0x028a }
            r0.clearSurface()     // Catch:{ all -> 0x028a }
            X.IFV r0 = r12.LJIJJ     // Catch:{ all -> 0x028a }
            int r0 = r0.LIZJ()     // Catch:{ all -> 0x028a }
            r7 = 3
            r2 = 1
            r1 = 2
            if (r0 == r2) goto L_0x0163
            X.IFV r0 = r12.LJIJJ     // Catch:{ all -> 0x028a }
            int r6 = r0.LIZJ()     // Catch:{ all -> 0x028a }
            r0 = 8
            if (r6 != r0) goto L_0x0159
            goto L_0x0163
        L_0x0159:
            X.IFV r0 = r12.LJIJJ     // Catch:{ all -> 0x028a }
            int r0 = r0.LIZJ()     // Catch:{ all -> 0x028a }
            if (r0 != r1) goto L_0x0163
            r11 = 3
            goto L_0x0164
        L_0x0163:
            r11 = 2
        L_0x0164:
            com.ss.android.vendorcamera.VendorCamera r10 = LIZIZ     // Catch:{ all -> 0x028a }
            X.IFV r0 = r12.LJIJJ     // Catch:{ all -> 0x028a }
            android.view.Surface r9 = r0.LIZLLL()     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = r0.LJIIZILJ     // Catch:{ all -> 0x028a }
            android.util.Size r6 = r0.LIZIZ()     // Catch:{ all -> 0x028a }
            r0 = -1
            r10.addPreviewSurface(r9, r6, r11, r0)     // Catch:{ all -> 0x028a }
            java.lang.StringBuilder r6 = new java.lang.StringBuilder     // Catch:{ all -> 0x028a }
            java.lang.String r0 = "sVendorCamera.addPreviewSurface, mProviderMgr.getPreviewSurface() = "
            r6.<init>(r0)     // Catch:{ all -> 0x028a }
            X.IFV r0 = r12.LJIJJ     // Catch:{ all -> 0x028a }
            android.view.Surface r0 = r0.LIZLLL()     // Catch:{ all -> 0x028a }
            r6.append(r0)     // Catch:{ all -> 0x028a }
            java.lang.String r0 = r6.toString()     // Catch:{ all -> 0x028a }
            X.C0349IDk.LIZIZ(r4, r0)     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = r0.LJIJ     // Catch:{ all -> 0x028a }
            if (r0 == 0) goto L_0x01a2
            com.ss.android.vendorcamera.VendorCamera r6 = LIZIZ     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = r0.LJIJ     // Catch:{ all -> 0x028a }
            android.util.Size r0 = r0.LIZIZ()     // Catch:{ all -> 0x028a }
            r6.addCaptureSurface(r3, r0, r7, r8)     // Catch:{ all -> 0x028a }
        L_0x01a2:
            X.IFV r0 = r12.LJIJJ     // Catch:{ all -> 0x028a }
            android.view.Surface r0 = r0.LIZIZ()     // Catch:{ all -> 0x028a }
            if (r0 == 0) goto L_0x01c0
            com.ss.android.vendorcamera.VendorCamera r6 = LIZIZ     // Catch:{ all -> 0x028a }
            r7 = 0
            X.IFV r0 = r12.LJIJJ     // Catch:{ all -> 0x028a }
            android.view.Surface r8 = r0.LIZIZ()     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameSizei r0 = r0.LJIJI     // Catch:{ all -> 0x028a }
            android.util.Size r9 = r0.LIZIZ()     // Catch:{ all -> 0x028a }
            r10 = 4
            r11 = -1
            r6.addVideoSurface(r7, r8, r9, r10, r11)     // Catch:{ all -> 0x028a }
        L_0x01c0:
            r6 = 11
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            int r0 = r0.LIZJ     // Catch:{ all -> 0x028a }
            if (r6 != r0) goto L_0x027f
            java.util.ArrayList r6 = new java.util.ArrayList     // Catch:{ all -> 0x028a }
            r6.<init>()     // Catch:{ all -> 0x028a }
            com.ss.android.vendorcamera.VendorCamera r9 = LIZIZ     // Catch:{ all -> 0x028a }
            android.hardware.camera2.CameraCharacteristics$Key r8 = android.hardware.camera2.CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            int r7 = r0.LJ     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            int r0 = r0.LJJIIJ     // Catch:{ all -> 0x028a }
            java.util.List r7 = r9.getFeatureParameterRange(r8, r7, r0)     // Catch:{ all -> 0x028a }
            if (r7 == 0) goto L_0x0216
            int r0 = r7.size()     // Catch:{ all -> 0x028a }
            if (r0 <= 0) goto L_0x0216
            java.lang.Object r11 = r7.get(r5)     // Catch:{ all -> 0x028a }
            android.util.Range[] r11 = (android.util.Range[]) r11     // Catch:{ all -> 0x028a }
            if (r11 == 0) goto L_0x0216
            int r0 = r11.length     // Catch:{ all -> 0x028a }
            if (r0 <= 0) goto L_0x0216
            int r10 = r11.length     // Catch:{ all -> 0x028a }
            r9 = 0
        L_0x01f2:
            if (r9 >= r10) goto L_0x0216
            r8 = r11[r9]     // Catch:{ all -> 0x028a }
            int[] r7 = new int[r1]     // Catch:{ all -> 0x028a }
            java.lang.Comparable r0 = r8.getLower()     // Catch:{ all -> 0x028a }
            java.lang.Integer r0 = (java.lang.Integer) r0     // Catch:{ all -> 0x028a }
            int r0 = r0.intValue()     // Catch:{ all -> 0x028a }
            r7[r5] = r0     // Catch:{ all -> 0x028a }
            java.lang.Comparable r0 = r8.getUpper()     // Catch:{ all -> 0x028a }
            java.lang.Integer r0 = (java.lang.Integer) r0     // Catch:{ all -> 0x028a }
            int r0 = r0.intValue()     // Catch:{ all -> 0x028a }
            r7[r2] = r0     // Catch:{ all -> 0x028a }
            r6.add(r7)     // Catch:{ all -> 0x028a }
            int r9 = r9 + 1
            goto L_0x01f2
        L_0x0216:
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            int r2 = r0.LJJJI     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            int r1 = r0.LJ     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            com.ss.android.ttvecamera.TEFrameRateRange r0 = r0.LIZLLL     // Catch:{ all -> 0x028a }
            int[] r0 = r0.LIZ()     // Catch:{ all -> 0x028a }
            int[] r2 = X.IG8.LIZ((int) r2, (int) r1, (int[]) r0, (java.util.List<int[]>) r6)     // Catch:{ all -> 0x028a }
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x028a }
            java.lang.String r0 = "startCapture, fpsRange = "
            r1.<init>(r0)     // Catch:{ all -> 0x028a }
            java.lang.String r0 = java.util.Arrays.toString(r2)     // Catch:{ all -> 0x028a }
            r1.append(r0)     // Catch:{ all -> 0x028a }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x028a }
            X.C0349IDk.LIZ(r4, r0)     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            android.os.Bundle r1 = r0.LJJIIZI     // Catch:{ all -> 0x028a }
            java.lang.String r0 = "video_fps"
            r1.putIntArray(r0, r2)     // Catch:{ all -> 0x028a }
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x028a }
            java.lang.String r0 = "startCapture, mCameraSetting.mEnableStabilization = "
            r1.<init>(r0)     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            boolean r0 = r0.LJJJJJL     // Catch:{ all -> 0x028a }
            r1.append(r0)     // Catch:{ all -> 0x028a }
            java.lang.String r0 = ", mCameraSetting.mFacing = "
            r1.append(r0)     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            int r0 = r0.LJ     // Catch:{ all -> 0x028a }
            r1.append(r0)     // Catch:{ all -> 0x028a }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x028a }
            X.C0349IDk.LIZ(r4, r0)     // Catch:{ all -> 0x028a }
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            android.os.Bundle r2 = r0.LJJIIZI     // Catch:{ all -> 0x028a }
            java.lang.String r1 = "enable_video_stabilization"
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            int r0 = r0.LJ     // Catch:{ all -> 0x028a }
            if (r0 != 0) goto L_0x027c
            X.ICU r0 = r12.LJIILL     // Catch:{ all -> 0x028a }
            boolean r0 = r0.LJJJJJL     // Catch:{ all -> 0x028a }
            if (r0 == 0) goto L_0x027c
            r5 = 1
        L_0x027c:
            r2.putBoolean(r1, r5)     // Catch:{ all -> 0x028a }
        L_0x027f:
            java.lang.String r0 = "Configure..."
            X.C0349IDk.LIZ(r4, r0)     // Catch:{ all -> 0x028a }
            com.ss.android.vendorcamera.VendorCamera r0 = LIZIZ     // Catch:{ all -> 0x028a }
            r0.startCapture()     // Catch:{ all -> 0x028a }
            return
        L_0x028a:
            r2 = move-exception
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "startCapture failed, "
            r1.<init>(r0)
            java.lang.String r0 = r2.getMessage()
            r1.append(r0)
            java.lang.String r0 = r1.toString()
            X.C0349IDk.LIZIZ(r4, r0, r2)
            X.IFl r0 = r12.LJIIZILJ
            if (r0 == 0) goto L_0x02ab
            X.IFl r1 = r12.LJIIZILJ
            r0 = -425(0xfffffffffffffe57, float:NaN)
            r1.LIZIZ(r0, r3)
        L_0x02ab:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ttvecamera.TEVendorCamera.LIZ():void");
    }

    public final void LIZ(IFL ifl) {
        this.LIZJ = ifl;
        LIZIZ.takePicture();
    }

    public final void LIZIZ(float f) {
        Bundle bundle = new Bundle();
        bundle.putFloat("aperture", f);
        LIZ(bundle);
    }

    public final void LIZJ(boolean z) {
        int i;
        if (z) {
            i = 2;
        } else {
            i = 0;
        }
        LJ(i);
    }

    public final void LIZ(C0338ICz iCz) {
        float[] supportedZoom = LIZIZ.getSupportedZoom();
        if (supportedZoom == null || supportedZoom.length < 2) {
            C0349IDk.LIZLLL("TEVendorCamera", "queryShaderZoomStep, zoomRange is invalid");
        }
    }

    public final void LIZ(int i) {
        if (i == 1) {
            if (this.LJIJJLI == 1) {
                LJJI();
                C0349IDk.LIZ("TEVendorCamera", "use faceae for front");
            }
        } else if (i == 2) {
            if (this.LJIJJLI == 0) {
                LJJI();
                C0349IDk.LIZ("TEVendorCamera", "use faceae for rear");
            }
        } else if (i == 3) {
            LJJI();
            C0349IDk.LIZ("TEVendorCamera", "use faceae for all");
        }
    }

    public final void LIZIZ(Cert cert) {
        try {
            IHJ.LIZIZ(cert, new I7S<Object>() {
                static {
                    Covode.recordClassIndex(49532);
                }

                public final Object LIZ() {
                    TEVendorCamera.LIZIZ.close();
                    return null;
                }
            });
        } catch (Exception e) {
            C0349IDk.LIZIZ("TEVendorCamera", "Exception occur:", e);
        }
    }

    public final void LIZJ(int i) {
        if (i == 1 || i == 0) {
            C0349IDk.LIZ("TEVendorCamera", "switchCameraMode mode = ".concat(String.valueOf(i)));
            this.LJIILL.LJJIIJ = i;
            this.LJ.mMode = i;
            LIZIZ.switchMode(this.LJ);
            return;
        }
        C0349IDk.LIZLLL("TEVendorCamera", "switchCameraMode mode = " + i + " not supported");
    }

    public final boolean LIZLLL(int i) {
        if (!this.LJIILL.LJJIJLIJ.LIZ()) {
            C0349IDk.LIZJ("TEVendorCamera", "Current camera doesn't support setting exposure compensation.");
            this.LJIIZILJ.LIZ(-414, -414, "Current camera doesn't support setting exposure compensation.");
            return false;
        } else if (i > this.LJIILL.LJJIJLIJ.LIZ || i < this.LJIILL.LJJIJLIJ.LIZJ) {
            String str = "Invalid exposure compensation value: " + i + ", it must between [" + this.LJIILL.LJJIJLIJ.LIZJ + ", " + this.LJIILL.LJJIJLIJ.LIZ + "].";
            C0349IDk.LIZJ("TEVendorCamera", str);
            this.LJIIZILJ.LIZ(-415, -415, str);
            return false;
        } else {
            Bundle bundle = new Bundle();
            bundle.putInt("exposure_compensation", i);
            LIZ(bundle);
            this.LJIILL.LJJIJLIJ.LIZIZ = i;
            return true;
        }
    }

    public final void LJ(int i) {
        C0349IDk.LIZIZ("TEVendorCamera", "switchFlashMode: ".concat(String.valueOf(i)));
        if (LIZIZ.getFeatureParameterRange(VendorCameraKey.FLASH_MODE, this.LJIILL.LJ, this.LJIILL.LJJIIJ).size() <= 0) {
            this.LJIIZILJ.LIZ(-419, -419, "Flash mode is null");
            return;
        }
        int LJFF2 = LJFF(i);
        if (LJFF2 < 0) {
            C0349IDk.LIZLLL("TEVendorCamera", "Find flash mode: " + i + " failed.");
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putInt("flash_mode", LJFF2);
        LIZ(bundle);
    }

    public final void LIZ(ID9 id9) {
        int i;
        C0349IDk.LIZIZ("TEVendorCamera", "focusAtPoint...");
        ID9 id92 = id9;
        if (id92 == null) {
            C0349IDk.LIZJ("TEVendorCamera", "focusAtPoint, focus settings are null.");
            return;
        }
        VendorCameraFocusSettings vendorCameraFocusSettings = new VendorCameraFocusSettings(id92.LIZ, id92.LIZIZ, id92.LIZJ, id92.LIZLLL, id92.LJ);
        vendorCameraFocusSettings.setCoordinatesMode(UDY.values()[id92.LJIIJ.ordinal()]);
        int[] supportedAutoFocus = LIZIZ.getSupportedAutoFocus();
        if (supportedAutoFocus.length <= 0) {
            C0349IDk.LIZJ("TEVendorCamera", "Do not support focus! Go to set AE.");
            this.LJIIZILJ.LIZ(-412, -412, "Focus type is null");
            LIZIZ.setAE(vendorCameraFocusSettings);
            return;
        }
        int length = supportedAutoFocus.length;
        int i2 = 0;
        boolean z = false;
        boolean z2 = false;
        while (true) {
            i = 3;
            if (i2 >= length) {
                break;
            }
            int i3 = supportedAutoFocus[i2];
            if (i3 == 2) {
                z = true;
            } else if (i3 != 1 && i3 == 3) {
                z2 = true;
            }
            i2++;
        }
        if (z) {
            i = 2;
        } else if (!z2) {
            C0349IDk.LIZJ("TEVendorCamera", "No proper focus type, go to set AE.");
            LIZIZ.setAE(vendorCameraFocusSettings);
            return;
        }
        int focus = LIZIZ.setFocus(i, vendorCameraFocusSettings);
        if (focus != 0) {
            C0349IDk.LIZLLL("TEVendorCamera", "focusAtPoint failed, code = ".concat(String.valueOf(focus)));
        }
    }

    private int LIZIZ(ICU icu, Cert cert) {
        this.LJFF = icu.LJLI;
        if (this.LJIILL.LIZJ == 10) {
            icu.LJJIIZI.putInt("face_detect", 1);
            icu.LJJIIZI.remove("useCameraFaceDetect");
        }
        ICU icu2 = this.LJIILL;
        icu2.LJJIJIIJIL = this.LJIILL.LIZJ + "_" + this.LJIILL.LJ;
        VendorCameraSetting vendorCameraSetting = new VendorCameraSetting(icu.LJJIIJ, icu.LJ);
        this.LJ = vendorCameraSetting;
        vendorCameraSetting.mExtParameters = this.LJIILL.LJJIIZI;
        this.LJ.mDefaultZoomRatio = icu.LJLI;
        int i = -428;
        try {
            i = ((Integer) IHJ.LIZ(cert, new I7S<Integer>() {
                static {
                    Covode.recordClassIndex(49531);
                }

                public final /* synthetic */ Object LIZ() {
                    return Integer.valueOf(TEVendorCamera.LIZIZ.open(TEVendorCamera.this.LJIJ, TEVendorCamera.this.LJ));
                }
            })).intValue();
            if (i == 0) {
                LJIIZILJ();
                if (this.LJIIZILJ != null) {
                    this.LJIIZILJ.LIZ(1, 0, "TEVendorCamera features is ready.");
                }
            }
        } catch (Exception e) {
            C0349IDk.LIZIZ("TEVendorCamera", "Exception occur:", e);
        }
        return i;
    }

    public final int LIZ(ICU icu, Cert cert) {
        super.LIZ(icu, cert);
        C0349IDk.LIZ("TEVendorCamera", "Open camera mode = " + icu.LJJIIJ + " type = " + icu.LIZJ);
        this.LJIILL = icu;
        this.LJIL = icu.LJ;
        this.LJIILL.LJJIIZI.putIntArray("video_fps", new int[]{this.LJIILL.LIZLLL.LIZ, this.LJIILL.LIZLLL.LIZIZ});
        return LIZIZ(this.LJIILL, cert);
    }

    public final TEFrameSizei LIZ(float f, TEFrameSizei tEFrameSizei) {
        TEFrameSizei LIZ2;
        List<Size> supportedPreviewSizes = LIZIZ.getSupportedPreviewSizes(SurfaceTexture.class);
        List<Size> supportedCaptureSizes = LIZIZ.getSupportedCaptureSizes(C3052JJj.LIZIZ);
        ArrayList arrayList = new ArrayList();
        for (Size size : supportedPreviewSizes) {
            arrayList.add(new TEFrameSizei(size.getWidth(), size.getHeight()));
        }
        if (tEFrameSizei != null) {
            LIZ2 = IG8.LIZIZ((List<TEFrameSizei>) arrayList, tEFrameSizei);
        } else {
            LIZ2 = IG8.LIZ((List<TEFrameSizei>) arrayList, f);
        }
        if (LIZ2 == null) {
            return null;
        }
        if (LIZ2.equals(this.LJIILL.LJIIZILJ)) {
            return LIZ2;
        }
        this.LJIILL.LJIIZILJ = LIZ2;
        arrayList.clear();
        for (Size size2 : supportedCaptureSizes) {
            arrayList.add(new TEFrameSizei(size2.getWidth(), size2.getHeight()));
        }
        this.LJIILL.LJIJ = IG8.LIZ((List<TEFrameSizei>) arrayList, this.LJIILL.LJIIZILJ, this.LJIILL.LJIJ);
        return LIZ2;
    }

    public final void LIZIZ(float f, C0401IFk iFk) {
        if (this.LJFF >= this.LJJIFFI && f > 1.0f) {
            C0349IDk.LIZIZ("TEVendorCamera", "mNowZoom = " + this.LJFF + ";mMaxZoom = " + this.LJJIFFI + ";factor = " + f);
            this.LJFF = this.LJJIFFI;
        } else if (this.LJFF * f <= 1.0f) {
            C0349IDk.LIZIZ("TEVendorCamera", "set mNowZoom to 1 factor = ".concat(String.valueOf(f)));
            this.LJFF = 1.0f;
        } else {
            C0349IDk.LIZIZ("TEVendorCamera", "mNowZoom = " + this.LJFF);
            this.LJFF = this.LJFF * f;
        }
        C0349IDk.LIZ("TEVendorCamera", "zoomV2: " + this.LJFF);
        int zoom = LIZIZ.setZoom(this.LJFF);
        if (zoom != 0) {
            C0349IDk.LIZLLL("TEVendorCamera", "zoomV2 failed, code = ".concat(String.valueOf(zoom)));
        } else if (iFk != null) {
            iFk.onChange(this.LJIILL.LIZJ, this.LJFF, true);
        }
    }

    public final void LIZ(float f, C0401IFk iFk) {
        if (f > this.LJJIFFI) {
            f = this.LJJIFFI;
        } else if (f < 1.0f) {
            f = 1.0f;
        }
        C0349IDk.LIZ("TEVendorCamera", "startZoom: ".concat(String.valueOf(f)));
        int zoom = LIZIZ.setZoom(f);
        if (zoom != 0) {
            C0349IDk.LIZLLL("TEVendorCamera", "startZoom failed, code = ".concat(String.valueOf(zoom)));
        } else if (iFk != null) {
            iFk.onChange(this.LJIILL.LIZJ, f, true);
        }
    }

    public final void LIZ(C0401IFk iFk, boolean z) {
        boolean z2;
        float[] supportedZoom = LIZIZ.getSupportedZoom();
        if (supportedZoom == null || supportedZoom.length < 2) {
            C0349IDk.LIZLLL("TEVendorCamera", "queryZoomAbility, zoomRange is invalid");
            return;
        }
        C0349IDk.LIZ("TEVendorCamera", "queryZoomAbility, Zoom range: " + Arrays.toString(supportedZoom));
        this.LJJIFFI = supportedZoom[1];
        if (Math.abs(this.LJJIFFI - 1.0f) < 0.01f && this.LJIILL.LJ == 1) {
            supportedZoom[1] = 5.0f;
            C0349IDk.LIZ("TEVendorCamera", "queryZoomAbility, fake maxzoom to : " + supportedZoom[1]);
        }
        C0401IFk iFk2 = iFk;
        if (iFk2 != null) {
            ArrayList arrayList = new ArrayList(1);
            arrayList.add(Integer.valueOf((int) (supportedZoom[1] / 0.1f)));
            int i = this.LJIILL.LIZJ;
            if (supportedZoom[1] > 0.0f) {
                z2 = true;
            } else {
                z2 = false;
            }
            iFk2.onZoomSupport(i, z2, false, supportedZoom[1], arrayList);
        }
    }

    public final void LIZ(int i, int i2, IFL ifl) {
        this.LIZJ = ifl;
        LIZIZ.takePicture();
    }

    public TEVendorCamera(Context context, C0402IFl iFl, Handler handler, int i, IE6 ie6) {
        super(context, iFl, handler, ie6);
        AnonymousClass1 r3 = new VendorBufferCallback() {
            static {
                Covode.recordClassIndex(49527);
            }

            public final void onBurst(int i) {
            }

            public final void onBurstError(String str) {
            }

            public final void onImageAvailable(int i, VendorCameraFrame vendorCameraFrame) {
            }

            public final void onPreviewFrameAvailable(VendorCameraFrame vendorCameraFrame) {
            }

            public final void onRawImageAvailable(int i, VendorCameraFrame vendorCameraFrame) {
            }

            public final void onTakePictureError(String str) {
            }

            public final void onThumbnailAvailable(int i, VendorCameraFrame vendorCameraFrame) {
            }

            public final void onVideoFrameAvailable(VendorCameraFrame vendorCameraFrame) {
            }

            public final void onTakePictureState(int i, int i2) {
                if (i == 1) {
                    C0349IDk.LIZIZ("TEVendorCamera", "onTakePictureState started");
                } else if (i == 2) {
                    C0349IDk.LIZIZ("TEVendorCamera", "onTakePictureState begin");
                } else if (i == 3) {
                    C0349IDk.LIZIZ("TEVendorCamera", "onTakePictureState end");
                } else if (i == 4) {
                    C0349IDk.LIZIZ("TEVendorCamera", "onTakePictureState shutter");
                } else if (i == 5) {
                    C0349IDk.LIZIZ("TEVendorCamera", "onTakePictureState completed");
                }
            }
        };
        this.LJI = r3;
        AnonymousClass2 r2 = new VendorActionStateCallback() {
            static {
                Covode.recordClassIndex(49528);
            }

            public final void onFaceDetection(int i, Face[] faceArr, Map<Integer, Integer> map) {
            }

            public final void onSceneDetection(Map<Integer, Float> map) {
            }

            public final void onActionError(String str) {
                C0349IDk.LIZLLL("TEVendorCamera", "on Action error :".concat(String.valueOf(str)));
            }

            public final void onFocus(int i) {
                if (i == 2) {
                    C0349IDk.LIZIZ("TEVendorCamera", "onFocus moving");
                } else if (i == 3) {
                    C0349IDk.LIZIZ("TEVendorCamera", "onFocus locked");
                } else if (i == 4) {
                    C0349IDk.LIZIZ("TEVendorCamera", "onFocus success");
                }
            }
        };
        this.LJII = r2;
        AnonymousClass3 r1 = new VendorCameraEvents() {
            static {
                Covode.recordClassIndex(49529);
            }

            public final void onConfigureFailed() {
                C0349IDk.LIZIZ("TEVendorCamera", "VendorCameraEvents onConfigureFailed");
            }

            public final void onCameraClosed() {
                C0349IDk.LIZIZ("TEVendorCamera", "VendorCameraEvents onCameraClosed");
                if (TEVendorCamera.this.LJIIZILJ != null) {
                    TEVendorCamera.this.LJIIZILJ.LIZ((IEI) TEVendorCamera.this);
                }
            }

            public final void onPreviewSuccess() {
                C0349IDk.LIZIZ("TEVendorCamera", "VendorCameraEvents onPreviewSuccess");
                List exposureCompensation = TEVendorCamera.LIZIZ.getExposureCompensation();
                if (exposureCompensation == null || exposureCompensation.isEmpty()) {
                    C0349IDk.LIZIZ("TEVendorCamera", "onPreviewSuccess, evInfo = ".concat(String.valueOf(exposureCompensation)));
                } else {
                    TEVendorCamera.this.LJIILL.LJJIJLIJ.LIZ = ((Float) exposureCompensation.get(exposureCompensation.size() - 1)).intValue();
                    TEVendorCamera.this.LJIILL.LJJIJLIJ.LIZJ = ((Float) exposureCompensation.get(0)).intValue();
                    TEVendorCamera.this.LJIILL.LJJIJLIJ.LIZLLL = (((Float) exposureCompensation.get(exposureCompensation.size() - 1)).floatValue() - ((Float) exposureCompensation.get(0)).floatValue()) / ((float) (exposureCompensation.size() - 1));
                }
                C0349IDk.LIZIZ("TEVendorCamera", "onPreviewSuccess, mCameraECInfo = " + TEVendorCamera.this.LJIILL.LJJIJLIJ);
                if (TEVendorCamera.this.LJIIZILJ != null) {
                    TEVendorCamera.this.LJIIZILJ.LIZ("TEVendorCamera onPreviewSuccess");
                }
            }

            public final void onZoom(float f) {
                C0349IDk.LIZIZ("TEVendorCamera", "VendorCameraEvents onZoom");
            }

            public final void onRecording(int i) {
                switch (i) {
                    case -3:
                        C0349IDk.LIZIZ("TEVendorCamera", "onRecording state not ready");
                        return;
                    case -2:
                        C0349IDk.LIZLLL("TEVendorCamera", "onRecording state file io error");
                        return;
                    case -1:
                        C0349IDk.LIZIZ("TEVendorCamera", "onRecording state unknown");
                        return;
                    case 1:
                        C0349IDk.LIZIZ("TEVendorCamera", "onRecording state ready");
                        return;
                    case 2:
                        C0349IDk.LIZIZ("TEVendorCamera", "onRecording state started");
                        return;
                    case Netecho.STAGE_SET_OPT:
                        C0349IDk.LIZIZ("TEVendorCamera", "onRecording state stopped");
                        return;
                    case Netecho.STAGE_SEND:
                        C0349IDk.LIZIZ("TEVendorCamera", "onRecording state record completed");
                        return;
                    case Netecho.STAGE_RECV:
                        C0349IDk.LIZIZ("TEVendorCamera", "onRecording state file saved");
                        return;
                    default:
                        return;
                }
            }

            public final void onPreviewStopped(int i, String str) {
                C0349IDk.LIZIZ("TEVendorCamera", "VendorCameraEvents onPreviewStopped");
            }

            public final void onCameraError(int i, String str) {
                C0349IDk.LIZIZ("TEVendorCamera", "VendorCameraEvents onCameraError");
                if (TEVendorCamera.this.LJIIZILJ != null) {
                    TEVendorCamera.this.LJIIZILJ.LIZ(i, str);
                }
            }

            public final void onPreviewError(int i, String str) {
                C0349IDk.LIZ("TEVendorCamera", "VendorCameraEvents onPreviewError");
                if (TEVendorCamera.this.LJIIZILJ != null) {
                    TEVendorCamera.this.LJIIZILJ.LIZIZ(i, str);
                }
            }

            public final void onCameraOpened(int i, String str) {
                Integer num;
                C0349IDk.LIZIZ("TEVendorCamera", "VendorCameraEvents onCameraOpened");
                if (TEVendorCamera.this.LJIIZILJ != null) {
                    TEVendorCamera.this.LJIIZILJ.LIZ(TEVendorCamera.this.LIZ, i);
                }
                if (i == 0 && (num = (Integer) TEVendorCamera.LIZIZ.get(CameraCharacteristics.SENSOR_ORIENTATION)) != null) {
                    TEVendorCamera.this.LIZLLL = num.intValue();
                }
            }

            public final void onCameraInfo(int i, int i2, String str) {
                C0349IDk.LIZIZ("TEVendorCamera", "VendorCameraEvents onCameraInfo");
                if (TEVendorCamera.this.LJIIZILJ != null) {
                    TEVendorCamera.this.LJIIZILJ.LIZ(i, i2, str);
                }
            }
        };
        this.LJIIIIZZ = r1;
        this.LIZ = i;
        LIZIZ.init(r1, r3, r2);
        this.LJIILL = new ICU(context, i);
    }

    public static TEVendorCamera create(int i, Context context, C0402IFl iFl, Handler handler, IE6 ie6) {
        int i2 = i;
        C0349IDk.LIZ("TEVendorCamera", "create... cameraType = ".concat(String.valueOf(i2)));
        VendorCamera.initLogOutput(C0349IDk.LIZIZ, new VendorCameraLog.ILog() {
            static {
                Covode.recordClassIndex(49530);
            }

            public final void logOutput(byte b, String str, String str2) {
                if (b == 1) {
                    C0349IDk.LIZLLL(str, str2);
                } else if (b == 2) {
                    C0349IDk.LIZJ(str, str2);
                } else if (b == 4) {
                    C0349IDk.LIZ(str, str2);
                } else if (b == 8) {
                    C0349IDk.LIZIZ(str, str2);
                } else if (b != 16) {
                    C0349IDk.LIZIZ(str, str2);
                } else {
                    C0349IDk.LJ(str, str2);
                }
            }
        });
        Context context2 = context;
        if (LIZIZ == null) {
            try {
                LIZIZ = VendorCamera.create(context2, i2);
                C0349IDk.LIZ("TEVendorCamera", "create, sVendorCamera = " + LIZIZ);
                if (LIZIZ == null) {
                    return null;
                }
            } catch (Exception e) {
                C0349IDk.LIZIZ("TEVendorCamera", "Create TEVendorCamera Failed.", e);
                LIZIZ = null;
                return null;
            }
        }
        return new TEVendorCamera(context2, iFl, handler, i2, ie6);
    }
}
