SessionInfo.smali
.class Lcom/facebook/appevents/internal/SessionInfo;
.super Ljava/lang/Object;
.source "SessionInfo.java"
# static fields
.field private static final INTERRUPTION_COUNT_KEY:Ljava/lang/String; = "com.facebook.appevents.SessionInfo.interruptionCount"
.field private static final LAST_SESSION_INFO_END_KEY:Ljava/lang/String; = "com.facebook.appevents.SessionInfo.sessionEndTime"
.field private static final LAST_SESSION_INFO_START_KEY:Ljava/lang/String; = "com.facebook.appevents.SessionInfo.sessionStartTime"
.field private static final SESSION_ID_KEY:Ljava/lang/String; = "com.facebook.appevents.SessionInfo.sessionId"
# instance fields
.field private diskRestoreTime:Ljava/lang/Long;
.field private interruptionCount:I
.field private sessionId:Ljava/util/UUID;
.field private sessionLastEventTime:Ljava/lang/Long;
.field private sessionStartTime:Ljava/lang/Long;
.field private sourceApplicationInfo:Lcom/facebook/appevents/internal/SourceApplicationInfo;
# direct methods
.method public constructor <init>(Ljava/lang/Long;Ljava/lang/Long;)V
.registers 4
.line 1
invoke-static {}, Ljava/util/UUID;->randomUUID()Ljava/util/UUID;
move-result-object v0
invoke-direct {p0, p1, p2, v0}, Lcom/facebook/appevents/internal/SessionInfo;-><init>(Ljava/lang/Long;Ljava/lang/Long;Ljava/util/UUID;)V
return-void
.end method
.method public constructor <init>(Ljava/lang/Long;Ljava/lang/Long;Ljava/util/UUID;)V
.registers 4
.line 2
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 3
iput-object p1, p0, Lcom/facebook/appevents/internal/SessionInfo;->sessionStartTime:Ljava/lang/Long;
.line 4
iput-object p2, p0, Lcom/facebook/appevents/internal/SessionInfo;->sessionLastEventTime:Ljava/lang/Long;
.line 5
iput-object p3, p0, Lcom/facebook/appevents/internal/SessionInfo;->sessionId:Ljava/util/UUID;
return-void
.end method
.method public static clearSavedSessionFromDisk()V
.registers 2
.line 1
invoke-static {}, Lcom/facebook/FacebookSdk;->getApplicationContext()Landroid/content/Context;
move-result-object v0
.line 2
invoke-static {v0}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;
move-result-object v0
.line 3
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
const-string v1, "com.facebook.appevents.SessionInfo.sessionStartTime"
.line 4
invoke-interface {v0, v1}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
const-string v1, "com.facebook.appevents.SessionInfo.sessionEndTime"
.line 5
invoke-interface {v0, v1}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
const-string v1, "com.facebook.appevents.SessionInfo.interruptionCount"
.line 6
invoke-interface {v0, v1}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
const-string v1, "com.facebook.appevents.SessionInfo.sessionId"
.line 7
invoke-interface {v0, v1}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
.line 8
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V
.line 9
invoke-static {}, Lcom/facebook/appevents/internal/SourceApplicationInfo;->clearSavedSourceApplicationInfoFromDisk()V
return-void
.end method
.method public static getStoredSessionInfo()Lcom/facebook/appevents/internal/SessionInfo;
.registers 10
.line 1
invoke-static {}, Lcom/facebook/FacebookSdk;->getApplicationContext()Landroid/content/Context;
move-result-object v0
.line 2
invoke-static {v0}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;
move-result-object v0
const-wide/16 v1, 0x0
const-string v3, "com.facebook.appevents.SessionInfo.sessionStartTime"
.line 3
invoke-interface {v0, v3, v1, v2}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J
move-result-wide v3
const-string v5, "com.facebook.appevents.SessionInfo.sessionEndTime"
.line 4
invoke-interface {v0, v5, v1, v2}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J
move-result-wide v5
const/4 v7, 0x0
const-string v8, "com.facebook.appevents.SessionInfo.sessionId"
.line 5
invoke-interface {v0, v8, v7}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object v8
cmp-long v9, v3, v1
if-eqz v9, :cond_55
cmp-long v9, v5, v1
if-eqz v9, :cond_55
if-nez v8, :cond_28
goto :goto_55
.line 6
:cond_28
new-instance v1, Lcom/facebook/appevents/internal/SessionInfo;
invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object v2
invoke-static {v5, v6}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object v3
invoke-direct {v1, v2, v3}, Lcom/facebook/appevents/internal/SessionInfo;-><init>(Ljava/lang/Long;Ljava/lang/Long;)V
const/4 v2, 0x0
const-string v3, "com.facebook.appevents.SessionInfo.interruptionCount"
.line 7
invoke-interface {v0, v3, v2}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I
move-result v0
iput v0, v1, Lcom/facebook/appevents/internal/SessionInfo;->interruptionCount:I
.line 8
invoke-static {}, Lcom/facebook/appevents/internal/SourceApplicationInfo;->getStoredSourceApplicatioInfo()Lcom/facebook/appevents/internal/SourceApplicationInfo;
move-result-object v0
iput-object v0, v1, Lcom/facebook/appevents/internal/SessionInfo;->sourceApplicationInfo:Lcom/facebook/appevents/internal/SourceApplicationInfo;
.line 9
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v2
invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object v0
iput-object v0, v1, Lcom/facebook/appevents/internal/SessionInfo;->diskRestoreTime:Ljava/lang/Long;
.line 10
invoke-static {v8}, Ljava/util/UUID;->fromString(Ljava/lang/String;)Ljava/util/UUID;
move-result-object v0
iput-object v0, v1, Lcom/facebook/appevents/internal/SessionInfo;->sessionId:Ljava/util/UUID;
return-object v1
:cond_55
:goto_55
return-object v7
.end method
# virtual methods
.method public getDiskRestoreTime()J
.registers 3
.line 1
iget-object v0, p0, Lcom/facebook/appevents/internal/SessionInfo;->diskRestoreTime:Ljava/lang/Long;
if-nez v0, :cond_7
const-wide/16 v0, 0x0
goto :goto_b
:cond_7
invoke-virtual {v0}, Ljava/lang/Long;->longValue()J
move-result-wide v0
:goto_b
return-wide v0
.end method
.method public getInterruptionCount()I
.registers 2
.line 1
iget v0, p0, Lcom/facebook/appevents/internal/SessionInfo;->interruptionCount:I
return v0
.end method
.method public getSessionId()Ljava/util/UUID;
.registers 2
.line 1
iget-object v0, p0, Lcom/facebook/appevents/internal/SessionInfo;->sessionId:Ljava/util/UUID;
return-object v0
.end method
.method public getSessionLastEventTime()Ljava/lang/Long;
.registers 2
.line 1
iget-object v0, p0, Lcom/facebook/appevents/internal/SessionInfo;->sessionLastEventTime:Ljava/lang/Long;
return-object v0
.end method
.method public getSessionLength()J
.registers 5
.line 1
iget-object v0, p0, Lcom/facebook/appevents/internal/SessionInfo;->sessionStartTime:Ljava/lang/Long;
if-eqz v0, :cond_15
iget-object v0, p0, Lcom/facebook/appevents/internal/SessionInfo;->sessionLastEventTime:Ljava/lang/Long;
if-nez v0, :cond_9
goto :goto_15
.line 2
:cond_9
invoke-virtual {v0}, Ljava/lang/Long;->longValue()J
move-result-wide v0
iget-object v2, p0, Lcom/facebook/appevents/internal/SessionInfo;->sessionStartTime:Ljava/lang/Long;
invoke-virtual {v2}, Ljava/lang/Long;->longValue()J
move-result-wide v2
sub-long/2addr v0, v2
return-wide v0
:cond_15
:goto_15
const-wide/16 v0, 0x0
return-wide v0
.end method
.method public getSessionStartTime()Ljava/lang/Long;
.registers 2
.line 1
iget-object v0, p0, Lcom/facebook/appevents/internal/SessionInfo;->sessionStartTime:Ljava/lang/Long;
return-object v0
.end method
.method public getSourceApplicationInfo()Lcom/facebook/appevents/internal/SourceApplicationInfo;
.registers 2
.line 1
iget-object v0, p0, Lcom/facebook/appevents/internal/SessionInfo;->sourceApplicationInfo:Lcom/facebook/appevents/internal/SourceApplicationInfo;
return-object v0
.end method
.method public incrementInterruptionCount()V
.registers 2
.line 1
iget v0, p0, Lcom/facebook/appevents/internal/SessionInfo;->interruptionCount:I
add-int/lit8 v0, v0, 0x1
iput v0, p0, Lcom/facebook/appevents/internal/SessionInfo;->interruptionCount:I
return-void
.end method
.method public setSessionLastEventTime(Ljava/lang/Long;)V
.registers 2
.line 1
iput-object p1, p0, Lcom/facebook/appevents/internal/SessionInfo;->sessionLastEventTime:Ljava/lang/Long;
return-void
.end method
.method public setSourceApplicationInfo(Lcom/facebook/appevents/internal/SourceApplicationInfo;)V
.registers 2
.line 1
iput-object p1, p0, Lcom/facebook/appevents/internal/SessionInfo;->sourceApplicationInfo:Lcom/facebook/appevents/internal/SourceApplicationInfo;
return-void
.end method
.method public writeSessionToDisk()V
.registers 5
.line 1
invoke-static {}, Lcom/facebook/FacebookSdk;->getApplicationContext()Landroid/content/Context;
move-result-object v0
.line 2
invoke-static {v0}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;
move-result-object v0
.line 3
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
.line 4
iget-object v1, p0, Lcom/facebook/appevents/internal/SessionInfo;->sessionStartTime:Ljava/lang/Long;
invoke-virtual {v1}, Ljava/lang/Long;->longValue()J
move-result-wide v1
const-string v3, "com.facebook.appevents.SessionInfo.sessionStartTime"
invoke-interface {v0, v3, v1, v2}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;
.line 5
iget-object v1, p0, Lcom/facebook/appevents/internal/SessionInfo;->sessionLastEventTime:Ljava/lang/Long;
invoke-virtual {v1}, Ljava/lang/Long;->longValue()J
move-result-wide v1
const-string v3, "com.facebook.appevents.SessionInfo.sessionEndTime"
invoke-interface {v0, v3, v1, v2}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;
.line 6
iget v1, p0, Lcom/facebook/appevents/internal/SessionInfo;->interruptionCount:I
const-string v2, "com.facebook.appevents.SessionInfo.interruptionCount"
invoke-interface {v0, v2, v1}, Landroid/content/SharedPreferences$Editor;->putInt(Ljava/lang/String;I)Landroid/content/SharedPreferences$Editor;
.line 7
iget-object v1, p0, Lcom/facebook/appevents/internal/SessionInfo;->sessionId:Ljava/util/UUID;
invoke-virtual {v1}, Ljava/util/UUID;->toString()Ljava/lang/String;
move-result-object v1
const-string v2, "com.facebook.appevents.SessionInfo.sessionId"
invoke-interface {v0, v2, v1}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
.line 8
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V
.line 9
iget-object v0, p0, Lcom/facebook/appevents/internal/SessionInfo;->sourceApplicationInfo:Lcom/facebook/appevents/internal/SourceApplicationInfo;
if-eqz v0, :cond_3e
.line 10
invoke-virtual {v0}, Lcom/facebook/appevents/internal/SourceApplicationInfo;->writeSourceApplicationInfoToDisk()V
:cond_3e
return-void
.end method