110 lines
3.4 KiB
Java
110 lines
3.4 KiB
Java
package com.facebook.appevents.internal;
|
|
|
|
import android.content.SharedPreferences;
|
|
import android.preference.PreferenceManager;
|
|
import com.facebook.FacebookSdk;
|
|
import java.util.UUID;
|
|
|
|
/* loaded from: classes.dex */
|
|
class SessionInfo {
|
|
private Long a;
|
|
private Long b;
|
|
private int c;
|
|
private Long d;
|
|
private SourceApplicationInfo e;
|
|
private UUID f;
|
|
|
|
public SessionInfo(Long l, Long l2) {
|
|
this(l, l2, UUID.randomUUID());
|
|
}
|
|
|
|
public static void i() {
|
|
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.b()).edit();
|
|
edit.remove("com.facebook.appevents.SessionInfo.sessionStartTime");
|
|
edit.remove("com.facebook.appevents.SessionInfo.sessionEndTime");
|
|
edit.remove("com.facebook.appevents.SessionInfo.interruptionCount");
|
|
edit.remove("com.facebook.appevents.SessionInfo.sessionId");
|
|
edit.apply();
|
|
SourceApplicationInfo.b();
|
|
}
|
|
|
|
public static SessionInfo j() {
|
|
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.b());
|
|
long j = defaultSharedPreferences.getLong("com.facebook.appevents.SessionInfo.sessionStartTime", 0L);
|
|
long j2 = defaultSharedPreferences.getLong("com.facebook.appevents.SessionInfo.sessionEndTime", 0L);
|
|
String string = defaultSharedPreferences.getString("com.facebook.appevents.SessionInfo.sessionId", null);
|
|
if (j == 0 || j2 == 0 || string == null) {
|
|
return null;
|
|
}
|
|
SessionInfo sessionInfo = new SessionInfo(Long.valueOf(j), Long.valueOf(j2));
|
|
sessionInfo.c = defaultSharedPreferences.getInt("com.facebook.appevents.SessionInfo.interruptionCount", 0);
|
|
sessionInfo.e = SourceApplicationInfo.c();
|
|
sessionInfo.d = Long.valueOf(System.currentTimeMillis());
|
|
sessionInfo.f = UUID.fromString(string);
|
|
return sessionInfo;
|
|
}
|
|
|
|
public void a(Long l) {
|
|
this.b = l;
|
|
}
|
|
|
|
public int b() {
|
|
return this.c;
|
|
}
|
|
|
|
public UUID c() {
|
|
return this.f;
|
|
}
|
|
|
|
public Long d() {
|
|
return this.b;
|
|
}
|
|
|
|
public long e() {
|
|
Long l;
|
|
if (this.a == null || (l = this.b) == null) {
|
|
return 0L;
|
|
}
|
|
return l.longValue() - this.a.longValue();
|
|
}
|
|
|
|
public SourceApplicationInfo f() {
|
|
return this.e;
|
|
}
|
|
|
|
public void g() {
|
|
this.c++;
|
|
}
|
|
|
|
public void h() {
|
|
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.b()).edit();
|
|
edit.putLong("com.facebook.appevents.SessionInfo.sessionStartTime", this.a.longValue());
|
|
edit.putLong("com.facebook.appevents.SessionInfo.sessionEndTime", this.b.longValue());
|
|
edit.putInt("com.facebook.appevents.SessionInfo.interruptionCount", this.c);
|
|
edit.putString("com.facebook.appevents.SessionInfo.sessionId", this.f.toString());
|
|
edit.apply();
|
|
SourceApplicationInfo sourceApplicationInfo = this.e;
|
|
if (sourceApplicationInfo != null) {
|
|
sourceApplicationInfo.a();
|
|
}
|
|
}
|
|
|
|
public SessionInfo(Long l, Long l2, UUID uuid) {
|
|
this.a = l;
|
|
this.b = l2;
|
|
this.f = uuid;
|
|
}
|
|
|
|
public long a() {
|
|
Long l = this.d;
|
|
if (l == null) {
|
|
return 0L;
|
|
}
|
|
return l.longValue();
|
|
}
|
|
|
|
public void a(SourceApplicationInfo sourceApplicationInfo) {
|
|
this.e = sourceApplicationInfo;
|
|
}
|
|
}
|