package androidx.lifecycle;

import J0.B0;
import n2.C2616g;

/* JADX INFO: loaded from: classes.dex */
public final class V implements InterfaceC1111u, AutoCloseable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final String f12137a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final U f12138b;

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

    public V(String str, U u6) {
        this.f12137a = str;
        this.f12138b = u6;
    }

    @Override // androidx.lifecycle.InterfaceC1111u
    public final void a(InterfaceC1113w interfaceC1113w, EnumC1107p enumC1107p) {
        if (enumC1107p == EnumC1107p.ON_DESTROY) {
            this.f12139c = false;
            interfaceC1113w.getLifecycle().removeObserver(this);
        }
    }

    public final void b(r lifecycle, C2616g registry) {
        kotlin.jvm.internal.o.h(registry, "registry");
        kotlin.jvm.internal.o.h(lifecycle, "lifecycle");
        if (this.f12139c) {
            throw new IllegalStateException("Already attached to lifecycleOwner");
        }
        this.f12139c = true;
        lifecycle.addObserver(this);
        registry.c(this.f12137a, (B0) this.f12138b.f12136b.f6542a);
    }

    @Override // java.lang.AutoCloseable
    public final void close() {
    }
}
