package com.ss.android.ttve.nativePort;

import X.Q39;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.ss.android.vesdk.bean.VEUndoRedoBean;
import java.util.ArrayList;

public class TEImageUndoRedoInterface {
    public long mHandler;

    static {
        Covode.recordClassIndex(49432);
    }

    private native String nativeCacheCurrentFrame(long j, String str, boolean z);

    private native void nativeCheckHas();

    private native void nativeEnableUndoRedo(long j);

    private native void nativeExecuteConfirmParams(long j);

    private native void nativeExecuteRedoUndo(long j, boolean z, int i, boolean z2);

    private native void nativeGetUndoRedoList(long j, VEUndoRedoBean.JniHolder jniHolder, boolean z, int i);

    private native int nativeGetUndoRedoListSize(long j, boolean z);

    public void enableUndoRedo() {
        MethodCollector.i(14569);
        long j = this.mHandler;
        if (j == 0) {
            MethodCollector.o(14569);
            return;
        }
        nativeEnableUndoRedo(j);
        MethodCollector.o(14569);
    }

    public synchronized void executeConfirmParams() {
        MethodCollector.i(14571);
        long j = this.mHandler;
        if (j == 0) {
            MethodCollector.o(14571);
            return;
        }
        nativeExecuteConfirmParams(j);
        MethodCollector.o(14571);
    }

    public TEImageUndoRedoInterface(long j) {
        MethodCollector.i(14568);
        this.mHandler = j;
        nativeCheckHas();
        MethodCollector.o(14568);
    }

    public synchronized ArrayList<VEUndoRedoBean> getUndoRedoList(boolean z) {
        ArrayList<VEUndoRedoBean> undoRedoList;
        MethodCollector.i(14573);
        undoRedoList = getUndoRedoList(z, -1);
        MethodCollector.o(14573);
        return undoRedoList;
    }

    public synchronized int getUndoRedoListSize(boolean z) {
        int nativeGetUndoRedoListSize;
        MethodCollector.i(14575);
        nativeGetUndoRedoListSize = nativeGetUndoRedoListSize(this.mHandler, z);
        MethodCollector.o(14575);
        return nativeGetUndoRedoListSize;
    }

    public synchronized String cacheCurrentFrame(String str, Boolean bool) {
        MethodCollector.i(14572);
        long j = this.mHandler;
        if (j == 0) {
            MethodCollector.o(14572);
            return Q39.LIZJ;
        }
        String nativeCacheCurrentFrame = nativeCacheCurrentFrame(j, str, bool.booleanValue());
        MethodCollector.o(14572);
        return nativeCacheCurrentFrame;
    }

    public synchronized ArrayList<VEUndoRedoBean> getUndoRedoList(boolean z, int i) {
        MethodCollector.i(14574);
        if (this.mHandler == 0) {
            MethodCollector.o(14574);
            return null;
        }
        VEUndoRedoBean.JniHolder jniHolder = new VEUndoRedoBean.JniHolder();
        nativeGetUndoRedoList(this.mHandler, jniHolder, z, i);
        ArrayList<VEUndoRedoBean> jniResult = jniHolder.getJniResult();
        MethodCollector.o(14574);
        return jniResult;
    }

    public synchronized void executeRedoUndo(boolean z, int i, boolean z2) {
        MethodCollector.i(14570);
        long j = this.mHandler;
        if (j == 0) {
            MethodCollector.o(14570);
            return;
        }
        nativeExecuteRedoUndo(j, z, i, z2);
        MethodCollector.o(14570);
    }
}
