package com.facebook.appevents.internal;

import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.concurrent.TimeUnit;

class ActivityLifecycleTracker$5 implements Runnable {
    final /* synthetic */ String val$activityName;
    final /* synthetic */ long val$currentTime;

    ActivityLifecycleTracker$5(long j, String str) {
        this.val$currentTime = j;
        this.val$activityName = str;
    }

    public final void run() {
        long j = 0;
        AppMethodBeat.i(72144);
        if (ActivityLifecycleTracker.access$200() == null) {
            ActivityLifecycleTracker.access$202(new SessionInfo(Long.valueOf(this.val$currentTime), null));
        }
        ActivityLifecycleTracker.access$200().setSessionLastEventTime(Long.valueOf(this.val$currentTime));
        if (ActivityLifecycleTracker.access$500().get() <= 0) {
            1 1 = new 1(this);
            synchronized (ActivityLifecycleTracker.access$600()) {
                try {
                    ActivityLifecycleTracker.access$702(ActivityLifecycleTracker.access$800().schedule(1, (long) ActivityLifecycleTracker.access$400(), TimeUnit.SECONDS));
                } catch (Throwable th) {
                    while (true) {
                        AppMethodBeat.o(72144);
                    }
                }
            }
        }
        long access$900 = ActivityLifecycleTracker.access$900();
        if (access$900 > 0) {
            j = (this.val$currentTime - access$900) / 1000;
        }
        AutomaticAnalyticsLogger.logActivityTimeSpentEvent(this.val$activityName, j);
        ActivityLifecycleTracker.access$200().writeSessionToDisk();
        AppMethodBeat.o(72144);
    }
}
