package ῲ.㑃.K;

import android.os.Build;
import android.os.SystemClock;
import android.view.Choreographer;
import java.util.ArrayList;
import ῲ.㴹.C2288;

/* renamed from: ῲ.㑃.K.K  reason: contains not printable characters */
/* compiled from: AnimationHandler */
public class C2231 {

    /* renamed from: ⁱ  reason: contains not printable characters */
    public static final ThreadLocal<C2231> f7705 = new ThreadLocal<>();

    /* renamed from: ʬ  reason: contains not printable characters */
    public final C2234 f7706 = new C2234();

    /* renamed from: ඓ  reason: contains not printable characters */
    public long f7707 = 0;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final ArrayList<AbstractC2233> f7708 = new ArrayList<>();

    /* renamed from: K  reason: contains not printable characters */
    public final C2288<AbstractC2233, Long> f7709 = new C2288<>();

    /* renamed from: 㴹  reason: contains not printable characters */
    public boolean f7710 = false;

    /* renamed from: 㸾  reason: contains not printable characters */
    public AbstractC2232 f7711;

    /* renamed from: ῲ.㑃.K.K$ʬ  reason: contains not printable characters */
    /* compiled from: AnimationHandler */
    public static abstract class AbstractC2232 {

        /* renamed from: K  reason: contains not printable characters */
        public final C2234 f7712;

        public AbstractC2232(C2234 k) {
            this.f7712 = k;
        }

        /* renamed from: K  reason: contains not printable characters */
        public abstract void m5857();
    }

    /* renamed from: ῲ.㑃.K.K$ῲ  reason: contains not printable characters */
    /* compiled from: AnimationHandler */
    public interface AbstractC2233 {
        /* renamed from: K  reason: contains not printable characters */
        boolean m5858(long j);
    }

    /* renamed from: ῲ.㑃.K.K$K  reason: contains not printable characters */
    /* compiled from: AnimationHandler */
    public class C2234 {
        public C2234() {
        }

        /* renamed from: K  reason: contains not printable characters */
        public void m5859() {
            C2231.this.f7707 = SystemClock.uptimeMillis();
            C2231 k = C2231.this;
            k.m5856(k.f7707);
            if (C2231.this.f7708.size() > 0) {
                C2231 k2 = C2231.this;
                if (k2.f7711 == null) {
                    int i = Build.VERSION.SDK_INT;
                    k2.f7711 = new C2235(k2.f7706);
                }
                k2.f7711.m5857();
            }
        }
    }

    /* renamed from: ῲ.㑃.K.K$㸾  reason: contains not printable characters */
    /* compiled from: AnimationHandler */
    public static class C2235 extends AbstractC2232 {

        /* renamed from: ʬ  reason: contains not printable characters */
        public final Choreographer.FrameCallback f7714 = new Choreographer$FrameCallbackC2236();

        /* renamed from: ῲ  reason: contains not printable characters */
        public final Choreographer f7715 = Choreographer.getInstance();

        /* renamed from: ῲ.㑃.K.K$㸾$K  reason: contains not printable characters */
        /* compiled from: AnimationHandler */
        public class Choreographer$FrameCallbackC2236 implements Choreographer.FrameCallback {
            public Choreographer$FrameCallbackC2236() {
            }

            public void doFrame(long j) {
                C2235.this.f7712.m5859();
            }
        }

        public C2235(C2234 k) {
            super(k);
        }

        @Override // ῲ.㑃.K.C2231.AbstractC2232
        /* renamed from: K  reason: contains not printable characters */
        public void m5860() {
            this.f7715.postFrameCallback(this.f7714);
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public static C2231 m5854() {
        if (f7705.get() == null) {
            f7705.set(new C2231());
        }
        return f7705.get();
    }

    /* renamed from: K  reason: contains not printable characters */
    public AbstractC2232 m5855() {
        if (this.f7711 == null) {
            int i = Build.VERSION.SDK_INT;
            this.f7711 = new C2235(this.f7706);
        }
        return this.f7711;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5856(long j) {
        long uptimeMillis = SystemClock.uptimeMillis();
        for (int i = 0; i < this.f7708.size(); i++) {
            AbstractC2233 r4 = this.f7708.get(i);
            if (r4 != null) {
                Long orDefault = this.f7709.getOrDefault(r4, null);
                boolean z = true;
                if (orDefault != null) {
                    if (orDefault.longValue() < uptimeMillis) {
                        this.f7709.remove(r4);
                    } else {
                        z = false;
                    }
                }
                if (z) {
                    r4.m5858(j);
                }
            }
        }
        if (this.f7710) {
            int size = this.f7708.size();
            while (true) {
                size--;
                if (size < 0) {
                    this.f7710 = false;
                    return;
                } else if (this.f7708.get(size) == null) {
                    this.f7708.remove(size);
                }
            }
        }
    }
}
