package L0;

import android.os.Looper;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.concurrent.CopyOnWriteArrayList;
import u0.C1588y;
import x0.AbstractC1709a;

/* JADX INFO: renamed from: L0.a, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC0146a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final ArrayList f3756a = new ArrayList(1);

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final HashSet f3757b = new HashSet(1);

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final E0.e f3758c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final E0.e f3759d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public Looper f3760e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public u0.S f3761f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public C0.l f3762g;

    public AbstractC0146a() {
        int i = 0;
        C c3 = null;
        this.f3758c = new E0.e(new CopyOnWriteArrayList(), i, c3);
        this.f3759d = new E0.e(new CopyOnWriteArrayList(), i, c3);
    }

    public abstract A a(C c3, P0.e eVar, long j8);

    public final void b(D d8) {
        HashSet hashSet = this.f3757b;
        boolean zIsEmpty = hashSet.isEmpty();
        hashSet.remove(d8);
        if (zIsEmpty || !hashSet.isEmpty()) {
            return;
        }
        c();
    }

    public final void d(D d8) {
        this.f3760e.getClass();
        HashSet hashSet = this.f3757b;
        boolean zIsEmpty = hashSet.isEmpty();
        hashSet.add(d8);
        if (zIsEmpty) {
            e();
        }
    }

    public u0.S f() {
        return null;
    }

    public abstract C1588y g();

    public boolean h() {
        return true;
    }

    public abstract void i();

    public final void j(D d8, z0.y yVar, C0.l lVar) {
        Looper looperMyLooper = Looper.myLooper();
        Looper looper = this.f3760e;
        AbstractC1709a.d(looper == null || looper == looperMyLooper);
        this.f3762g = lVar;
        u0.S s8 = this.f3761f;
        this.f3756a.add(d8);
        if (this.f3760e == null) {
            this.f3760e = looperMyLooper;
            this.f3757b.add(d8);
            k(yVar);
        } else if (s8 != null) {
            d(d8);
            d8.a(this, s8);
        }
    }

    public abstract void k(z0.y yVar);

    public final void l(u0.S s8) {
        this.f3761f = s8;
        ArrayList arrayList = this.f3756a;
        int size = arrayList.size();
        int i = 0;
        while (i < size) {
            Object obj = arrayList.get(i);
            i++;
            ((D) obj).a(this, s8);
        }
    }

    public abstract void m(A a3);

    public final void n(D d8) {
        ArrayList arrayList = this.f3756a;
        arrayList.remove(d8);
        if (!arrayList.isEmpty()) {
            b(d8);
            return;
        }
        this.f3760e = null;
        this.f3761f = null;
        this.f3762g = null;
        this.f3757b.clear();
        o();
    }

    public abstract void o();

    public final void p(E0.f fVar) {
        CopyOnWriteArrayList<E0.d> copyOnWriteArrayList = this.f3759d.f1973c;
        for (E0.d dVar : copyOnWriteArrayList) {
            if (dVar.f1970a == fVar) {
                copyOnWriteArrayList.remove(dVar);
            }
        }
    }

    public final void q(I i) {
        CopyOnWriteArrayList<H> copyOnWriteArrayList = this.f3758c.f1973c;
        for (H h8 : copyOnWriteArrayList) {
            if (h8.f3644b == i) {
                copyOnWriteArrayList.remove(h8);
            }
        }
    }

    public void r(C1588y c1588y) {
    }

    public void c() {
    }

    public void e() {
    }
}
