package androidx.lifecycle;

import androidx.lifecycle.AbstractC0424i;
import p065v0.C1755c;
import p065v0.InterfaceC1761e;

/* loaded from: classes.dex */
public class LegacySavedStateHandleController {

    /* renamed from: androidx.lifecycle.LegacySavedStateHandleController$a */
    /* loaded from: classes.dex */
    public static final class C0394a implements C1755c.InterfaceC1756a {
        @Override // p065v0.C1755c.InterfaceC1756a
        /* renamed from: a */
        public void mo462a(InterfaceC1761e interfaceC1761e) {
            if (!(interfaceC1761e instanceof InterfaceC0423h0)) {
                throw new IllegalStateException("Internal error: OnRecreation should be registered only on components that implement ViewModelStoreOwner");
            }
            C0421g0 mo3701j = ((InterfaceC0423h0) interfaceC1761e).mo3701j();
            C1755c mo454d = interfaceC1761e.mo454d();
            for (String str : mo3701j.m3704c()) {
                LegacySavedStateHandleController.m3752a(mo3701j.m3705b(str), mo454d, interfaceC1761e.mo421a());
            }
            if (mo3701j.m3704c().isEmpty()) {
                return;
            }
            mo454d.m463i(C0394a.class);
        }
    }

    /* renamed from: a */
    public static void m3752a(AbstractC0405c0 abstractC0405c0, C1755c c1755c, AbstractC0424i abstractC0424i) {
        SavedStateHandleController savedStateHandleController = (SavedStateHandleController) abstractC0405c0.m3721c("androidx.lifecycle.savedstate.vm.tag");
        if (savedStateHandleController == null || savedStateHandleController.m3741i()) {
            return;
        }
        savedStateHandleController.m3742h(c1755c, abstractC0424i);
        m3751b(c1755c, abstractC0424i);
    }

    /* renamed from: b */
    public static void m3751b(final C1755c c1755c, final AbstractC0424i abstractC0424i) {
        AbstractC0424i.EnumC0427c mo3692b = abstractC0424i.mo3692b();
        if (mo3692b == AbstractC0424i.EnumC0427c.INITIALIZED || mo3692b.m3697a(AbstractC0424i.EnumC0427c.STARTED)) {
            c1755c.m463i(C0394a.class);
        } else {
            abstractC0424i.mo3693a(new InterfaceC0432k() { // from class: androidx.lifecycle.LegacySavedStateHandleController.1
                @Override // androidx.lifecycle.InterfaceC0432k
                /* renamed from: d */
                public void mo472d(InterfaceC0434m interfaceC0434m, AbstractC0424i.EnumC0426b enumC0426b) {
                    if (enumC0426b == AbstractC0424i.EnumC0426b.ON_START) {
                        AbstractC0424i.this.mo3691c(this);
                        c1755c.m463i(C0394a.class);
                    }
                }
            });
        }
    }
}