package androidx.loader.app;

import androidx.annotation.NonNull;
import androidx.collection.t;
import androidx.collection.u;
import androidx.lifecycle.s0;
import androidx.lifecycle.u0;
import androidx.lifecycle.x0;
import androidx.lifecycle.y0;
import java.io.FileDescriptor;
import java.io.PrintWriter;

/* JADX INFO: loaded from: classes.dex */
class LoaderManagerImpl$LoaderViewModel extends s0 {
    private static final u0 FACTORY = new e();
    private t mLoaders = new t();
    private boolean mCreatingLoader = false;

    @NonNull
    public static LoaderManagerImpl$LoaderViewModel getInstance(y0 y0Var) {
        return (LoaderManagerImpl$LoaderViewModel) new x0(y0Var, FACTORY).a(LoaderManagerImpl$LoaderViewModel.class);
    }

    public void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
        if (this.mLoaders.e() > 0) {
            printWriter.print(str);
            printWriter.println("Loaders:");
            String str2 = str + "    ";
            if (this.mLoaders.e() <= 0) {
                return;
            }
            c cVar = (c) this.mLoaders.f(0);
            printWriter.print(str);
            printWriter.print("  #");
            t tVar = this.mLoaders;
            if (tVar.f969a) {
                u.a(tVar);
            }
            printWriter.print(tVar.f970b[0]);
            printWriter.print(": ");
            printWriter.println(cVar.toString());
            cVar.k(str2, printWriter);
            throw null;
        }
    }

    public void finishCreatingLoader() {
        this.mCreatingLoader = false;
    }

    public <D> c getLoader(int i10) {
        return (c) this.mLoaders.c(i10);
    }

    public boolean hasRunningLoaders() {
        int iE = this.mLoaders.e();
        for (int i10 = 0; i10 < iE; i10++) {
            c cVar = (c) this.mLoaders.f(i10);
            if (cVar.f2710c > 0 && cVar.f2727n != null) {
                return true;
            }
        }
        return false;
    }

    public boolean isCreatingLoader() {
        return this.mCreatingLoader;
    }

    public void markForRedelivery() {
        int iE = this.mLoaders.e();
        for (int i10 = 0; i10 < iE; i10++) {
            ((c) this.mLoaders.f(i10)).l();
        }
    }

    @Override // androidx.lifecycle.s0
    public void onCleared() {
        super.onCleared();
        if (this.mLoaders.e() > 0) {
            ((c) this.mLoaders.f(0)).getClass();
            throw null;
        }
        t tVar = this.mLoaders;
        int i10 = tVar.f972d;
        Object[] objArr = tVar.f971c;
        for (int i11 = 0; i11 < i10; i11++) {
            objArr[i11] = null;
        }
        tVar.f972d = 0;
        tVar.f969a = false;
    }

    public void putLoader(int i10, @NonNull c cVar) {
        this.mLoaders.d(i10, cVar);
    }

    public void removeLoader(int i10) {
        t tVar = this.mLoaders;
        tVar.getClass();
        Object obj = u.f973a;
        int iA = t.a.a(tVar.f972d, i10, tVar.f970b);
        if (iA >= 0) {
            Object[] objArr = tVar.f971c;
            Object obj2 = objArr[iA];
            Object obj3 = u.f973a;
            if (obj2 != obj3) {
                objArr[iA] = obj3;
                tVar.f969a = true;
            }
        }
    }

    public void startCreatingLoader() {
        this.mCreatingLoader = true;
    }
}
