package com.ss.android.ugc.aweme.utils;

import X.0RQ;
import X.2HN;
import X.9EH;
import X.LsC;
import X.TSt;
import android.graphics.Bitmap;
import com.bytedance.covode.number.Covode;
import com.bytedance.pitaya.api.PTYPackageCallback;
import com.bytedance.pitaya.api.PitayaCoreFactory;
import com.bytedance.pitaya.api.bean.PTYCvMat;
import com.bytedance.pitaya.api.bean.PTYError;
import com.bytedance.pitaya.api.bean.PTYPackageInfo;
import com.bytedance.pitaya.api.bean.PTYTaskConfig;
import com.bytedance.pitaya.api.bean.PTYTaskData;
import com.bytedance.pitaya.media.GraphicByte;
import org.json.JSONObject;

public final class AdMobileAISecServiceImpl$runCVModel$1 implements PTYPackageCallback {
    public final /* synthetic */ Bitmap $bitmap;
    public final /* synthetic */ String $businessName;
    public final /* synthetic */ LsC $callback;

    static {
        Covode.recordClassIndex(122029);
    }

    public AdMobileAISecServiceImpl$runCVModel$1(String str, LsC lsC, Bitmap bitmap) {
        this.$businessName = str;
        this.$callback = lsC;
        this.$bitmap = bitmap;
    }

    public final void onResult(boolean z, PTYError pTYError, PTYPackageInfo pTYPackageInfo) {
        if (!z) {
            if (pTYError != null) {
                Integer.valueOf(pTYError.getCode());
                pTYError.getSummary();
            }
            this.$callback.invoke(new 0RQ(false));
            return;
        }
        PTYCvMat pTYCvMat = new PTYCvMat(this.$bitmap, (GraphicByte) null, 2, (2HN) null);
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("image", pTYCvMat);
            jSONObject.put("rotation", 0);
        } catch (Exception e) {
            TSt.LIZ(e);
        }
        try {
            PitayaCoreFactory.getCore(String.valueOf(9EH.LJIILJJIL)).runTask(this.$businessName, new PTYTaskData(jSONObject), new PTYTaskConfig(true, (String) null, 0.0f, 6, (2HN) null), new AdMobileAISecServiceImpl$runCVModel$1$onResult$1(this));
        } catch (Throwable th) {
            TSt.LIZ(th);
            this.$callback.invoke(new 0RQ(false));
        }
    }
}
