package J0;

import android.view.Choreographer;
import java.util.ArrayList;

/* JADX INFO: renamed from: J0.b0, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class ChoreographerFrameCallbackC0346b0 implements Choreographer.FrameCallback, Runnable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ C0349c0 f2980a;

    public ChoreographerFrameCallbackC0346b0(C0349c0 c0349c0) {
        this.f2980a = c0349c0;
    }

    @Override // android.view.Choreographer.FrameCallback
    public final void doFrame(long j4) {
        this.f2980a.f2989c.removeCallbacks(this);
        C0349c0.t(this.f2980a);
        C0349c0 c0349c0 = this.f2980a;
        synchronized (c0349c0.f2990d) {
            if (c0349c0.l) {
                c0349c0.l = false;
                ArrayList arrayList = c0349c0.f2992f;
                c0349c0.f2992f = c0349c0.f2993j;
                c0349c0.f2993j = arrayList;
                int size = arrayList.size();
                for (int i6 = 0; i6 < size; i6++) {
                    ((Choreographer.FrameCallback) arrayList.get(i6)).doFrame(j4);
                }
                arrayList.clear();
            }
        }
    }

    @Override // java.lang.Runnable
    public final void run() {
        C0349c0.t(this.f2980a);
        C0349c0 c0349c0 = this.f2980a;
        synchronized (c0349c0.f2990d) {
            if (c0349c0.f2992f.isEmpty()) {
                c0349c0.f2988b.removeFrameCallback(this);
                c0349c0.l = false;
            }
        }
    }
}
