package androidx.lifecycle;

import android.os.Looper;
import android.util.Log;
import android.view.View;
import d3.V0;
import h0.DialogInterfaceOnCancelListenerC1017q;
import java.util.Map;
import o.C1319a;
import p.C1407d;
import p.C1409f;

/* JADX INFO: loaded from: classes.dex */
public class A {

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

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

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f8749c = 0;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public boolean f8750d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public volatile Object f8751e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public volatile Object f8752f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public int f8753g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public boolean f8754h;
    public boolean i;

    public A() {
        Object obj = f8746j;
        this.f8752f = obj;
        this.f8751e = obj;
        this.f8753g = -1;
    }

    public static void a(String str) {
        C1319a.D().f15552f.getClass();
        if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
            throw new IllegalStateException(I1.a.p("Cannot invoke ", str, " on a background thread"));
        }
    }

    public final void b(C0520z c0520z) {
        if (c0520z.f8859b) {
            int i = c0520z.f8860c;
            int i5 = this.f8753g;
            if (i >= i5) {
                return;
            }
            c0520z.f8860c = i5;
            V0 v02 = c0520z.f8858a;
            Object obj = this.f8751e;
            v02.getClass();
            if (((InterfaceC0516v) obj) != null) {
                DialogInterfaceOnCancelListenerC1017q dialogInterfaceOnCancelListenerC1017q = (DialogInterfaceOnCancelListenerC1017q) v02.f11784r;
                if (dialogInterfaceOnCancelListenerC1017q.f13233v0) {
                    View viewB0 = dialogInterfaceOnCancelListenerC1017q.b0();
                    if (viewB0.getParent() != null) {
                        throw new IllegalStateException("DialogFragment can not be attached to a container view");
                    }
                    if (dialogInterfaceOnCancelListenerC1017q.f13237z0 != null) {
                        if (h0.P.L(3)) {
                            Log.d("FragmentManager", "DialogFragment " + v02 + " setting the content view on " + dialogInterfaceOnCancelListenerC1017q.f13237z0);
                        }
                        dialogInterfaceOnCancelListenerC1017q.f13237z0.setContentView(viewB0);
                    }
                }
            }
        }
    }

    public final void c(C0520z c0520z) {
        if (this.f8754h) {
            this.i = true;
            return;
        }
        this.f8754h = true;
        do {
            this.i = false;
            if (c0520z != null) {
                b(c0520z);
                c0520z = null;
            } else {
                C1409f c1409f = this.f8748b;
                c1409f.getClass();
                C1407d c1407d = new C1407d(c1409f);
                c1409f.f16020s.put(c1407d, Boolean.FALSE);
                while (c1407d.hasNext()) {
                    b((C0520z) ((Map.Entry) c1407d.next()).getValue());
                    if (this.i) {
                        break;
                    }
                }
            }
        } while (this.i);
        this.f8754h = false;
    }
}
