package androidx.lifecycle;

import android.util.Log;
import androidx.lifecycle.a;
import java.lang.ref.WeakReference;

/* JADX INFO: compiled from: LifecycleRegistry.java */
/* JADX INFO: loaded from: classes.dex */
public class c extends androidx.lifecycle.a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private a.b f793a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final WeakReference<b> f794b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private int f795c;

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private boolean f797e;

    /* JADX INFO: compiled from: LifecycleRegistry.java */
    static /* synthetic */ class a {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        static final /* synthetic */ int[] f798a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        static final /* synthetic */ int[] f799b;

        static {
            int[] iArr = new int[a.b.values().length];
            f799b = iArr;
            try {
                iArr[a.b.INITIALIZED.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f799b[a.b.CREATED.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f799b[a.b.STARTED.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                f799b[a.b.RESUMED.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                f799b[a.b.DESTROYED.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            int[] iArr2 = new int[a.EnumC0027a.values().length];
            f798a = iArr2;
            try {
                iArr2[a.EnumC0027a.ON_CREATE.ordinal()] = 1;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                f798a[a.EnumC0027a.ON_STOP.ordinal()] = 2;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                f798a[a.EnumC0027a.ON_START.ordinal()] = 3;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                f798a[a.EnumC0027a.ON_PAUSE.ordinal()] = 4;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                f798a[a.EnumC0027a.ON_RESUME.ordinal()] = 5;
            } catch (NoSuchFieldError unused10) {
            }
            try {
                f798a[a.EnumC0027a.ON_DESTROY.ordinal()] = 6;
            } catch (NoSuchFieldError unused11) {
            }
            try {
                f798a[a.EnumC0027a.ON_ANY.ordinal()] = 7;
            } catch (NoSuchFieldError unused12) {
            }
        }
    }

    static a.b a(a.EnumC0027a enumC0027a) {
        switch (a.f798a[enumC0027a.ordinal()]) {
            case 1:
            case 2:
                return a.b.CREATED;
            case 3:
            case 4:
                return a.b.STARTED;
            case 5:
                return a.b.RESUMED;
            case 6:
                return a.b.DESTROYED;
            default:
                throw new IllegalArgumentException("Unexpected event value " + enumC0027a);
        }
    }

    private boolean c() {
        throw null;
    }

    private void d(a.b bVar) {
        if (this.f793a == bVar) {
            return;
        }
        this.f793a = bVar;
        if (this.f796d || this.f795c != 0) {
            this.f797e = true;
            return;
        }
        this.f796d = true;
        e();
        this.f796d = false;
    }

    private void e() {
        if (this.f794b.get() == null) {
            Log.w("LifecycleRegistry", "LifecycleOwner is garbage collected, you shouldn't try dispatch new events from it.");
        } else if (c()) {
            this.f797e = false;
        } else {
            this.f797e = false;
            throw null;
        }
    }

    public void b(a.EnumC0027a enumC0027a) {
        d(a(enumC0027a));
    }
}
