package o; import android.app.Activity; import android.app.Application; import android.content.Context; import android.os.Build; import android.os.Bundle; import android.os.Handler; import androidx.lifecycle.ReportFragment; import o.wdQ; /* loaded from: classes.dex */ public class LkC implements InterfaceC16541pFg { private static final LkC g = new LkC(); Handler c; int f = 0; int i = 0; boolean a = true; private boolean j = true; final LPk b = new LPk(this); Runnable e = new Runnable(this) { // from class: o.LkC.4 final LkC b; { this.b = this; } @Override // java.lang.Runnable public final void run() { LkC lkC = this.b; if (lkC.i == 0) { lkC.a = true; LPk lPk = lkC.b; wdQ.HBt hBt = wdQ.HBt.ON_PAUSE; lPk.d("handleLifecycleEvent"); lPk.d(hBt.a()); } this.b.b(); } }; ReportFragment.RVV d = new ReportFragment.RVV(this) { // from class: o.LkC.1 final LkC d; { this.d = this; } @Override // androidx.lifecycle.ReportFragment.RVV public final void b() { this.d.c(); } @Override // androidx.lifecycle.ReportFragment.RVV public final void a() { this.d.a(); } }; final void c() { int i = this.f + 1; this.f = i; if (i == 1 && this.j) { LPk lPk = this.b; wdQ.HBt hBt = wdQ.HBt.ON_START; lPk.d("handleLifecycleEvent"); lPk.d(hBt.a()); this.j = false; } } final void a() { int i = this.i + 1; this.i = i; if (i == 1) { if (this.a) { LPk lPk = this.b; wdQ.HBt hBt = wdQ.HBt.ON_RESUME; lPk.d("handleLifecycleEvent"); lPk.d(hBt.a()); this.a = false; return; } this.c.removeCallbacks(this.e); } } final void b() { if (this.f == 0 && this.a) { LPk lPk = this.b; wdQ.HBt hBt = wdQ.HBt.ON_STOP; lPk.d("handleLifecycleEvent"); lPk.d(hBt.a()); this.j = true; } } private LkC() { } /* renamed from: o.LkC$5, reason: invalid class name */ /* loaded from: classes.dex */ class AnonymousClass5 extends RlI { final LkC this$0; AnonymousClass5(LkC lkC) { this.this$0 = lkC; } @Override // android.app.Application.ActivityLifecycleCallbacks public void onActivityPreCreated(Activity activity, Bundle bundle) { activity.registerActivityLifecycleCallbacks(new RlI(this) { // from class: o.LkC.5.2 final AnonymousClass5 this$1; { this.this$1 = this; } @Override // android.app.Application.ActivityLifecycleCallbacks public final void onActivityPostStarted(Activity activity2) { this.this$1.this$0.c(); } @Override // android.app.Application.ActivityLifecycleCallbacks public final void onActivityPostResumed(Activity activity2) { this.this$1.this$0.a(); } }); } @Override // o.RlI, android.app.Application.ActivityLifecycleCallbacks public void onActivityCreated(Activity activity, Bundle bundle) { if (Build.VERSION.SDK_INT < 29) { ReportFragment.zu_(activity).c = this.this$0.d; } } @Override // o.RlI, android.app.Application.ActivityLifecycleCallbacks public void onActivityPaused(Activity activity) { LkC lkC = this.this$0; int i = lkC.i - 1; lkC.i = i; if (i == 0) { lkC.c.postDelayed(lkC.e, 700L); } } @Override // o.RlI, android.app.Application.ActivityLifecycleCallbacks public void onActivityStopped(Activity activity) { r2.f--; this.this$0.b(); } } public static void d(Context context) { LkC lkC = g; lkC.c = new Handler(); LPk lPk = lkC.b; wdQ.HBt hBt = wdQ.HBt.ON_CREATE; lPk.d("handleLifecycleEvent"); lPk.d(hBt.a()); ((Application) context.getApplicationContext()).registerActivityLifecycleCallbacks(new AnonymousClass5(lkC)); } @Override // o.InterfaceC16541pFg public wdQ getLifecycle() { return this.b; } public static InterfaceC16541pFg d() { return g; } }