package com.tencent.mm.plugin.appbrand.jsapi.camera;

import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.appbrand.jsapi.c;
import com.tencent.mm.plugin.appbrand.jsapi.camera.a.a;
import com.tencent.mm.sdk.platformtools.ab;
import org.json.JSONObject;

class l$1 implements Runnable {
    final /* synthetic */ int eIl;
    final /* synthetic */ l hHd;
    final /* synthetic */ JSONObject hsm;
    final /* synthetic */ c hyd;

    l$1(l lVar, JSONObject jSONObject, c cVar, int i) {
        this.hHd = lVar;
        this.hsm = jSONObject;
        this.hyd = cVar;
        this.eIl = i;
    }

    public final void run() {
        e eVar;
        AppMethodBeat.i(126251);
        int optInt = this.hsm.optInt("cameraId");
        String optString = this.hsm.optString("type");
        ab.i("MicroMsg.JsApiOperateCamera", "cameraId=%d type=%s", new Object[]{Integer.valueOf(optInt), optString});
        a aDb = a.aDb();
        Integer valueOf = Integer.valueOf(optInt);
        if (aDb.hGk.containsKey(valueOf)) {
            eVar = (e) aDb.hGk.get(valueOf);
        } else {
            eVar = null;
        }
        if (eVar == null) {
            this.hyd.M(this.eIl, this.hHd.j("fail:no such camera", null));
            AppMethodBeat.o(126251);
            return;
        }
        eVar.setOperateCallBack(new 1(this));
        optInt = -1;
        switch (optString.hashCode()) {
            case -2144140699:
                if (optString.equals("closeFrameChange")) {
                    optInt = 4;
                    break;
                }
                break;
            case -1909077165:
                if (optString.equals("startRecord")) {
                    optInt = 1;
                    break;
                }
                break;
            case -1391995149:
                if (optString.equals("stopRecord")) {
                    optInt = 2;
                    break;
                }
                break;
            case -374265034:
                if (optString.equals("listenFrameChange")) {
                    optInt = 3;
                    break;
                }
                break;
            case 1484838379:
                if (optString.equals("takePhoto")) {
                    optInt = 0;
                    break;
                }
                break;
        }
        switch (optInt) {
            case 0:
                eVar.setQuality(this.hsm.optString("quality", "high"));
                eVar.aDd();
                AppMethodBeat.o(126251);
                return;
            case 1:
                eVar.aDm();
                AppMethodBeat.o(126251);
                return;
            case 2:
                eVar.aDn();
                AppMethodBeat.o(126251);
                return;
            case 3:
                this.hsm.optString("size");
                eVar.n(this.hyd);
                AppMethodBeat.o(126251);
                return;
            case 4:
                eVar.aDg();
                this.hyd.M(this.eIl, this.hHd.j("ok", null));
                AppMethodBeat.o(126251);
                return;
            default:
                ab.w("MicroMsg.JsApiOperateCamera", "operateType not supported: %s", new Object[]{optString});
                this.hyd.M(this.eIl, this.hHd.j("fail:operateType not supported", null));
                AppMethodBeat.o(126251);
                return;
        }
    }
}
