jimu-decompiled/sources/com/facebook/appevents/internal/SessionLogger.java
2025-05-13 19:24:51 +02:00

62 lines
2.6 KiB
Java

package com.facebook.appevents.internal;
import android.content.Context;
import android.os.Bundle;
import com.facebook.LoggingBehavior;
import com.facebook.appevents.AppEventsLogger;
import com.facebook.internal.Logger;
import java.util.Locale;
/* loaded from: classes.dex */
class SessionLogger {
private static final String a = "com.facebook.appevents.internal.SessionLogger";
private static final long[] b = {300000, 900000, 1800000, 3600000, 21600000, 43200000, 86400000, 172800000, 259200000, 604800000, 1209600000, 1814400000, 2419200000L, 5184000000L, 7776000000L, 10368000000L, 12960000000L, 15552000000L, 31536000000L};
public static void a(Context context, String str, SourceApplicationInfo sourceApplicationInfo, String str2) {
String sourceApplicationInfo2 = sourceApplicationInfo != null ? sourceApplicationInfo.toString() : "Unclassified";
Bundle bundle = new Bundle();
bundle.putString("fb_mobile_launch_source", sourceApplicationInfo2);
InternalAppEventsLogger internalAppEventsLogger = new InternalAppEventsLogger(str, str2, null);
internalAppEventsLogger.a("fb_mobile_activate_app", bundle);
if (AppEventsLogger.c() != AppEventsLogger.FlushBehavior.EXPLICIT_ONLY) {
internalAppEventsLogger.a();
}
}
public static void a(Context context, String str, SessionInfo sessionInfo, String str2) {
Long valueOf = Long.valueOf(sessionInfo.a() - sessionInfo.d().longValue());
if (valueOf.longValue() < 0) {
a();
valueOf = 0L;
}
Long valueOf2 = Long.valueOf(sessionInfo.e());
if (valueOf2.longValue() < 0) {
a();
valueOf2 = 0L;
}
Bundle bundle = new Bundle();
bundle.putInt("fb_mobile_app_interruptions", sessionInfo.b());
bundle.putString("fb_mobile_time_between_sessions", String.format(Locale.ROOT, "session_quanta_%d", Integer.valueOf(a(valueOf.longValue()))));
SourceApplicationInfo f = sessionInfo.f();
bundle.putString("fb_mobile_launch_source", f != null ? f.toString() : "Unclassified");
bundle.putLong("_logTime", sessionInfo.d().longValue() / 1000);
new InternalAppEventsLogger(str, str2, null).a("fb_mobile_deactivate_app", valueOf2.longValue() / 1000, bundle);
}
private static void a() {
Logger.a(LoggingBehavior.APP_EVENTS, a, "Clock skew detected");
}
private static int a(long j) {
int i = 0;
while (true) {
long[] jArr = b;
if (i >= jArr.length || jArr[i] >= j) {
break;
}
i++;
}
return i;
}
}