.class public Lg3/e;
.super Ljava/lang/Object;
.source ""


# static fields
.field public static final synthetic I:I


# instance fields
.field public A:Z

.field public B:Z

.field public C:Z

.field public D:Ljava/util/concurrent/atomic/AtomicBoolean;

.field public E:Ljava/util/concurrent/atomic/AtomicBoolean;

.field public F:Ljava/lang/String;

.field public G:Lg3/u;

.field public H:Lg3/u;

.field public a:Landroid/content/Context;

.field public b:Lv9/a0;

.field public c:Lg3/n;

.field public d:Ljava/lang/String;

.field public e:Ljava/lang/String;

.field public f:Ljava/lang/String;

.field public g:Ljava/lang/String;

.field public h:Z

.field public i:Z

.field public j:Lg3/s;

.field public k:Ljava/lang/String;

.field public l:J

.field public m:J

.field public n:J

.field public o:J

.field public p:J

.field public q:J

.field public r:Lg3/p;

.field public s:I

.field public t:I

.field public u:I

.field public v:J

.field public w:J

.field public x:J

.field public y:Z

.field public z:I


# direct methods
.method public constructor <init>()V
    .registers 2

    const/4 v0, 0x0

    invoke-direct {p0, v0}, Lg3/e;-><init>(Ljava/lang/String;)V

    return-void
.end method

.method public constructor <init>(Ljava/lang/String;)V
    .registers 7

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    iput-boolean v0, p0, Lg3/e;->h:Z

    iput-boolean v0, p0, Lg3/e;->i:Z

    new-instance v1, Lg3/s;

    invoke-direct {v1}, Lg3/s;-><init>()V

    iput-object v1, p0, Lg3/e;->j:Lg3/s;

    const-wide/16 v1, -0x1

    iput-wide v1, p0, Lg3/e;->l:J

    const-wide/16 v3, 0x0

    iput-wide v3, p0, Lg3/e;->m:J

    iput-wide v1, p0, Lg3/e;->n:J

    iput-wide v1, p0, Lg3/e;->o:J

    iput-wide v1, p0, Lg3/e;->p:J

    iput-wide v1, p0, Lg3/e;->q:J

    const/16 v1, 0x1e

    iput v1, p0, Lg3/e;->s:I

    const/16 v1, 0x32

    iput v1, p0, Lg3/e;->t:I

    const/16 v2, 0x3e8

    iput v2, p0, Lg3/e;->u:I

    const-wide/16 v2, 0x7530

    iput-wide v2, p0, Lg3/e;->v:J

    const-wide/32 v2, 0x493e0

    iput-wide v2, p0, Lg3/e;->w:J

    const-wide/32 v2, 0x1b7740

    iput-wide v2, p0, Lg3/e;->x:J

    iput-boolean v0, p0, Lg3/e;->y:Z

    iput v1, p0, Lg3/e;->z:I

    iput-boolean v0, p0, Lg3/e;->A:Z

    iput-boolean v0, p0, Lg3/e;->B:Z

    const/4 v1, 0x1

    iput-boolean v1, p0, Lg3/e;->C:Z

    new-instance v1, Ljava/util/concurrent/atomic/AtomicBoolean;

    invoke-direct {v1, v0}, Ljava/util/concurrent/atomic/AtomicBoolean;-><init>(Z)V

    iput-object v1, p0, Lg3/e;->D:Ljava/util/concurrent/atomic/AtomicBoolean;

    new-instance v1, Ljava/util/concurrent/atomic/AtomicBoolean;

    invoke-direct {v1, v0}, Ljava/util/concurrent/atomic/AtomicBoolean;-><init>(Z)V

    iput-object v1, p0, Lg3/e;->E:Ljava/util/concurrent/atomic/AtomicBoolean;

    const-string v0, "https://api.amplitude.com/"

    iput-object v0, p0, Lg3/e;->F:Ljava/lang/String;

    new-instance v0, Lg3/u;

    const-string v1, "logThread"

    invoke-direct {v0, v1}, Lg3/u;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lg3/e;->G:Lg3/u;

    new-instance v0, Lg3/u;

    const-string v1, "httpThread"

    invoke-direct {v0, v1}, Lg3/u;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lg3/e;->H:Lg3/u;

    invoke-static {p1}, Lg3/t;->d(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    iput-object p1, p0, Lg3/e;->e:Ljava/lang/String;

    iget-object p1, p0, Lg3/e;->G:Lg3/u;

    invoke-virtual {p1}, Landroid/os/HandlerThread;->start()V

    iget-object p1, p0, Lg3/e;->H:Lg3/u;

    invoke-virtual {p1}, Landroid/os/HandlerThread;->start()V

    return-void
.end method

.method public static a(Lg3/e;)Ljava/lang/String;
    .registers 6

    invoke-static {p0}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    .line 1
    new-instance v0, Ljava/util/HashSet;

    invoke-direct {v0}, Ljava/util/HashSet;-><init>()V

    const-string v1, ""

    invoke-virtual {v0, v1}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z

    const-string v1, "9774d56d682e549c"

    invoke-virtual {v0, v1}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z

    const-string v1, "unknown"

    invoke-virtual {v0, v1}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z

    const-string v1, "000000000000000"

    invoke-virtual {v0, v1}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z

    const-string v1, "Android"

    invoke-virtual {v0, v1}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z

    const-string v1, "DEFACE"

    invoke-virtual {v0, v1}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z

    const-string v1, "00000000-0000-0000-0000-000000000000"

    invoke-virtual {v0, v1}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z

    .line 2
    iget-object v1, p0, Lg3/e;->c:Lg3/n;

    const-string v2, "device_id"

    invoke-virtual {v1, v2}, Lg3/n;->T(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    iget-object v3, p0, Lg3/e;->a:Landroid/content/Context;

    iget-object v4, p0, Lg3/e;->e:Ljava/lang/String;

    .line 3
    invoke-static {v3, v4}, Lg3/t;->b(Landroid/content/Context;Ljava/lang/String;)Landroid/content/SharedPreferences;

    move-result-object v3

    const/4 v4, 0x0

    invoke-interface {v3, v2, v4}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    .line 4
    invoke-static {v1}, Lg3/t;->c(Ljava/lang/String;)Z

    move-result v3

    if-nez v3, :cond_56

    invoke-virtual {v0, v1}, Ljava/util/HashSet;->contains(Ljava/lang/Object;)Z

    move-result v3

    if-nez v3, :cond_56

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_81

    :goto_52
    invoke-virtual {p0, v1}, Lg3/e;->m(Ljava/lang/String;)V

    goto :goto_81

    :cond_56
    invoke-static {v2}, Lg3/t;->c(Ljava/lang/String;)Z

    move-result v1

    if-nez v1, :cond_67

    invoke-virtual {v0, v2}, Ljava/util/HashSet;->contains(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_67

    invoke-virtual {p0, v2}, Lg3/e;->m(Ljava/lang/String;)V

    move-object v1, v2

    goto :goto_81

    :cond_67
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    .line 5
    invoke-static {}, Ljava/util/UUID;->randomUUID()Ljava/util/UUID;

    move-result-object v1

    invoke-virtual {v1}, Ljava/util/UUID;->toString()Ljava/lang/String;

    move-result-object v1

    .line 6
    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v1, "R"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    goto :goto_52

    :cond_81
    :goto_81
    return-object v1
.end method

.method public static b(Lg3/e;Ljava/lang/String;J)J
    .registers 4

    .line 1
    iget-object p0, p0, Lg3/e;->c:Lg3/n;

    invoke-virtual {p0, p1}, Lg3/n;->K(Ljava/lang/String;)Ljava/lang/Long;

    move-result-object p0

    if-nez p0, :cond_9

    goto :goto_d

    :cond_9
    invoke-virtual {p0}, Ljava/lang/Long;->longValue()J

    move-result-wide p2

    :goto_d
    return-wide p2
.end method

.method public static i(Landroid/content/SharedPreferences;Ljava/lang/String;JLg3/n;Ljava/lang/String;)V
    .registers 7

    invoke-virtual {p4, p5}, Lg3/n;->K(Ljava/lang/String;)Ljava/lang/Long;

    move-result-object v0

    if-eqz v0, :cond_7

    return-void

    :cond_7
    invoke-interface {p0, p1, p2, p3}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J

    move-result-wide p2

    invoke-static {p2, p3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object p2

    invoke-virtual {p4, p5, p2}, Lg3/n;->a0(Ljava/lang/String;Ljava/lang/Long;)J

    invoke-interface {p0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object p0

    invoke-interface {p0, p1}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    move-result-object p0

    invoke-interface {p0}, Landroid/content/SharedPreferences$Editor;->apply()V

    return-void
.end method

.method public static j(Landroid/content/SharedPreferences;Ljava/lang/String;Ljava/lang/String;Lg3/n;Ljava/lang/String;)V
    .registers 6

    invoke-virtual {p3, p4}, Lg3/n;->T(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p2

    invoke-static {p2}, Lg3/t;->c(Ljava/lang/String;)Z

    move-result p2

    if-nez p2, :cond_b

    return-void

    :cond_b
    const/4 p2, 0x0

    invoke-interface {p0, p1, p2}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object p2

    invoke-static {p2}, Lg3/t;->c(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_24

    invoke-virtual {p3, p4, p2}, Lg3/n;->b0(Ljava/lang/String;Ljava/lang/String;)J

    invoke-interface {p0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object p0

    invoke-interface {p0, p1}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    move-result-object p0

    invoke-interface {p0}, Landroid/content/SharedPreferences$Editor;->apply()V

    :cond_24
    return-void
.end method

.method public static q(Ljava/lang/String;)Ljava/lang/String;
    .registers 3

    invoke-virtual {p0}, Ljava/lang/String;->length()I

    move-result v0

    const/16 v1, 0x400

    if-gt v0, v1, :cond_9

    goto :goto_e

    :cond_9
    const/4 v0, 0x0

    invoke-virtual {p0, v0, v1}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object p0

    :goto_e
    return-object p0
.end method

.method public static v(Landroid/content/Context;)Z
    .registers 14

    const-string v0, ".optOut"

    const-string v1, ".userId"

    const-string v2, ".deviceId"

    const-string v3, ".previousSessionId"

    const-string v4, "."

    const-string v5, "com.amplitude.api.AmplitudeClient"

    const-string v6, "com.amplitude.api"

    const/4 v7, 0x0

    .line 1
    :try_start_f
    const-class v8, Ly2/f;

    invoke-virtual {v8}, Ljava/lang/Class;->getPackage()Ljava/lang/Package;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/Package;->getName()Ljava/lang/String;

    move-result-object v8
    :try_end_19
    .catch Ljava/lang/Exception; {:try_start_f .. :try_end_19} :catch_1a

    goto :goto_1b

    :catch_1a
    move-object v8, v6

    :goto_1b
    :try_start_1b
    invoke-virtual {v6, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v9

    if-eqz v9, :cond_23

    goto/16 :goto_159

    :cond_23
    new-instance v9, Ljava/lang/StringBuilder;

    invoke-direct {v9}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v9, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v9, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v10

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {p0, v9, v7}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v10

    invoke-interface {v10}, Landroid/content/SharedPreferences;->getAll()Ljava/util/Map;

    move-result-object v11

    invoke-interface {v11}, Ljava/util/Map;->size()I

    move-result v11

    if-nez v11, :cond_49

    goto/16 :goto_159

    :cond_49
    new-instance v11, Ljava/lang/StringBuilder;

    invoke-direct {v11}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v11, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v11, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v11, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {p0, v4, v7}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object p0

    invoke-interface {p0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object p0

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v6, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v6, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-interface {v10, v6}, Landroid/content/SharedPreferences;->contains(Ljava/lang/String;)Z

    move-result v6

    if-eqz v6, :cond_96

    const-string v6, "com.amplitude.api.previousSessionId"

    new-instance v11, Ljava/lang/StringBuilder;

    invoke-direct {v11}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v11, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v11, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    const-wide/16 v11, -0x1

    invoke-interface {v10, v3, v11, v12}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J

    move-result-wide v11

    invoke-interface {p0, v6, v11, v12}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;

    :cond_96
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v3, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-interface {v10, v3}, Landroid/content/SharedPreferences;->contains(Ljava/lang/String;)Z

    move-result v3

    const/4 v6, 0x0

    if-eqz v3, :cond_c4

    const-string v3, "com.amplitude.api.deviceId"

    new-instance v11, Ljava/lang/StringBuilder;

    invoke-direct {v11}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v11, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v11, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-interface {v10, v2, v6}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-interface {p0, v3, v2}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    :cond_c4
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v2, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-interface {v10, v2}, Landroid/content/SharedPreferences;->contains(Ljava/lang/String;)Z

    move-result v2

    if-eqz v2, :cond_f1

    const-string v2, "com.amplitude.api.userId"

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v3, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-interface {v10, v1, v6}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-interface {p0, v2, v1}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    :cond_f1
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v1, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-interface {v10, v1}, Landroid/content/SharedPreferences;->contains(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_11e

    const-string v1, "com.amplitude.api.optOut"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v2, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-interface {v10, v0, v7}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result v0

    invoke-interface {p0, v1, v0}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;

    :cond_11e
    invoke-interface {p0}, Landroid/content/SharedPreferences$Editor;->apply()V

    invoke-interface {v10}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object p0

    invoke-interface {p0}, Landroid/content/SharedPreferences$Editor;->clear()Landroid/content/SharedPreferences$Editor;

    move-result-object p0

    invoke-interface {p0}, Landroid/content/SharedPreferences$Editor;->apply()V

    new-instance p0, Ljava/lang/StringBuilder;

    invoke-direct {p0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v0, "Upgraded shared preferences from "

    invoke-virtual {p0, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p0, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v0, " to "

    invoke-virtual {p0, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p0, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p0

    .line 2
    invoke-static {v5, p0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_148
    .catch Ljava/lang/Exception; {:try_start_1b .. :try_end_148} :catch_14a

    const/4 v7, 0x1

    goto :goto_159

    :catch_14a
    move-exception p0

    const-string v0, "Error upgrading shared preferences"

    .line 3
    invoke-static {v5, v0, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    .line 4
    invoke-static {}, Lg3/q;->a()Lg3/q;

    move-result-object v0

    const-string v1, "Failed to upgrade shared prefs"

    invoke-virtual {v0, v1, p0}, Lg3/q;->b(Ljava/lang/String;Ljava/lang/Throwable;)Lg3/q;

    :goto_159
    return v7
.end method

.method public static w(Landroid/content/Context;)Z
    .registers 14

    const/4 v0, 0x0

    .line 1
    invoke-static {p0, v0}, Lg3/n;->o(Landroid/content/Context;Ljava/lang/String;)Lg3/n;

    move-result-object v7

    const-string v1, "device_id"

    .line 2
    invoke-virtual {v7, v1}, Lg3/n;->T(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    const-string v3, "previous_session_id"

    invoke-virtual {v7, v3}, Lg3/n;->K(Ljava/lang/String;)Ljava/lang/Long;

    move-result-object v3

    const-string v4, "last_event_time"

    invoke-virtual {v7, v4}, Lg3/n;->K(Ljava/lang/String;)Ljava/lang/Long;

    move-result-object v4

    invoke-static {v2}, Lg3/t;->c(Ljava/lang/String;)Z

    move-result v2

    if-nez v2, :cond_23

    if-eqz v3, :cond_23

    if-eqz v4, :cond_23

    goto/16 :goto_93

    :cond_23
    const-string v2, "com.amplitude.api"

    const-string v3, "."

    invoke-static {v2, v3}, Le/k;->a(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    const/4 v8, 0x0

    invoke-virtual {p0, v2, v8}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object p0

    const-string v2, "com.amplitude.api.deviceId"

    invoke-static {p0, v2, v0, v7, v1}, Lg3/e;->j(Landroid/content/SharedPreferences;Ljava/lang/String;Ljava/lang/String;Lg3/n;Ljava/lang/String;)V

    const-wide/16 v9, -0x1

    const-wide/16 v11, -0x1

    const-string v2, "com.amplitude.api.lastEventTime"

    const-string v6, "last_event_time"

    move-object v1, p0

    move-wide v3, v11

    move-object v5, v7

    invoke-static/range {v1 .. v6}, Lg3/e;->i(Landroid/content/SharedPreferences;Ljava/lang/String;JLg3/n;Ljava/lang/String;)V

    const-string v2, "com.amplitude.api.lastEventId"

    const-string v6, "last_event_id"

    invoke-static/range {v1 .. v6}, Lg3/e;->i(Landroid/content/SharedPreferences;Ljava/lang/String;JLg3/n;Ljava/lang/String;)V

    const-string v2, "com.amplitude.api.lastIdentifyId"

    const-string v6, "last_identify_id"

    invoke-static/range {v1 .. v6}, Lg3/e;->i(Landroid/content/SharedPreferences;Ljava/lang/String;JLg3/n;Ljava/lang/String;)V

    const-string v2, "com.amplitude.api.previousSessionId"

    const-string v6, "previous_session_id"

    move-wide v3, v9

    invoke-static/range {v1 .. v6}, Lg3/e;->i(Landroid/content/SharedPreferences;Ljava/lang/String;JLg3/n;Ljava/lang/String;)V

    const-string v1, "com.amplitude.api.userId"

    const-string v2, "user_id"

    invoke-static {p0, v1, v0, v7, v2}, Lg3/e;->j(Landroid/content/SharedPreferences;Ljava/lang/String;Ljava/lang/String;Lg3/n;Ljava/lang/String;)V

    const-string v0, "com.amplitude.api.optOut"

    const-string v1, "opt_out"

    .line 3
    invoke-virtual {v7, v1}, Lg3/n;->K(Ljava/lang/String;)Ljava/lang/Long;

    move-result-object v2

    if-eqz v2, :cond_76

    goto :goto_93

    :cond_76
    invoke-interface {p0, v0, v8}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result v2

    if-eqz v2, :cond_7f

    const-wide/16 v2, 0x1

    goto :goto_81

    :cond_7f
    const-wide/16 v2, 0x0

    :goto_81
    invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v2

    invoke-virtual {v7, v1, v2}, Lg3/n;->a0(Ljava/lang/String;Ljava/lang/Long;)J

    invoke-interface {p0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object p0

    invoke-interface {p0, v0}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    move-result-object p0

    invoke-interface {p0}, Landroid/content/SharedPreferences$Editor;->apply()V

    :goto_93
    const/4 p0, 0x1

    return p0
.end method


# virtual methods
.method public declared-synchronized c(Ljava/lang/String;)Z
    .registers 6

    monitor-enter p0

    :try_start_1
    iget-object v0, p0, Lg3/e;->a:Landroid/content/Context;

    const/4 v1, 0x0

    if-nez v0, :cond_1e

    const-string v0, "com.amplitude.api.AmplitudeClient"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "context cannot be null, set context with initialize() before calling "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    .line 1
    invoke-static {v0, p1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_1c
    .catchall {:try_start_1 .. :try_end_1c} :catchall_41

    .line 2
    monitor-exit p0

    return v1

    :cond_1e
    :try_start_1e
    iget-object v0, p0, Lg3/e;->d:Ljava/lang/String;

    invoke-static {v0}, Lg3/t;->c(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_3e

    const-string v0, "com.amplitude.api.AmplitudeClient"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "apiKey cannot be null or empty, set apiKey with initialize() before calling "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    .line 3
    invoke-static {v0, p1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_3c
    .catchall {:try_start_1e .. :try_end_3c} :catchall_41

    .line 4
    monitor-exit p0

    return v1

    :cond_3e
    const/4 p1, 0x1

    monitor-exit p0

    return p1

    :catchall_41
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public final d()Z
    .registers 5

    iget-wide v0, p0, Lg3/e;->l:J

    const-wide/16 v2, 0x0

    cmp-long v0, v0, v2

    if-ltz v0, :cond_a

    const/4 v0, 0x1

    goto :goto_b

    :cond_a
    const/4 v0, 0x0

    :goto_b
    return v0
.end method

.method public final e(J)Z
    .registers 7

    iget-boolean v0, p0, Lg3/e;->A:Z

    if-eqz v0, :cond_7

    iget-wide v0, p0, Lg3/e;->w:J

    goto :goto_9

    :cond_7
    iget-wide v0, p0, Lg3/e;->x:J

    :goto_9
    iget-wide v2, p0, Lg3/e;->p:J

    sub-long/2addr p1, v2

    cmp-long p1, p1, v0

    if-gez p1, :cond_12

    const/4 p1, 0x1

    goto :goto_13

    :cond_12
    const/4 p1, 0x0

    :goto_13
    return p1
.end method

.method public f(Ljava/lang/String;Lorg/json/JSONObject;Lorg/json/JSONObject;Lorg/json/JSONObject;Lorg/json/JSONObject;Lorg/json/JSONObject;JZ)J
    .registers 31

    move-object/from16 v1, p0

    move-object/from16 v2, p1

    move-object/from16 v0, p2

    move-object/from16 v3, p4

    move-object/from16 v4, p5

    move-object/from16 v5, p6

    move-wide/from16 v6, p7

    const-string v8, "platform"

    const-string v9, "language"

    const-string v10, "country"

    const-string v11, "carrier"

    const-string v12, "device_model"

    const-string v13, "device_manufacturer"

    const-string v14, "device_brand"

    const-string v15, "os_version"

    const-string v5, "os_name"

    const-string v4, "version_name"

    const-string v3, "sequence_number"

    iget-boolean v0, v1, Lg3/e;->i:Z

    const-wide/16 v16, -0x1

    if-eqz v0, :cond_2b

    return-wide v16

    :cond_2b
    if-nez p9, :cond_38

    iget-boolean v0, v1, Lg3/e;->B:Z

    if-nez v0, :cond_35

    invoke-virtual {v1, v6, v7}, Lg3/e;->p(J)Z

    goto :goto_38

    :cond_35
    invoke-virtual {v1, v6, v7}, Lg3/e;->k(J)V

    :cond_38
    :goto_38
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    move-object/from16 v18, v8

    :try_start_3f
    const-string v8, "event_type"

    if-nez v2, :cond_47

    .line 1
    sget-object v19, Lorg/json/JSONObject;->NULL:Ljava/lang/Object;
    :try_end_45
    .catch Lorg/json/JSONException; {:try_start_3f .. :try_end_45} :catch_285

    move-object/from16 v2, v19

    .line 2
    :cond_47
    :try_start_47
    invoke-virtual {v0, v8, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v2, "timestamp"

    invoke-virtual {v0, v2, v6, v7}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    const-string v2, "user_id"

    iget-object v6, v1, Lg3/e;->f:Ljava/lang/String;

    if-nez v6, :cond_57

    .line 3
    sget-object v6, Lorg/json/JSONObject;->NULL:Ljava/lang/Object;

    .line 4
    :cond_57
    invoke-virtual {v0, v2, v6}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v2, "device_id"

    iget-object v6, v1, Lg3/e;->g:Ljava/lang/String;

    if-nez v6, :cond_62

    .line 5
    sget-object v6, Lorg/json/JSONObject;->NULL:Ljava/lang/Object;

    .line 6
    :cond_62
    invoke-virtual {v0, v2, v6}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v2, "session_id"

    if-eqz p9, :cond_6c

    move-wide/from16 v6, v16

    goto :goto_6e

    :cond_6c
    iget-wide v6, v1, Lg3/e;->l:J

    :goto_6e
    invoke-virtual {v0, v2, v6, v7}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    const-string v2, "uuid"

    invoke-static {}, Ljava/util/UUID;->randomUUID()Ljava/util/UUID;

    move-result-object v6

    invoke-virtual {v6}, Ljava/util/UUID;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v0, v2, v6}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 7
    iget-wide v6, v1, Lg3/e;->m:J

    const-wide/16 v19, 0x1

    add-long v6, v6, v19

    iput-wide v6, v1, Lg3/e;->m:J

    iget-object v2, v1, Lg3/e;->c:Lg3/n;

    invoke-static {v6, v7}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v6

    invoke-virtual {v2, v3, v6}, Lg3/n;->a0(Ljava/lang/String;Ljava/lang/Long;)J

    iget-wide v6, v1, Lg3/e;->m:J

    .line 8
    invoke-virtual {v0, v3, v6, v7}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    iget-object v2, v1, Lg3/e;->j:Lg3/s;

    .line 9
    iget-object v2, v2, Lg3/s;->a:Ljava/util/Set;

    invoke-interface {v2, v4}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v2

    const/4 v3, 0x1

    xor-int/2addr v2, v3

    if-eqz v2, :cond_af

    .line 10
    iget-object v2, v1, Lg3/e;->r:Lg3/p;

    .line 11
    invoke-virtual {v2}, Lg3/p;->b()Lg3/p$b;

    move-result-object v2

    .line 12
    iget-object v2, v2, Lg3/p$b;->c:Ljava/lang/String;

    if-nez v2, :cond_ac

    .line 13
    sget-object v2, Lorg/json/JSONObject;->NULL:Ljava/lang/Object;

    .line 14
    :cond_ac
    invoke-virtual {v0, v4, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_af
    iget-object v2, v1, Lg3/e;->j:Lg3/s;

    .line 15
    iget-object v2, v2, Lg3/s;->a:Ljava/util/Set;

    invoke-interface {v2, v5}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v2

    const/4 v3, 0x1

    xor-int/2addr v2, v3

    if-eqz v2, :cond_ca

    .line 16
    iget-object v2, v1, Lg3/e;->r:Lg3/p;

    .line 17
    invoke-virtual {v2}, Lg3/p;->b()Lg3/p$b;

    move-result-object v2

    .line 18
    iget-object v2, v2, Lg3/p$b;->d:Ljava/lang/String;

    if-nez v2, :cond_c7

    .line 19
    sget-object v2, Lorg/json/JSONObject;->NULL:Ljava/lang/Object;

    .line 20
    :cond_c7
    invoke-virtual {v0, v5, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_ca
    iget-object v2, v1, Lg3/e;->j:Lg3/s;

    .line 21
    iget-object v2, v2, Lg3/s;->a:Ljava/util/Set;

    invoke-interface {v2, v15}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v2

    const/4 v3, 0x1

    xor-int/2addr v2, v3

    if-eqz v2, :cond_e5

    .line 22
    iget-object v2, v1, Lg3/e;->r:Lg3/p;

    .line 23
    invoke-virtual {v2}, Lg3/p;->b()Lg3/p$b;

    move-result-object v2

    .line 24
    iget-object v2, v2, Lg3/p$b;->e:Ljava/lang/String;

    if-nez v2, :cond_e2

    .line 25
    sget-object v2, Lorg/json/JSONObject;->NULL:Ljava/lang/Object;

    .line 26
    :cond_e2
    invoke-virtual {v0, v15, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_e5
    iget-object v2, v1, Lg3/e;->j:Lg3/s;

    .line 27
    iget-object v2, v2, Lg3/s;->a:Ljava/util/Set;

    invoke-interface {v2, v14}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v2

    const/4 v3, 0x1

    xor-int/2addr v2, v3

    if-eqz v2, :cond_100

    .line 28
    iget-object v2, v1, Lg3/e;->r:Lg3/p;

    .line 29
    invoke-virtual {v2}, Lg3/p;->b()Lg3/p$b;

    move-result-object v2

    .line 30
    iget-object v2, v2, Lg3/p$b;->f:Ljava/lang/String;

    if-nez v2, :cond_fd

    .line 31
    sget-object v2, Lorg/json/JSONObject;->NULL:Ljava/lang/Object;

    .line 32
    :cond_fd
    invoke-virtual {v0, v14, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_100
    iget-object v2, v1, Lg3/e;->j:Lg3/s;

    .line 33
    iget-object v2, v2, Lg3/s;->a:Ljava/util/Set;

    invoke-interface {v2, v13}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v2

    const/4 v3, 0x1

    xor-int/2addr v2, v3

    if-eqz v2, :cond_11b

    .line 34
    iget-object v2, v1, Lg3/e;->r:Lg3/p;

    .line 35
    invoke-virtual {v2}, Lg3/p;->b()Lg3/p$b;

    move-result-object v2

    .line 36
    iget-object v2, v2, Lg3/p$b;->g:Ljava/lang/String;

    if-nez v2, :cond_118

    .line 37
    sget-object v2, Lorg/json/JSONObject;->NULL:Ljava/lang/Object;

    .line 38
    :cond_118
    invoke-virtual {v0, v13, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_11b
    iget-object v2, v1, Lg3/e;->j:Lg3/s;

    .line 39
    iget-object v2, v2, Lg3/s;->a:Ljava/util/Set;

    invoke-interface {v2, v12}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v2

    const/4 v3, 0x1

    xor-int/2addr v2, v3

    if-eqz v2, :cond_136

    .line 40
    iget-object v2, v1, Lg3/e;->r:Lg3/p;

    .line 41
    invoke-virtual {v2}, Lg3/p;->b()Lg3/p$b;

    move-result-object v2

    .line 42
    iget-object v2, v2, Lg3/p$b;->h:Ljava/lang/String;

    if-nez v2, :cond_133

    .line 43
    sget-object v2, Lorg/json/JSONObject;->NULL:Ljava/lang/Object;

    .line 44
    :cond_133
    invoke-virtual {v0, v12, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_136
    iget-object v2, v1, Lg3/e;->j:Lg3/s;

    .line 45
    iget-object v2, v2, Lg3/s;->a:Ljava/util/Set;

    invoke-interface {v2, v11}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v2

    const/4 v3, 0x1

    xor-int/2addr v2, v3

    if-eqz v2, :cond_151

    .line 46
    iget-object v2, v1, Lg3/e;->r:Lg3/p;

    .line 47
    invoke-virtual {v2}, Lg3/p;->b()Lg3/p$b;

    move-result-object v2

    .line 48
    iget-object v2, v2, Lg3/p$b;->i:Ljava/lang/String;

    if-nez v2, :cond_14e

    .line 49
    sget-object v2, Lorg/json/JSONObject;->NULL:Ljava/lang/Object;

    .line 50
    :cond_14e
    invoke-virtual {v0, v11, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_151
    iget-object v2, v1, Lg3/e;->j:Lg3/s;

    .line 51
    iget-object v2, v2, Lg3/s;->a:Ljava/util/Set;

    invoke-interface {v2, v10}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v2

    const/4 v3, 0x1

    xor-int/2addr v2, v3

    if-eqz v2, :cond_16c

    .line 52
    iget-object v2, v1, Lg3/e;->r:Lg3/p;

    .line 53
    invoke-virtual {v2}, Lg3/p;->b()Lg3/p$b;

    move-result-object v2

    .line 54
    iget-object v2, v2, Lg3/p$b;->b:Ljava/lang/String;

    if-nez v2, :cond_169

    .line 55
    sget-object v2, Lorg/json/JSONObject;->NULL:Ljava/lang/Object;

    .line 56
    :cond_169
    invoke-virtual {v0, v10, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_16c
    iget-object v2, v1, Lg3/e;->j:Lg3/s;

    .line 57
    iget-object v2, v2, Lg3/s;->a:Ljava/util/Set;

    invoke-interface {v2, v9}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v2

    const/4 v3, 0x1

    xor-int/2addr v2, v3

    if-eqz v2, :cond_187

    .line 58
    iget-object v2, v1, Lg3/e;->r:Lg3/p;

    .line 59
    invoke-virtual {v2}, Lg3/p;->b()Lg3/p$b;

    move-result-object v2

    .line 60
    iget-object v2, v2, Lg3/p$b;->j:Ljava/lang/String;

    if-nez v2, :cond_184

    .line 61
    sget-object v2, Lorg/json/JSONObject;->NULL:Ljava/lang/Object;

    .line 62
    :cond_184
    invoke-virtual {v0, v9, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_187
    iget-object v2, v1, Lg3/e;->j:Lg3/s;

    .line 63
    iget-object v2, v2, Lg3/s;->a:Ljava/util/Set;

    move-object/from16 v3, v18

    invoke-interface {v2, v3}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v2

    const/4 v4, 0x1

    xor-int/2addr v2, v4

    if-eqz v2, :cond_19a

    .line 64
    iget-object v2, v1, Lg3/e;->k:Ljava/lang/String;

    invoke-virtual {v0, v3, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_19a
    new-instance v2, Lorg/json/JSONObject;

    invoke-direct {v2}, Lorg/json/JSONObject;-><init>()V

    const-string v3, "name"

    const-string v4, "amplitude-android"

    invoke-virtual {v2, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v3, "version"

    const-string v4, "2.23.2"

    invoke-virtual {v2, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v3, "library"

    invoke-virtual {v0, v3, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    if-nez p3, :cond_1ba

    new-instance v2, Lorg/json/JSONObject;

    invoke-direct {v2}, Lorg/json/JSONObject;-><init>()V

    goto :goto_1bc

    :cond_1ba
    move-object/from16 v2, p3

    :goto_1bc
    iget-object v3, v1, Lg3/e;->j:Lg3/s;

    .line 65
    iget-object v3, v3, Lg3/s;->a:Ljava/util/Set;

    const-string v4, "lat_lng"

    invoke-interface {v3, v4}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v3

    const/4 v4, 0x1

    xor-int/2addr v3, v4

    if-eqz v3, :cond_1ee

    .line 66
    iget-object v3, v1, Lg3/e;->r:Lg3/p;

    invoke-virtual {v3}, Lg3/p;->d()Landroid/location/Location;

    move-result-object v3

    if-eqz v3, :cond_1ee

    new-instance v4, Lorg/json/JSONObject;

    invoke-direct {v4}, Lorg/json/JSONObject;-><init>()V

    const-string v5, "lat"

    invoke-virtual {v3}, Landroid/location/Location;->getLatitude()D

    move-result-wide v6

    invoke-virtual {v4, v5, v6, v7}, Lorg/json/JSONObject;->put(Ljava/lang/String;D)Lorg/json/JSONObject;

    const-string v5, "lng"

    invoke-virtual {v3}, Landroid/location/Location;->getLongitude()D

    move-result-wide v6

    invoke-virtual {v4, v5, v6, v7}, Lorg/json/JSONObject;->put(Ljava/lang/String;D)Lorg/json/JSONObject;

    const-string v3, "location"

    invoke-virtual {v2, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_1ee
    iget-object v3, v1, Lg3/e;->j:Lg3/s;

    .line 67
    iget-object v3, v3, Lg3/s;->a:Ljava/util/Set;

    const-string v4, "adid"

    invoke-interface {v3, v4}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v3

    const/4 v4, 0x1

    xor-int/2addr v3, v4

    if-eqz v3, :cond_20f

    .line 68
    iget-object v3, v1, Lg3/e;->r:Lg3/p;

    invoke-virtual {v3}, Lg3/p;->a()Ljava/lang/String;

    move-result-object v3

    if-eqz v3, :cond_20f

    const-string v3, "androidADID"

    iget-object v4, v1, Lg3/e;->r:Lg3/p;

    invoke-virtual {v4}, Lg3/p;->a()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v2, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_20f
    const-string v3, "limit_ad_tracking"

    iget-object v4, v1, Lg3/e;->r:Lg3/p;

    .line 69
    invoke-virtual {v4}, Lg3/p;->b()Lg3/p$b;

    move-result-object v4

    .line 70
    iget-boolean v4, v4, Lg3/p$b;->k:Z

    .line 71
    invoke-virtual {v2, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Z)Lorg/json/JSONObject;

    const-string v3, "gps_enabled"

    iget-object v4, v1, Lg3/e;->r:Lg3/p;

    .line 72
    invoke-virtual {v4}, Lg3/p;->b()Lg3/p$b;

    move-result-object v4

    .line 73
    iget-boolean v4, v4, Lg3/p$b;->l:Z

    .line 74
    invoke-virtual {v2, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Z)Lorg/json/JSONObject;

    const-string v3, "api_properties"

    invoke-virtual {v0, v3, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v2, "event_properties"

    move-object/from16 v3, p2

    if-nez v3, :cond_23a

    new-instance v3, Lorg/json/JSONObject;

    invoke-direct {v3}, Lorg/json/JSONObject;-><init>()V

    goto :goto_23e

    :cond_23a
    invoke-virtual {v1, v3}, Lg3/e;->s(Lorg/json/JSONObject;)Lorg/json/JSONObject;

    move-result-object v3

    :goto_23e
    invoke-virtual {v0, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v2, "user_properties"

    move-object/from16 v3, p4

    if-nez v3, :cond_24d

    new-instance v3, Lorg/json/JSONObject;

    invoke-direct {v3}, Lorg/json/JSONObject;-><init>()V

    goto :goto_251

    :cond_24d
    invoke-virtual {v1, v3}, Lg3/e;->s(Lorg/json/JSONObject;)Lorg/json/JSONObject;

    move-result-object v3

    :goto_251
    invoke-virtual {v0, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v2, "groups"

    move-object/from16 v3, p5

    if-nez v3, :cond_260

    new-instance v3, Lorg/json/JSONObject;

    invoke-direct {v3}, Lorg/json/JSONObject;-><init>()V

    goto :goto_264

    :cond_260
    invoke-virtual {v1, v3}, Lg3/e;->s(Lorg/json/JSONObject;)Lorg/json/JSONObject;

    move-result-object v3

    :goto_264
    invoke-virtual {v0, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v2, "group_properties"

    move-object/from16 v3, p6

    if-nez v3, :cond_273

    new-instance v3, Lorg/json/JSONObject;

    invoke-direct {v3}, Lorg/json/JSONObject;-><init>()V

    goto :goto_277

    :cond_273
    invoke-virtual {v1, v3}, Lg3/e;->s(Lorg/json/JSONObject;)Lorg/json/JSONObject;

    move-result-object v3

    :goto_277
    invoke-virtual {v0, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
    :try_end_27a
    .catch Lorg/json/JSONException; {:try_start_47 .. :try_end_27a} :catch_281

    move-object/from16 v2, p1

    :try_start_27c
    invoke-virtual {v1, v2, v0}, Lg3/e;->n(Ljava/lang/String;Lorg/json/JSONObject;)J

    move-result-wide v16
    :try_end_280
    .catch Lorg/json/JSONException; {:try_start_27c .. :try_end_280} :catch_285

    goto :goto_2af

    :catch_281
    move-exception v0

    move-object/from16 v2, p1

    goto :goto_286

    :catch_285
    move-exception v0

    :goto_286
    const/4 v3, 0x2

    new-array v3, v3, [Ljava/lang/Object;

    const/4 v4, 0x0

    aput-object v2, v3, v4

    invoke-virtual {v0}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v5

    const/4 v6, 0x1

    aput-object v5, v3, v6

    const-string v5, "JSON Serialization of event type %s failed, skipping: %s"

    invoke-static {v5, v3}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    const-string v5, "com.amplitude.api.AmplitudeClient"

    .line 75
    invoke-static {v5, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 76
    invoke-static {}, Lg3/q;->a()Lg3/q;

    move-result-object v3

    new-array v5, v6, [Ljava/lang/Object;

    aput-object v2, v5, v4

    const-string v2, "Failed to JSON serialize event type %s"

    invoke-static {v2, v5}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v3, v2, v0}, Lg3/q;->b(Ljava/lang/String;Ljava/lang/Throwable;)Lg3/q;

    :goto_2af
    return-wide v16
.end method

.method public g(Ljava/lang/String;Lorg/json/JSONObject;)V
    .registers 14

    .line 1
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v8

    .line 2
    invoke-static {p1}, Lg3/t;->c(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_13

    const-string v0, "com.amplitude.api.AmplitudeClient"

    const-string v1, "Argument eventType cannot be null or blank in logEvent()"

    .line 3
    invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    const/4 v0, 0x0

    goto :goto_19

    :cond_13
    const-string v0, "logEvent()"

    .line 4
    invoke-virtual {p0, v0}, Lg3/e;->c(Ljava/lang/String;)Z

    move-result v0

    :goto_19
    if-eqz v0, :cond_32

    if-eqz p2, :cond_21

    .line 5
    invoke-static {p2}, Lg3/t;->a(Lorg/json/JSONObject;)Lorg/json/JSONObject;

    move-result-object p2

    :cond_21
    move-object v3, p2

    const/4 v4, 0x0

    const/4 v5, 0x0

    const/4 v6, 0x0

    const/4 v7, 0x0

    new-instance p2, Lg3/h;

    const/4 v10, 0x0

    move-object v0, p2

    move-object v1, p0

    move-object v2, p1

    invoke-direct/range {v0 .. v10}, Lg3/h;-><init>(Lg3/e;Ljava/lang/String;Lorg/json/JSONObject;Lorg/json/JSONObject;Lorg/json/JSONObject;Lorg/json/JSONObject;Lorg/json/JSONObject;JZ)V

    invoke-virtual {p0, p2}, Lg3/e;->l(Ljava/lang/Runnable;)V

    :cond_32
    return-void
.end method

.method public h(Ljava/util/List;Ljava/util/List;J)Landroid/util/Pair;
    .registers 16
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List<",
            "Lorg/json/JSONObject;",
            ">;",
            "Ljava/util/List<",
            "Lorg/json/JSONObject;",
            ">;J)",
            "Landroid/util/Pair<",
            "Landroid/util/Pair<",
            "Ljava/lang/Long;",
            "Ljava/lang/Long;",
            ">;",
            "Lorg/json/JSONArray;",
            ">;"
        }
    .end annotation

    new-instance v0, Lorg/json/JSONArray;

    invoke-direct {v0}, Lorg/json/JSONArray;-><init>()V

    const-wide/16 v1, -0x1

    move-wide v3, v1

    :goto_8
    invoke-virtual {v0}, Lorg/json/JSONArray;->length()I

    move-result v5

    int-to-long v5, v5

    cmp-long v5, v5, p3

    if-gez v5, :cond_86

    invoke-interface {p1}, Ljava/util/List;->isEmpty()Z

    move-result v5

    invoke-interface {p2}, Ljava/util/List;->isEmpty()Z

    move-result v6

    const/4 v7, 0x0

    if-eqz v5, :cond_39

    if-eqz v6, :cond_39

    const/4 p1, 0x1

    new-array p1, p1, [Ljava/lang/Object;

    invoke-virtual {v0}, Lorg/json/JSONArray;->length()I

    move-result p2

    int-to-long v5, p2

    sub-long/2addr p3, v5

    invoke-static {p3, p4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object p2

    aput-object p2, p1, v7

    const-string p2, "mergeEventsAndIdentifys: number of events and identifys less than expected by %d"

    invoke-static {p2, p1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object p1

    const-string p2, "com.amplitude.api.AmplitudeClient"

    .line 1
    invoke-static {p2, p1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_86

    :cond_39
    const-string v8, "event_id"

    if-eqz v6, :cond_3e

    goto :goto_77

    :cond_3e
    if-eqz v5, :cond_41

    goto :goto_68

    .line 2
    :cond_41
    invoke-interface {p1, v7}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Lorg/json/JSONObject;

    const-string v6, "sequence_number"

    invoke-virtual {v5, v6}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v5

    if-eqz v5, :cond_77

    invoke-interface {p1, v7}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Lorg/json/JSONObject;

    invoke-virtual {v5, v6}, Lorg/json/JSONObject;->getLong(Ljava/lang/String;)J

    move-result-wide v9

    invoke-interface {p2, v7}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Lorg/json/JSONObject;

    invoke-virtual {v5, v6}, Lorg/json/JSONObject;->getLong(Ljava/lang/String;)J

    move-result-wide v5

    cmp-long v5, v9, v5

    if-gez v5, :cond_68

    goto :goto_77

    :cond_68
    :goto_68
    invoke-interface {p2, v7}, Ljava/util/List;->remove(I)Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Lorg/json/JSONObject;

    invoke-virtual {v3, v8}, Lorg/json/JSONObject;->getLong(Ljava/lang/String;)J

    move-result-wide v4

    invoke-virtual {v0, v3}, Lorg/json/JSONArray;->put(Ljava/lang/Object;)Lorg/json/JSONArray;

    move-wide v3, v4

    goto :goto_8

    :cond_77
    :goto_77
    invoke-interface {p1, v7}, Ljava/util/List;->remove(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lorg/json/JSONObject;

    invoke-virtual {v1, v8}, Lorg/json/JSONObject;->getLong(Ljava/lang/String;)J

    move-result-wide v5

    invoke-virtual {v0, v1}, Lorg/json/JSONArray;->put(Ljava/lang/Object;)Lorg/json/JSONArray;

    move-wide v1, v5

    goto :goto_8

    :cond_86
    :goto_86
    new-instance p1, Landroid/util/Pair;

    new-instance p2, Landroid/util/Pair;

    invoke-static {v1, v2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object p3

    invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object p4

    invoke-direct {p2, p3, p4}, Landroid/util/Pair;-><init>(Ljava/lang/Object;Ljava/lang/Object;)V

    invoke-direct {p1, p2, v0}, Landroid/util/Pair;-><init>(Ljava/lang/Object;Ljava/lang/Object;)V

    return-object p1
.end method

.method public k(J)V
    .registers 4

    invoke-virtual {p0}, Lg3/e;->d()Z

    move-result v0

    if-nez v0, :cond_7

    return-void

    .line 1
    :cond_7
    iput-wide p1, p0, Lg3/e;->p:J

    iget-object v0, p0, Lg3/e;->c:Lg3/n;

    invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object p1

    const-string p2, "last_event_time"

    invoke-virtual {v0, p2, p1}, Lg3/n;->a0(Ljava/lang/String;Ljava/lang/Long;)J

    return-void
.end method

.method public l(Ljava/lang/Runnable;)V
    .registers 4

    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v0

    iget-object v1, p0, Lg3/e;->G:Lg3/u;

    if-eq v0, v1, :cond_11

    .line 1
    invoke-virtual {v1}, Lg3/u;->b()V

    iget-object v0, v1, Lg3/u;->r:Landroid/os/Handler;

    invoke-virtual {v0, p1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    goto :goto_14

    .line 2
    :cond_11
    invoke-interface {p1}, Ljava/lang/Runnable;->run()V

    :goto_14
    return-void
.end method

.method public final m(Ljava/lang/String;)V
    .registers 5

    iget-object v0, p0, Lg3/e;->c:Lg3/n;

    const-string v1, "device_id"

    invoke-virtual {v0, v1, p1}, Lg3/n;->b0(Ljava/lang/String;Ljava/lang/String;)J

    iget-object v0, p0, Lg3/e;->a:Landroid/content/Context;

    iget-object v2, p0, Lg3/e;->e:Ljava/lang/String;

    .line 1
    invoke-static {v0, v2}, Lg3/t;->b(Landroid/content/Context;Ljava/lang/String;)Landroid/content/SharedPreferences;

    move-result-object v0

    invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V

    return-void
.end method

.method public n(Ljava/lang/String;Lorg/json/JSONObject;)J
    .registers 13

    invoke-virtual {p2}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object p2

    invoke-static {p2}, Lg3/t;->c(Ljava/lang/String;)Z

    move-result v0

    const/4 v1, 0x1

    if-eqz v0, :cond_1e

    const-string p2, "com.amplitude.api.AmplitudeClient"

    const-string v0, "Detected empty event string for event type %s, skipping"

    new-array v1, v1, [Ljava/lang/Object;

    const/4 v2, 0x0

    aput-object p1, v1, v2

    invoke-static {v0, v1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object p1

    .line 1
    invoke-static {p2, p1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    const-wide/16 p1, -0x1

    return-wide p1

    :cond_1e
    const-string v0, "$identify"

    .line 2
    invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_4c

    const-string v0, "$groupidentify"

    invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_2f

    goto :goto_4c

    :cond_2f
    iget-object v0, p0, Lg3/e;->c:Lg3/n;

    .line 3
    monitor-enter v0

    :try_start_32
    const-string v2, "events"

    invoke-virtual {v0, v2, p2}, Lg3/n;->b(Ljava/lang/String;Ljava/lang/String;)J

    move-result-wide v2
    :try_end_38
    .catchall {:try_start_32 .. :try_end_38} :catchall_49

    monitor-exit v0

    .line 4
    iput-wide v2, p0, Lg3/e;->n:J

    .line 5
    iput-wide v2, p0, Lg3/e;->n:J

    iget-object p2, p0, Lg3/e;->c:Lg3/n;

    invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v0

    const-string v2, "last_event_id"

    invoke-virtual {p2, v2, v0}, Lg3/n;->a0(Ljava/lang/String;Ljava/lang/Long;)J

    goto :goto_65

    :catchall_49
    move-exception p1

    .line 6
    monitor-exit v0

    throw p1

    .line 7
    :cond_4c
    :goto_4c
    iget-object v0, p0, Lg3/e;->c:Lg3/n;

    .line 8
    monitor-enter v0

    :try_start_4f
    const-string v2, "identifys"

    invoke-virtual {v0, v2, p2}, Lg3/n;->b(Ljava/lang/String;Ljava/lang/String;)J

    move-result-wide v2
    :try_end_55
    .catchall {:try_start_4f .. :try_end_55} :catchall_101

    monitor-exit v0

    .line 9
    iput-wide v2, p0, Lg3/e;->o:J

    .line 10
    iput-wide v2, p0, Lg3/e;->o:J

    iget-object p2, p0, Lg3/e;->c:Lg3/n;

    invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v0

    const-string v2, "last_identify_id"

    invoke-virtual {p2, v2, v0}, Lg3/n;->a0(Ljava/lang/String;Ljava/lang/Long;)J

    .line 11
    :goto_65
    iget p2, p0, Lg3/e;->u:I

    div-int/lit8 p2, p2, 0xa

    invoke-static {v1, p2}, Ljava/lang/Math;->max(II)I

    move-result p2

    const/16 v0, 0x14

    invoke-static {p2, v0}, Ljava/lang/Math;->min(II)I

    move-result p2

    iget-object v0, p0, Lg3/e;->c:Lg3/n;

    invoke-virtual {v0}, Lg3/n;->q()J

    move-result-wide v2

    iget v0, p0, Lg3/e;->u:I

    int-to-long v4, v0

    cmp-long v0, v2, v4

    if-lez v0, :cond_99

    iget-object v0, p0, Lg3/e;->c:Lg3/n;

    int-to-long v2, p2

    .line 12
    monitor-enter v0

    :try_start_84
    const-string v4, "events"

    invoke-virtual {v0, v4, v2, v3}, Lg3/n;->L(Ljava/lang/String;J)J

    move-result-wide v2
    :try_end_8a
    .catchall {:try_start_84 .. :try_end_8a} :catchall_96

    monitor-exit v0

    .line 13
    monitor-enter v0

    :try_start_8c
    const-string v4, "events"

    invoke-virtual {v0, v4, v2, v3}, Lg3/n;->g0(Ljava/lang/String;J)V
    :try_end_91
    .catchall {:try_start_8c .. :try_end_91} :catchall_93

    monitor-exit v0

    goto :goto_99

    :catchall_93
    move-exception p1

    monitor-exit v0

    throw p1

    :catchall_96
    move-exception p1

    .line 14
    monitor-exit v0

    throw p1

    .line 15
    :cond_99
    :goto_99
    iget-object v0, p0, Lg3/e;->c:Lg3/n;

    .line 16
    monitor-enter v0

    :try_start_9c
    const-string v2, "identifys"

    invoke-virtual {v0, v2}, Lg3/n;->H(Ljava/lang/String;)J

    move-result-wide v2
    :try_end_a2
    .catchall {:try_start_9c .. :try_end_a2} :catchall_fe

    monitor-exit v0

    .line 17
    iget v0, p0, Lg3/e;->u:I

    int-to-long v4, v0

    cmp-long v0, v2, v4

    if-lez v0, :cond_b4

    iget-object v0, p0, Lg3/e;->c:Lg3/n;

    int-to-long v2, p2

    invoke-virtual {v0, v2, v3}, Lg3/n;->P(J)J

    move-result-wide v2

    invoke-virtual {v0, v2, v3}, Lg3/n;->i0(J)V

    :cond_b4
    iget-object p2, p0, Lg3/e;->c:Lg3/n;

    invoke-virtual {p2}, Lg3/n;->Q()J

    move-result-wide v2

    iget p2, p0, Lg3/e;->s:I

    int-to-long v4, p2

    rem-long v6, v2, v4

    const-wide/16 v8, 0x0

    cmp-long p2, v6, v8

    if-nez p2, :cond_cd

    cmp-long p2, v2, v4

    if-ltz p2, :cond_cd

    invoke-virtual {p0}, Lg3/e;->t()V

    goto :goto_e7

    :cond_cd
    iget-wide v2, p0, Lg3/e;->v:J

    .line 18
    iget-object p2, p0, Lg3/e;->D:Ljava/util/concurrent/atomic/AtomicBoolean;

    invoke-virtual {p2, v1}, Ljava/util/concurrent/atomic/AtomicBoolean;->getAndSet(Z)Z

    move-result p2

    if-eqz p2, :cond_d8

    goto :goto_e7

    :cond_d8
    iget-object p2, p0, Lg3/e;->G:Lg3/u;

    new-instance v0, Lg3/d;

    invoke-direct {v0, p0}, Lg3/d;-><init>(Lg3/e;)V

    .line 19
    invoke-virtual {p2}, Lg3/u;->b()V

    iget-object p2, p2, Lg3/u;->r:Landroid/os/Handler;

    invoke-virtual {p2, v0, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    :goto_e7
    const-string p2, "$identify"

    .line 20
    invoke-virtual {p1, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p2

    if-nez p2, :cond_fb

    const-string p2, "$groupidentify"

    invoke-virtual {p1, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p1

    if-eqz p1, :cond_f8

    goto :goto_fb

    :cond_f8
    iget-wide p1, p0, Lg3/e;->n:J

    goto :goto_fd

    :cond_fb
    :goto_fb
    iget-wide p1, p0, Lg3/e;->o:J

    :goto_fd
    return-wide p1

    :catchall_fe
    move-exception p1

    .line 21
    monitor-exit v0

    throw p1

    :catchall_101
    move-exception p1

    .line 22
    monitor-exit v0

    throw p1
.end method

.method public final o(J)V
    .registers 4

    iput-wide p1, p0, Lg3/e;->l:J

    .line 1
    iput-wide p1, p0, Lg3/e;->q:J

    iget-object v0, p0, Lg3/e;->c:Lg3/n;

    invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object p1

    const-string p2, "previous_session_id"

    invoke-virtual {v0, p2, p1}, Lg3/n;->a0(Ljava/lang/String;Ljava/lang/Long;)J

    return-void
.end method

.method public p(J)Z
    .registers 10

    invoke-virtual {p0}, Lg3/e;->d()Z

    move-result v0

    const/4 v1, 0x0

    const/4 v2, 0x1

    if-eqz v0, :cond_19

    invoke-virtual {p0, p1, p2}, Lg3/e;->e(J)Z

    move-result v0

    if-eqz v0, :cond_12

    invoke-virtual {p0, p1, p2}, Lg3/e;->k(J)V

    return v1

    .line 1
    :cond_12
    invoke-virtual {p0, p1, p2}, Lg3/e;->o(J)V

    invoke-virtual {p0, p1, p2}, Lg3/e;->k(J)V

    return v2

    .line 2
    :cond_19
    invoke-virtual {p0, p1, p2}, Lg3/e;->e(J)Z

    move-result v0

    if-eqz v0, :cond_35

    iget-wide v3, p0, Lg3/e;->q:J

    const-wide/16 v5, -0x1

    cmp-long v0, v3, v5

    if-nez v0, :cond_2e

    .line 3
    invoke-virtual {p0, p1, p2}, Lg3/e;->o(J)V

    invoke-virtual {p0, p1, p2}, Lg3/e;->k(J)V

    return v2

    .line 4
    :cond_2e
    invoke-virtual {p0, v3, v4}, Lg3/e;->o(J)V

    invoke-virtual {p0, p1, p2}, Lg3/e;->k(J)V

    return v1

    .line 5
    :cond_35
    invoke-virtual {p0, p1, p2}, Lg3/e;->o(J)V

    invoke-virtual {p0, p1, p2}, Lg3/e;->k(J)V

    return v2
.end method

.method public r(Lorg/json/JSONArray;)Lorg/json/JSONArray;
    .registers 6

    const/4 v0, 0x0

    :goto_1
    invoke-virtual {p1}, Lorg/json/JSONArray;->length()I

    move-result v1

    if-ge v0, v1, :cond_49

    invoke-virtual {p1, v0}, Lorg/json/JSONArray;->get(I)Ljava/lang/Object;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v2

    const-class v3, Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_1e

    check-cast v1, Ljava/lang/String;

    invoke-static {v1}, Lg3/e;->q(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    goto :goto_43

    :cond_1e
    invoke-virtual {v1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v2

    const-class v3, Lorg/json/JSONObject;

    invoke-virtual {v2, v3}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_31

    check-cast v1, Lorg/json/JSONObject;

    invoke-virtual {p0, v1}, Lg3/e;->s(Lorg/json/JSONObject;)Lorg/json/JSONObject;

    move-result-object v1

    goto :goto_43

    :cond_31
    invoke-virtual {v1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v2

    const-class v3, Lorg/json/JSONArray;

    invoke-virtual {v2, v3}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_46

    check-cast v1, Lorg/json/JSONArray;

    invoke-virtual {p0, v1}, Lg3/e;->r(Lorg/json/JSONArray;)Lorg/json/JSONArray;

    move-result-object v1

    :goto_43
    invoke-virtual {p1, v0, v1}, Lorg/json/JSONArray;->put(ILjava/lang/Object;)Lorg/json/JSONArray;

    :cond_46
    add-int/lit8 v0, v0, 0x1

    goto :goto_1

    :cond_49
    return-object p1
.end method

.method public s(Lorg/json/JSONObject;)Lorg/json/JSONObject;
    .registers 8

    invoke-virtual {p1}, Lorg/json/JSONObject;->length()I

    move-result v0

    const/16 v1, 0x3e8

    const-string v2, "com.amplitude.api.AmplitudeClient"

    if-le v0, v1, :cond_15

    const-string p1, "Warning: too many properties (more than 1000), ignoring"

    .line 1
    invoke-static {v2, p1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 2
    new-instance p1, Lorg/json/JSONObject;

    invoke-direct {p1}, Lorg/json/JSONObject;-><init>()V

    return-object p1

    :cond_15
    invoke-virtual {p1}, Lorg/json/JSONObject;->keys()Ljava/util/Iterator;

    move-result-object v0

    :cond_19
    :goto_19
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_7f

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/String;

    :try_start_25
    invoke-virtual {p1, v1}, Lorg/json/JSONObject;->get(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v3

    const-string v4, "$receipt"

    invoke-virtual {v1, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-nez v4, :cond_72

    const-string v4, "$receiptSig"

    invoke-virtual {v1, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_3a

    goto :goto_72

    :cond_3a
    invoke-virtual {v3}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v4

    const-class v5, Ljava/lang/String;

    invoke-virtual {v4, v5}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_4d

    check-cast v3, Ljava/lang/String;

    invoke-static {v3}, Lg3/e;->q(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    goto :goto_72

    :cond_4d
    invoke-virtual {v3}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v4

    const-class v5, Lorg/json/JSONObject;

    invoke-virtual {v4, v5}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_60

    check-cast v3, Lorg/json/JSONObject;

    invoke-virtual {p0, v3}, Lg3/e;->s(Lorg/json/JSONObject;)Lorg/json/JSONObject;

    move-result-object v3

    goto :goto_72

    :cond_60
    invoke-virtual {v3}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v4

    const-class v5, Lorg/json/JSONArray;

    invoke-virtual {v4, v5}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_19

    check-cast v3, Lorg/json/JSONArray;

    invoke-virtual {p0, v3}, Lg3/e;->r(Lorg/json/JSONArray;)Lorg/json/JSONArray;

    move-result-object v3

    :cond_72
    :goto_72
    invoke-virtual {p1, v1, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
    :try_end_75
    .catch Lorg/json/JSONException; {:try_start_25 .. :try_end_75} :catch_76

    goto :goto_19

    :catch_76
    move-exception v1

    invoke-virtual {v1}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v1

    .line 3
    invoke-static {v2, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_19

    :cond_7f
    return-object p1
.end method

.method public t()V
    .registers 4

    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lg3/e;->u(Z)V

    invoke-static {}, Lg3/q;->a()Lg3/q;

    move-result-object v0

    .line 1
    iget-boolean v1, v0, Lg3/q;->a:Z

    if-eqz v1, :cond_3a

    iget-object v1, v0, Lg3/q;->b:Ljava/lang/String;

    invoke-static {v1}, Lg3/t;->c(Ljava/lang/String;)Z

    move-result v1

    if-nez v1, :cond_3a

    iget-object v1, v0, Lg3/q;->c:Lv9/a0;

    if-eqz v1, :cond_3a

    iget-object v1, v0, Lg3/q;->d:Ljava/lang/String;

    invoke-static {v1}, Lg3/t;->c(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_21

    goto :goto_3a

    :cond_21
    new-instance v1, Lg3/r;

    invoke-direct {v1, v0}, Lg3/r;-><init>(Lg3/q;)V

    .line 2
    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v2

    iget-object v0, v0, Lg3/q;->g:Lg3/u;

    if-eq v2, v0, :cond_37

    .line 3
    invoke-virtual {v0}, Lg3/u;->b()V

    iget-object v0, v0, Lg3/u;->r:Landroid/os/Handler;

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    goto :goto_3a

    .line 4
    :cond_37
    invoke-virtual {v1}, Lg3/r;->run()V

    :cond_3a
    :goto_3a
    return-void
.end method

.method public u(Z)V
    .registers 14

    iget-boolean v0, p0, Lg3/e;->i:Z

    if-nez v0, :cond_c6

    iget-object v0, p0, Lg3/e;->E:Ljava/util/concurrent/atomic/AtomicBoolean;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Ljava/util/concurrent/atomic/AtomicBoolean;->getAndSet(Z)Z

    move-result v0

    if-nez v0, :cond_c6

    iget-object v0, p0, Lg3/e;->c:Lg3/n;

    invoke-virtual {v0}, Lg3/n;->Q()J

    move-result-wide v2

    if-eqz p1, :cond_18

    iget p1, p0, Lg3/e;->z:I

    goto :goto_1a

    :cond_18
    iget p1, p0, Lg3/e;->t:I

    :goto_1a
    int-to-long v4, p1

    invoke-static {v4, v5, v2, v3}, Ljava/lang/Math;->min(JJ)J

    move-result-wide v2

    const-wide/16 v4, 0x0

    cmp-long p1, v2, v4

    const/4 v0, 0x0

    if-gtz p1, :cond_2c

    iget-object p1, p0, Lg3/e;->E:Ljava/util/concurrent/atomic/AtomicBoolean;

    invoke-virtual {p1, v0}, Ljava/util/concurrent/atomic/AtomicBoolean;->set(Z)V

    return-void

    :cond_2c
    :try_start_2c
    iget-object p1, p0, Lg3/e;->c:Lg3/n;

    iget-wide v8, p0, Lg3/e;->n:J

    .line 1
    monitor-enter p1
    :try_end_31
    .catch Lorg/json/JSONException; {:try_start_2c .. :try_end_31} :catch_ae
    .catch Lg3/m; {:try_start_2c .. :try_end_31} :catch_94

    :try_start_31
    const-string v7, "events"

    move-object v6, p1

    move-wide v10, v2

    invoke-virtual/range {v6 .. v11}, Lg3/n;->I(Ljava/lang/String;JJ)Ljava/util/List;

    move-result-object v4
    :try_end_39
    .catchall {:try_start_31 .. :try_end_39} :catchall_91

    :try_start_39
    monitor-exit p1

    .line 2
    iget-object p1, p0, Lg3/e;->c:Lg3/n;

    iget-wide v8, p0, Lg3/e;->o:J

    .line 3
    monitor-enter p1
    :try_end_3f
    .catch Lorg/json/JSONException; {:try_start_39 .. :try_end_3f} :catch_ae
    .catch Lg3/m; {:try_start_39 .. :try_end_3f} :catch_94

    :try_start_3f
    const-string v7, "identifys"

    move-object v6, p1

    move-wide v10, v2

    invoke-virtual/range {v6 .. v11}, Lg3/n;->I(Ljava/lang/String;JJ)Ljava/util/List;

    move-result-object v5
    :try_end_47
    .catchall {:try_start_3f .. :try_end_47} :catchall_8e

    :try_start_47
    monitor-exit p1

    .line 4
    invoke-virtual {p0, v4, v5, v2, v3}, Lg3/e;->h(Ljava/util/List;Ljava/util/List;J)Landroid/util/Pair;

    move-result-object p1

    iget-object v2, p1, Landroid/util/Pair;->second:Ljava/lang/Object;

    check-cast v2, Lorg/json/JSONArray;

    invoke-virtual {v2}, Lorg/json/JSONArray;->length()I

    move-result v2

    if-nez v2, :cond_5c

    iget-object p1, p0, Lg3/e;->E:Ljava/util/concurrent/atomic/AtomicBoolean;

    invoke-virtual {p1, v0}, Ljava/util/concurrent/atomic/AtomicBoolean;->set(Z)V

    return-void

    :cond_5c
    iget-object v2, p1, Landroid/util/Pair;->first:Ljava/lang/Object;

    check-cast v2, Landroid/util/Pair;

    iget-object v2, v2, Landroid/util/Pair;->first:Ljava/lang/Object;

    check-cast v2, Ljava/lang/Long;

    invoke-virtual {v2}, Ljava/lang/Long;->longValue()J

    move-result-wide v6

    iget-object v2, p1, Landroid/util/Pair;->first:Ljava/lang/Object;

    check-cast v2, Landroid/util/Pair;

    iget-object v2, v2, Landroid/util/Pair;->second:Ljava/lang/Object;

    check-cast v2, Ljava/lang/Long;

    invoke-virtual {v2}, Ljava/lang/Long;->longValue()J

    move-result-wide v8

    iget-object p1, p1, Landroid/util/Pair;->second:Ljava/lang/Object;

    check-cast p1, Lorg/json/JSONArray;

    invoke-virtual {p1}, Lorg/json/JSONArray;->toString()Ljava/lang/String;

    move-result-object v5

    iget-object p1, p0, Lg3/e;->H:Lg3/u;

    new-instance v2, Lg3/e$a;

    move-object v3, v2

    move-object v4, p0

    invoke-direct/range {v3 .. v9}, Lg3/e$a;-><init>(Lg3/e;Ljava/lang/String;JJ)V

    .line 5
    invoke-virtual {p1}, Lg3/u;->b()V

    iget-object p1, p1, Lg3/u;->r:Landroid/os/Handler;

    invoke-virtual {p1, v2}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    goto :goto_c6

    :catchall_8e
    move-exception v2

    .line 6
    monitor-exit p1

    throw v2

    :catchall_91
    move-exception v2

    .line 7
    monitor-exit p1

    throw v2
    :try_end_94
    .catch Lorg/json/JSONException; {:try_start_47 .. :try_end_94} :catch_ae
    .catch Lg3/m; {:try_start_47 .. :try_end_94} :catch_94

    :catch_94
    move-exception p1

    .line 8
    iget-object v2, p0, Lg3/e;->E:Ljava/util/concurrent/atomic/AtomicBoolean;

    invoke-virtual {v2, v0}, Ljava/util/concurrent/atomic/AtomicBoolean;->set(Z)V

    const-string v2, "com.amplitude.api.AmplitudeClient"

    const-string v3, "Caught Cursor window exception during event upload, deferring upload: %s"

    new-array v1, v1, [Ljava/lang/Object;

    invoke-virtual {p1}, Ljava/lang/RuntimeException;->getMessage()Ljava/lang/String;

    move-result-object v4

    aput-object v4, v1, v0

    invoke-static {v3, v1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    .line 9
    invoke-static {v2, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_bd

    :catch_ae
    move-exception p1

    .line 10
    iget-object v1, p0, Lg3/e;->E:Ljava/util/concurrent/atomic/AtomicBoolean;

    invoke-virtual {v1, v0}, Ljava/util/concurrent/atomic/AtomicBoolean;->set(Z)V

    const-string v0, "com.amplitude.api.AmplitudeClient"

    invoke-virtual {p1}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v1

    .line 11
    invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 12
    :goto_bd
    invoke-static {}, Lg3/q;->a()Lg3/q;

    move-result-object v0

    const-string v1, "Failed to update server"

    invoke-virtual {v0, v1, p1}, Lg3/q;->b(Ljava/lang/String;Ljava/lang/Throwable;)Lg3/q;

    :cond_c6
    :goto_c6
    return-void
.end method
