package androidx.lifecycle;

import androidx.annotation.NonNull;

/* JADX INFO: loaded from: classes.dex */
class LiveData$LifecycleBoundObserver extends u implements LifecycleEventObserver {

    @NonNull
    final p mOwner;
    final /* synthetic */ v this$0;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public LiveData$LifecycleBoundObserver(@NonNull v vVar, p pVar, x xVar) {
        super(vVar, xVar);
        this.this$0 = vVar;
        this.mOwner = pVar;
    }

    @Override // androidx.lifecycle.u
    public void detachObserver() {
        this.mOwner.getLifecycle().b(this);
    }

    @Override // androidx.lifecycle.u
    public boolean isAttachedTo(p pVar) {
        return this.mOwner == pVar;
    }

    @Override // androidx.lifecycle.LifecycleEventObserver
    public void onStateChanged(@NonNull p pVar, @NonNull Lifecycle$Event lifecycle$Event) {
        Lifecycle$State lifecycle$State = ((r) this.mOwner.getLifecycle()).f2692c;
        if (lifecycle$State == Lifecycle$State.f2631a) {
            this.this$0.g(this.mObserver);
            return;
        }
        Lifecycle$State lifecycle$State2 = null;
        while (lifecycle$State2 != lifecycle$State) {
            activeStateChanged(shouldBeActive());
            lifecycle$State2 = lifecycle$State;
            lifecycle$State = ((r) this.mOwner.getLifecycle()).f2692c;
        }
    }

    @Override // androidx.lifecycle.u
    public boolean shouldBeActive() {
        return ((r) this.mOwner.getLifecycle()).f2692c.a(Lifecycle$State.f2634d);
    }
}
