package com.bytedance.helios.sdk;

import X.0CB;
import X.0CH;
import X.0CN;
import X.6Is;
import X.9bR;
import X.C0946RaA;
import X.C0979Rah;
import X.Jzf;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;

public class LifecycleMonitor$2 implements 6Is {
    public final /* synthetic */ C0946RaA LIZ;

    static {
        Covode.recordClassIndex(27437);
    }

    public void onStateChanged(0CH r2, 0CB r3) {
        if (r3 == 0CB.ON_START) {
            onStarted();
        } else if (r3 == 0CB.ON_STOP) {
            onStopped();
        }
    }

    @0CN(LIZ = 0CB.ON_START)
    public void onStarted() {
        MethodCollector.i(10999);
        Jzf.LIZIZ().removeCallbacks(this.LIZ.LJIIIZ);
        this.LIZ.LJ.set(true);
        this.LIZ.LJIIIIZZ.set(false);
        this.LIZ.LJIIJ = null;
        9bR.LIZ("Helios-Log-Page-State", "EnterForeground");
        synchronized (this.LIZ.LIZLLL) {
            try {
                C0979Rah.LIZ("onAppForeground", (Object) null);
            } finally {
                MethodCollector.o(10999);
            }
        }
    }

    @0CN(LIZ = 0CB.ON_STOP)
    public void onStopped() {
        MethodCollector.i(11252);
        this.LIZ.LJ.set(false);
        Jzf.LIZIZ().postDelayed(this.LIZ.LJIIIZ, HeliosEnvImpl.INSTANCE.getBackgroundFreezeDuration());
        this.LIZ.LJIIJ = Long.valueOf(System.currentTimeMillis());
        9bR.LIZ("Helios-Log-Page-State", "EnterBackground");
        C0946RaA raA = this.LIZ;
        raA.LJI = raA.LJFF;
        C0946RaA raA2 = this.LIZ;
        raA2.LJIIJJI = raA2.LJII;
        this.LIZ.LJFF = "null";
        this.LIZ.LJII = 0;
        synchronized (this.LIZ.LIZLLL) {
            try {
                C0979Rah.LIZ("onAppBackground", (Object) null);
            } finally {
                MethodCollector.o(11252);
            }
        }
    }

    public LifecycleMonitor$2(C0946RaA raA) {
        this.LIZ = raA;
    }
}
