package com.bytedance.bdlocation.utils;

import X.0CB;
import X.0CH;
import X.1hT;
import X.C1055Rbv;
import X.SE9;
import X.SEJ;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public final class ActivityLifecycleUtils implements 1hT {
    public static List<C1055Rbv> LIZ = new ArrayList();

    public ActivityLifecycleUtils() {
    }

    static {
        Covode.recordClassIndex(24358);
    }

    public /* synthetic */ ActivityLifecycleUtils(byte b) {
        this();
    }

    public static void LIZ(C1055Rbv rbv) {
        MethodCollector.i(6597);
        synchronized (ActivityLifecycleUtils.class) {
            try {
                LIZ.add(rbv);
            } finally {
                MethodCollector.o(6597);
            }
        }
    }

    public static void LIZ(boolean z) {
        MethodCollector.i(6600);
        synchronized (ActivityLifecycleUtils.class) {
            try {
                if (!SEJ.LIZ((Collection) LIZ)) {
                    for (C1055Rbv LIZ2 : LIZ) {
                        LIZ2.LIZ(z);
                    }
                }
            } finally {
                MethodCollector.o(6600);
            }
        }
    }

    public final void onStateChanged(0CH r3, 0CB r4) {
        SE9.LIZLLL("onStateChanged", "onStateChanged: event =".concat(String.valueOf(r4)));
        if (r4 == 0CB.ON_START) {
            SE9.LIZ("LifecycleObserver onAppForeground");
            LIZ(false);
        } else if (r4 == 0CB.ON_STOP) {
            SE9.LIZ("LifecycleObserver onAppBackground");
            LIZ(true);
        }
    }
}
