package androidx.lifecycle;

import android.app.Activity;
import android.app.Application;
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Build;
import android.os.Bundle;
import androidx.lifecycle.AbstractC0424i;

/* renamed from: androidx.lifecycle.w */
/* loaded from: classes.dex */
public class FragmentC0449w extends Fragment {

    /* renamed from: d */
    public InterfaceC0450a f1663d;

    /* renamed from: androidx.lifecycle.w$a */
    /* loaded from: classes.dex */
    public interface InterfaceC0450a {
        /* renamed from: a */
        void mo3651a();

        /* renamed from: b */
        void mo3650b();

        /* renamed from: c */
        void mo3649c();
    }

    /* renamed from: androidx.lifecycle.w$b */
    /* loaded from: classes.dex */
    public static class C0451b implements Application.ActivityLifecycleCallbacks {
        public static void registerIn(Activity activity) {
            activity.registerActivityLifecycleCallbacks(new C0451b());
        }

        @Override // android.app.Application.ActivityLifecycleCallbacks
        public void onActivityCreated(Activity activity, Bundle bundle) {
        }

        @Override // android.app.Application.ActivityLifecycleCallbacks
        public void onActivityDestroyed(Activity activity) {
        }

        @Override // android.app.Application.ActivityLifecycleCallbacks
        public void onActivityPaused(Activity activity) {
        }

        @Override // android.app.Application.ActivityLifecycleCallbacks
        public void onActivityPostCreated(Activity activity, Bundle bundle) {
            FragmentC0449w.m3659a(activity, AbstractC0424i.EnumC0426b.ON_CREATE);
        }

        @Override // android.app.Application.ActivityLifecycleCallbacks
        public void onActivityPostResumed(Activity activity) {
            FragmentC0449w.m3659a(activity, AbstractC0424i.EnumC0426b.ON_RESUME);
        }

        @Override // android.app.Application.ActivityLifecycleCallbacks
        public void onActivityPostStarted(Activity activity) {
            FragmentC0449w.m3659a(activity, AbstractC0424i.EnumC0426b.ON_START);
        }

        @Override // android.app.Application.ActivityLifecycleCallbacks
        public void onActivityPreDestroyed(Activity activity) {
            FragmentC0449w.m3659a(activity, AbstractC0424i.EnumC0426b.ON_DESTROY);
        }

        @Override // android.app.Application.ActivityLifecycleCallbacks
        public void onActivityPrePaused(Activity activity) {
            FragmentC0449w.m3659a(activity, AbstractC0424i.EnumC0426b.ON_PAUSE);
        }

        @Override // android.app.Application.ActivityLifecycleCallbacks
        public void onActivityPreStopped(Activity activity) {
            FragmentC0449w.m3659a(activity, AbstractC0424i.EnumC0426b.ON_STOP);
        }

        @Override // android.app.Application.ActivityLifecycleCallbacks
        public void onActivityResumed(Activity activity) {
        }

        @Override // android.app.Application.ActivityLifecycleCallbacks
        public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
        }

        @Override // android.app.Application.ActivityLifecycleCallbacks
        public void onActivityStarted(Activity activity) {
        }

        @Override // android.app.Application.ActivityLifecycleCallbacks
        public void onActivityStopped(Activity activity) {
        }
    }

    /* renamed from: a */
    public static void m3659a(Activity activity, AbstractC0424i.EnumC0426b enumC0426b) {
        if (activity instanceof InterfaceC0437o) {
            ((InterfaceC0437o) activity).mo421a().m3686h(enumC0426b);
        } else if (activity instanceof InterfaceC0434m) {
            AbstractC0424i mo421a = ((InterfaceC0434m) activity).mo421a();
            if (mo421a instanceof C0435n) {
                ((C0435n) mo421a).m3686h(enumC0426b);
            }
        }
    }

    /* renamed from: f */
    public static FragmentC0449w m3654f(Activity activity) {
        return (FragmentC0449w) activity.getFragmentManager().findFragmentByTag("androidx.lifecycle.LifecycleDispatcher.report_fragment_tag");
    }

    /* renamed from: g */
    public static void m3653g(Activity activity) {
        if (Build.VERSION.SDK_INT >= 29) {
            C0451b.registerIn(activity);
        }
        FragmentManager fragmentManager = activity.getFragmentManager();
        if (fragmentManager.findFragmentByTag("androidx.lifecycle.LifecycleDispatcher.report_fragment_tag") == null) {
            fragmentManager.beginTransaction().add(new FragmentC0449w(), "androidx.lifecycle.LifecycleDispatcher.report_fragment_tag").commit();
            fragmentManager.executePendingTransactions();
        }
    }

    /* renamed from: b */
    public final void m3658b(AbstractC0424i.EnumC0426b enumC0426b) {
        if (Build.VERSION.SDK_INT < 29) {
            m3659a(getActivity(), enumC0426b);
        }
    }

    /* renamed from: c */
    public final void m3657c(InterfaceC0450a interfaceC0450a) {
        if (interfaceC0450a != null) {
            interfaceC0450a.mo3651a();
        }
    }

    /* renamed from: d */
    public final void m3656d(InterfaceC0450a interfaceC0450a) {
        if (interfaceC0450a != null) {
            interfaceC0450a.mo3650b();
        }
    }

    /* renamed from: e */
    public final void m3655e(InterfaceC0450a interfaceC0450a) {
        if (interfaceC0450a != null) {
            interfaceC0450a.mo3649c();
        }
    }

    /* renamed from: h */
    public void m3652h(InterfaceC0450a interfaceC0450a) {
        this.f1663d = interfaceC0450a;
    }

    @Override // android.app.Fragment
    public void onActivityCreated(Bundle bundle) {
        super.onActivityCreated(bundle);
        m3657c(this.f1663d);
        m3658b(AbstractC0424i.EnumC0426b.ON_CREATE);
    }

    @Override // android.app.Fragment
    public void onDestroy() {
        super.onDestroy();
        m3658b(AbstractC0424i.EnumC0426b.ON_DESTROY);
        this.f1663d = null;
    }

    @Override // android.app.Fragment
    public void onPause() {
        super.onPause();
        m3658b(AbstractC0424i.EnumC0426b.ON_PAUSE);
    }

    @Override // android.app.Fragment
    public void onResume() {
        super.onResume();
        m3656d(this.f1663d);
        m3658b(AbstractC0424i.EnumC0426b.ON_RESUME);
    }

    @Override // android.app.Fragment
    public void onStart() {
        super.onStart();
        m3655e(this.f1663d);
        m3658b(AbstractC0424i.EnumC0426b.ON_START);
    }

    @Override // android.app.Fragment
    public void onStop() {
        super.onStop();
        m3658b(AbstractC0424i.EnumC0426b.ON_STOP);
    }
}