package X6FRs_4.KNBe_11;

import X6FRs_4.KNBe_11.IFxWkV_5;
import X6FRs_4.KNBe_11.NQvZgp_17;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
/* compiled from: ProcessLifecycleOwner.java */
/* loaded from: classes.dex */
public class JZJr_16 implements Xgtqvk_8 {
    public static final JZJr_16 KQgRr5e_0 = new JZJr_16();

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Handler f607KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public int f604KQgRr5e_0 = 0;
    public int QxJ9d_1 = 0;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public boolean f609QxJ9d_1 = true;
    public boolean PGPF6hQ_2 = true;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final XnFJ5_9 f606KQgRr5e_0 = new XnFJ5_9(this);

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Runnable f608KQgRr5e_0 = new KQgRr5e_0();

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public NQvZgp_17.KQgRr5e_0 f605KQgRr5e_0 = new QxJ9d_1();

    /* compiled from: ProcessLifecycleOwner.java */
    /* loaded from: classes.dex */
    public class KQgRr5e_0 implements Runnable {
        public KQgRr5e_0() {
        }

        @Override // java.lang.Runnable
        public void run() {
            JZJr_16.this.X6FRs_4();
            JZJr_16.this.IFxWkV_5();
        }
    }

    /* compiled from: ProcessLifecycleOwner.java */
    /* loaded from: classes.dex */
    public class PGPF6hQ_2 extends X6FRs_4.KNBe_11.QxJ9d_1 {
        public PGPF6hQ_2() {
        }

        @Override // android.app.Application.ActivityLifecycleCallbacks
        public void onActivityCreated(Activity activity, Bundle bundle) {
            NQvZgp_17.KQgRr5e_0(activity).Mqv2r_3(JZJr_16.this.f605KQgRr5e_0);
        }

        @Override // X6FRs_4.KNBe_11.QxJ9d_1, android.app.Application.ActivityLifecycleCallbacks
        public void onActivityPaused(Activity activity) {
            JZJr_16.this.KQgRr5e_0();
        }

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

    /* compiled from: ProcessLifecycleOwner.java */
    /* loaded from: classes.dex */
    public class QxJ9d_1 implements NQvZgp_17.KQgRr5e_0 {
        public QxJ9d_1() {
        }

        @Override // X6FRs_4.KNBe_11.NQvZgp_17.KQgRr5e_0
        public void KQgRr5e_0() {
        }

        @Override // X6FRs_4.KNBe_11.NQvZgp_17.KQgRr5e_0
        public void PGPF6hQ_2() {
            JZJr_16.this.PGPF6hQ_2();
        }

        @Override // X6FRs_4.KNBe_11.NQvZgp_17.KQgRr5e_0
        public void QxJ9d_1() {
            JZJr_16.this.QxJ9d_1();
        }
    }

    public static void QxJ9d_1(Context context) {
        KQgRr5e_0.KQgRr5e_0(context);
    }

    public void IFxWkV_5() {
        if (this.f604KQgRr5e_0 == 0 && this.f609QxJ9d_1) {
            this.f606KQgRr5e_0.m361KQgRr5e_0(IFxWkV_5.KQgRr5e_0.ON_STOP);
            this.PGPF6hQ_2 = true;
        }
    }

    public void KQgRr5e_0() {
        int i = this.QxJ9d_1 - 1;
        this.QxJ9d_1 = i;
        if (i == 0) {
            this.f607KQgRr5e_0.postDelayed(this.f608KQgRr5e_0, 700L);
        }
    }

    public void Mqv2r_3() {
        this.f604KQgRr5e_0--;
        IFxWkV_5();
    }

    public void PGPF6hQ_2() {
        int i = this.f604KQgRr5e_0 + 1;
        this.f604KQgRr5e_0 = i;
        if (i == 1 && this.PGPF6hQ_2) {
            this.f606KQgRr5e_0.m361KQgRr5e_0(IFxWkV_5.KQgRr5e_0.ON_START);
            this.PGPF6hQ_2 = false;
        }
    }

    public void X6FRs_4() {
        if (this.QxJ9d_1 == 0) {
            this.f609QxJ9d_1 = true;
            this.f606KQgRr5e_0.m361KQgRr5e_0(IFxWkV_5.KQgRr5e_0.ON_PAUSE);
        }
    }

    @Override // X6FRs_4.KNBe_11.Xgtqvk_8
    public IFxWkV_5 getLifecycle() {
        return this.f606KQgRr5e_0;
    }

    public void QxJ9d_1() {
        int i = this.QxJ9d_1 + 1;
        this.QxJ9d_1 = i;
        if (i == 1) {
            if (this.f609QxJ9d_1) {
                this.f606KQgRr5e_0.m361KQgRr5e_0(IFxWkV_5.KQgRr5e_0.ON_RESUME);
                this.f609QxJ9d_1 = false;
                return;
            }
            this.f607KQgRr5e_0.removeCallbacks(this.f608KQgRr5e_0);
        }
    }

    public void KQgRr5e_0(Context context) {
        this.f607KQgRr5e_0 = new Handler();
        this.f606KQgRr5e_0.m361KQgRr5e_0(IFxWkV_5.KQgRr5e_0.ON_CREATE);
        ((Application) context.getApplicationContext()).registerActivityLifecycleCallbacks(new PGPF6hQ_2());
    }
}
