package J0;

import V4.AbstractC0786y;
import android.os.Handler;
import android.view.Choreographer;
import java.util.ArrayList;
import x4.C3249o;

/* JADX INFO: renamed from: J0.c0, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0349c0 extends AbstractC0786y {

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public static final w4.p f2986o = m1.g.k(P.f2916j);

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public static final C0343a0 f2987p = new C0343a0(0);

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final Choreographer f2988b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final Handler f2989c;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public boolean f2994k;
    public boolean l;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public final C0355e0 f2996n;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Object f2990d = new Object();

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final C3249o f2991e = new C3249o();

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public ArrayList f2992f = new ArrayList();

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public ArrayList f2993j = new ArrayList();

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final ChoreographerFrameCallbackC0346b0 f2995m = new ChoreographerFrameCallbackC0346b0(this);

    public C0349c0(Choreographer choreographer, Handler handler) {
        this.f2988b = choreographer;
        this.f2989c = handler;
        this.f2996n = new C0355e0(choreographer, this);
    }

    public static final void t(C0349c0 c0349c0) {
        Runnable runnable;
        boolean z6;
        do {
            synchronized (c0349c0.f2990d) {
                C3249o c3249o = c0349c0.f2991e;
                runnable = (Runnable) (c3249o.isEmpty() ? null : c3249o.removeFirst());
            }
            while (runnable != null) {
                runnable.run();
                synchronized (c0349c0.f2990d) {
                    C3249o c3249o2 = c0349c0.f2991e;
                    runnable = (Runnable) (c3249o2.isEmpty() ? null : c3249o2.removeFirst());
                }
            }
            synchronized (c0349c0.f2990d) {
                if (c0349c0.f2991e.isEmpty()) {
                    z6 = false;
                    c0349c0.f2994k = false;
                } else {
                    z6 = true;
                }
            }
        } while (z6);
    }

    @Override // V4.AbstractC0786y
    public final void c(A4.j jVar, Runnable runnable) {
        synchronized (this.f2990d) {
            this.f2991e.addLast(runnable);
            if (!this.f2994k) {
                this.f2994k = true;
                this.f2989c.post(this.f2995m);
                if (!this.l) {
                    this.l = true;
                    this.f2988b.postFrameCallback(this.f2995m);
                }
            }
        }
    }
}
