package com.bytedance.ammt.mmt.impl;

import X.4Sh;
import X.AnonymousClass0PT;
import X.AnonymousClass0PW;
import android.content.Context;
import android.os.SystemClock;
import com.bytedance.android.bytehook.ByteHook;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.librarian.Librarian;
import java.io.File;

public class GraphicMMTPlugin extends AnonymousClass0PT {
    public static GraphicMMTPlugin LIZLLL;
    public static String LJ = "gmt";
    public static String LJII = "_usage";
    public static String LJIIIIZZ = "_profile";
    public String LJFF;
    public String LJI;

    public static native void gmt_native_dump(String str, String str2);

    public static native void gmt_native_setConfigParams(int i);

    public static native void gmt_native_setMemoryThreshold(long j, long j2);

    public static native void gmt_native_start();

    public static native void gmt_native_stop();

    static {
        Covode.recordClassIndex(4240);
        long uptimeMillis = SystemClock.uptimeMillis();
        Librarian.LIZ("mmt", false, (Context) null);
        4Sh.LIZ(uptimeMillis, "mmt");
    }

    public final void LIZ() {
        MethodCollector.i(19233);
        super.LIZ();
        ByteHook.init();
        gmt_native_start();
        this.LIZJ = true;
        MethodCollector.o(19233);
    }

    public final void LIZIZ() {
        MethodCollector.i(19329);
        super.LIZIZ();
        gmt_native_dump(this.LJFF, this.LJI);
        MethodCollector.o(19329);
    }

    public static GraphicMMTPlugin LIZJ() {
        MethodCollector.i(19210);
        if (LIZLLL == null) {
            synchronized (GraphicMMTPlugin.class) {
                try {
                    LIZLLL = new GraphicMMTPlugin();
                } catch (Throwable th) {
                    MethodCollector.o(19210);
                    throw th;
                }
            }
        }
        GraphicMMTPlugin graphicMMTPlugin = LIZLLL;
        MethodCollector.o(19210);
        return graphicMMTPlugin;
    }

    public final void LIZ(int i) {
        MethodCollector.i(19264);
        super.LIZ(i);
        gmt_native_setConfigParams(i);
        MethodCollector.o(19264);
    }

    public final void LIZ(Context context) {
        String str = this.LJFF + File.separator + this.LJI + LJII;
        String str2 = this.LJFF + File.separator + this.LJI + LJIIIIZZ;
        File file = new File(str);
        File file2 = new File(str2);
        if (file.exists() && file2.exists()) {
            new Thread(new AnonymousClass0PW(str2, str, context)).start();
        }
    }

    public final void LIZ(long j, long j2) {
        MethodCollector.i(19300);
        super.LIZ(j, j2);
        gmt_native_setMemoryThreshold(j, j2);
        MethodCollector.o(19300);
    }

    public final void LIZ(String str, String str2) {
        super.LIZ(str, str2);
        this.LJFF = str + File.separator + LJ;
        this.LJI = str2;
    }
}
