package com.bytedance.monitor.collector;

import X.AnonymousClass7g3;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import com.bytedance.covode.number.Covode;

public final class DoFrameBooster {
    public static Handler LIZ;
    public static Object LIZIZ = null;
    public static volatile boolean LIZJ = false;
    public static int LIZLLL = 0;
    public static int LJ = 1;
    public static final ProxyFrameHandler LJFF = new ProxyFrameHandler(Looper.getMainLooper());

    static {
        Covode.recordClassIndex(36128);
    }

    public static class ProxyFrameHandler extends Handler {
        static {
            Covode.recordClassIndex(36129);
        }

        public ProxyFrameHandler(Looper looper) {
            super(looper);
        }

        public void handleMessage(Message message) {
            DoFrameBooster.LIZ.handleMessage(message);
        }

        public boolean sendMessageAtTime(Message message, long j) {
            if (message.getCallback() != DoFrameBooster.LIZIZ || !DoFrameBooster.LIZJ) {
                return super.sendMessageAtTime(message, j);
            }
            if (DoFrameBooster.LJ == 0) {
                return sendMessageAtFrontOfQueue(message);
            }
            Message LIZ = AnonymousClass7g3.LIZ(AnonymousClass7g3.LIZ());
            if (LIZ == null) {
                return sendMessageAtFrontOfQueue(message);
            }
            return super.sendMessageAtTime(message, Math.min(LIZ.getWhen() + ((long) DoFrameBooster.LIZLLL), j));
        }
    }
}
