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

import android.content.Context;
import android.os.Looper;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.compatible.e.d;
import com.tencent.mm.compatible.e.t;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.bo;

class n$1 implements Runnable {
    final /* synthetic */ long ecn;
    final /* synthetic */ long ouH;
    final /* synthetic */ int ouI;
    final /* synthetic */ n ouJ;
    final /* synthetic */ Context val$context;

    n$1(n nVar, long j, long j2, Context context, int i) {
        this.ouJ = nVar;
        this.ouH = j;
        this.ecn = j2;
        this.val$context = context;
        this.ouI = i;
    }

    public final void run() {
        AppMethodBeat.i(76543);
        ab.i("MicroMsg.SightCamera.OpenCameraThread", "Start Open Camera thread[parent:%d this:%d] time:%d", new Object[]{Long.valueOf(this.ouH), Long.valueOf(Thread.currentThread().getId()), Long.valueOf(bo.anU() - this.ecn)});
        synchronized (this.ouJ.lock) {
            try {
                this.ouJ.fbs = d.a(this.val$context, this.ouI, Looper.getMainLooper());
            } catch (Exception e) {
                ab.e("MicroMsg.SightCamera.OpenCameraThread", "openCamera failed e:%s", new Object[]{e.getMessage()});
                this.ouJ.fbs = null;
            } catch (Throwable th) {
                AppMethodBeat.o(76543);
            }
            if (this.ouJ.fbr && this.ouJ.fbs != null) {
                ab.e("MicroMsg.SightCamera.OpenCameraThread", "thread time out now, release camera :%d ", new Object[]{Long.valueOf(bo.anU() - this.ecn)});
                try {
                    t tVar = this.ouJ.fbs.erH;
                    tVar.setPreviewCallback(null);
                    tVar.stopPreview();
                    tVar.release();
                    this.ouJ.fbs = null;
                } catch (Exception e2) {
                    ab.e("MicroMsg.SightCamera.OpenCameraThread", "realease Camera failed e:%s", new Object[]{e2.getMessage()});
                }
            }
            this.ouJ.lock.notify();
        }
        AppMethodBeat.o(76543);
    }
}
