.class public Lg3/n;
.super Landroid/database/sqlite/SQLiteOpenHelper;
.source ""


# static fields
.field public static final u:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map<",
            "Ljava/lang/String;",
            "Lg3/n;",
            ">;"
        }
    .end annotation
.end field

.field public static final v:Lg3/l;


# instance fields
.field public r:Ljava/io/File;

.field public s:Z

.field public t:Lg3/o;


# direct methods
.method public static constructor <clinit>()V
    .registers 1

    new-instance v0, Ljava/util/HashMap;

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

    sput-object v0, Lg3/n;->u:Ljava/util/Map;

    sget-object v0, Lg3/l;->a:Lg3/l;

    sput-object v0, Lg3/n;->v:Lg3/l;

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Ljava/lang/String;)V
    .registers 6

    invoke-static {p2}, Lg3/n;->p(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x0

    const/4 v2, 0x3

    invoke-direct {p0, p1, v0, v1, v2}, Landroid/database/sqlite/SQLiteOpenHelper;-><init>(Landroid/content/Context;Ljava/lang/String;Landroid/database/sqlite/SQLiteDatabase$CursorFactory;I)V

    const/4 v0, 0x1

    iput-boolean v0, p0, Lg3/n;->s:Z

    invoke-static {p2}, Lg3/n;->p(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Landroid/content/Context;->getDatabasePath(Ljava/lang/String;)Ljava/io/File;

    move-result-object p1

    iput-object p1, p0, Lg3/n;->r:Ljava/io/File;

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

    return-void
.end method

.method public static e(Ljava/lang/RuntimeException;)V
    .registers 3

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

    move-result-object v0

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

    move-result v1

    if-nez v1, :cond_18

    const-string v1, "Cursor window allocation of"

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

    move-result v1

    if-eqz v1, :cond_18

    new-instance p0, Lg3/m;

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

    throw p0

    :cond_18
    throw p0
.end method

.method public static declared-synchronized o(Landroid/content/Context;Ljava/lang/String;)Lg3/n;
    .registers 5

    const-class v0, Lg3/n;

    monitor-enter v0

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

    move-result-object p1

    sget-object v1, Lg3/n;->u:Ljava/util/Map;

    move-object v2, v1

    check-cast v2, Ljava/util/HashMap;

    invoke-virtual {v2, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lg3/n;

    if-nez v2, :cond_22

    new-instance v2, Lg3/n;

    invoke-virtual {p0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object p0

    invoke-direct {v2, p0, p1}, Lg3/n;-><init>(Landroid/content/Context;Ljava/lang/String;)V

    check-cast v1, Ljava/util/HashMap;

    invoke-virtual {v1, p1, v2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_22
    .catchall {:try_start_3 .. :try_end_22} :catchall_24

    :cond_22
    monitor-exit v0

    return-object v2

    :catchall_24
    move-exception p0

    monitor-exit v0

    throw p0
.end method

.method public static p(Ljava/lang/String;)Ljava/lang/String;
    .registers 2

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

    move-result v0

    if-nez v0, :cond_16

    const-string v0, "$default_instance"

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

    move-result v0

    if-eqz v0, :cond_f

    goto :goto_16

    :cond_f
    const-string v0, "com.amplitude.api_"

    invoke-static {v0, p0}, Le/a;->a(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object p0

    goto :goto_18

    :cond_16
    :goto_16
    const-string p0, "com.amplitude.api"

    :goto_18
    return-object p0
.end method


# virtual methods
.method public final declared-synchronized H(Ljava/lang/String;)J
    .registers 10

    monitor-enter p0

    const/4 v0, 0x0

    const/4 v1, 0x1

    const/4 v2, 0x0

    :try_start_4
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->getReadableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v3

    new-instance v4, Ljava/lang/StringBuilder;

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

    const-string v5, "SELECT COUNT(*) FROM "

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

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

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

    move-result-object v4

    invoke-virtual {v3, v4}, Landroid/database/sqlite/SQLiteDatabase;->compileStatement(Ljava/lang/String;)Landroid/database/sqlite/SQLiteStatement;

    move-result-object v2

    invoke-virtual {v2}, Landroid/database/sqlite/SQLiteStatement;->simpleQueryForLong()J

    move-result-wide v0
    :try_end_21
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_4 .. :try_end_21} :catch_59
    .catch Ljava/lang/StackOverflowError; {:try_start_4 .. :try_end_21} :catch_2a
    .catchall {:try_start_4 .. :try_end_21} :catchall_28

    :try_start_21
    invoke-virtual {v2}, Landroid/database/sqlite/SQLiteStatement;->close()V

    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V
    :try_end_27
    .catchall {:try_start_21 .. :try_end_27} :catchall_95

    goto :goto_8a

    :catchall_28
    move-exception p1

    goto :goto_8c

    :catch_2a
    move-exception v3

    :try_start_2b
    sget-object v4, Lg3/n;->v:Lg3/l;

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

    const-string v6, "getNumberRows for %s failed"

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

    aput-object p1, v7, v0

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

    move-result-object v6

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

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

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

    move-result-object v4

    const-string v5, "DB: Failed to getNumberRows for table %s"

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

    aput-object p1, v1, v0

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

    move-result-object p1

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

    invoke-virtual {p0}, Lg3/n;->g()V
    :try_end_53
    .catchall {:try_start_2b .. :try_end_53} :catchall_28

    if-eqz v2, :cond_85

    :goto_55
    :try_start_55
    invoke-virtual {v2}, Landroid/database/sqlite/SQLiteStatement;->close()V
    :try_end_58
    .catchall {:try_start_55 .. :try_end_58} :catchall_95

    goto :goto_85

    :catch_59
    move-exception v3

    :try_start_5a
    sget-object v4, Lg3/n;->v:Lg3/l;

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

    const-string v6, "getNumberRows for %s failed"

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

    aput-object p1, v7, v0

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

    move-result-object v6

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

    .line 3
    invoke-static {v5, v6, v3}, 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 v4

    const-string v5, "DB: Failed to getNumberRows for table %s"

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

    aput-object p1, v1, v0

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

    move-result-object p1

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

    invoke-virtual {p0}, Lg3/n;->g()V
    :try_end_82
    .catchall {:try_start_5a .. :try_end_82} :catchall_28

    if-eqz v2, :cond_85

    goto :goto_55

    :cond_85
    :goto_85
    :try_start_85
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V
    :try_end_88
    .catchall {:try_start_85 .. :try_end_88} :catchall_95

    const-wide/16 v0, 0x0

    :goto_8a
    monitor-exit p0

    return-wide v0

    :goto_8c
    if-eqz v2, :cond_91

    :try_start_8e
    invoke-virtual {v2}, Landroid/database/sqlite/SQLiteStatement;->close()V

    :cond_91
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    throw p1
    :try_end_95
    .catchall {:try_start_8e .. :try_end_95} :catchall_95

    :catchall_95
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public declared-synchronized I(Ljava/lang/String;JJ)Ljava/util/List;
    .registers 25
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            "JJ)",
            "Ljava/util/List<",
            "Lorg/json/JSONObject;",
            ">;"
        }
    .end annotation

    move-object/from16 v1, p0

    move-wide/from16 v2, p2

    move-wide/from16 v4, p4

    monitor-enter p0

    :try_start_7
    new-instance v11, Ljava/util/LinkedList;

    invoke-direct {v11}, Ljava/util/LinkedList;-><init>()V
    :try_end_c
    .catchall {:try_start_7 .. :try_end_c} :catchall_138

    const/4 v12, 0x0

    const/4 v13, 0x1

    const/4 v14, 0x0

    :try_start_f
    invoke-virtual/range {p0 .. p0}, Landroid/database/sqlite/SQLiteOpenHelper;->getReadableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v0

    const-string v6, "id"

    const-string v7, "event"

    filled-new-array {v6, v7}, [Ljava/lang/String;

    move-result-object v6

    const-wide/16 v7, 0x0

    cmp-long v9, v2, v7

    if-ltz v9, :cond_34

    new-instance v9, Ljava/lang/StringBuilder;

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

    const-string v10, "id <= "

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

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

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

    move-result-object v2

    move-object v9, v2

    goto :goto_35

    :cond_34
    move-object v9, v14

    :goto_35
    const/4 v10, 0x0

    const/4 v15, 0x0

    const/16 v16, 0x0

    const-string v17, "id ASC"

    cmp-long v2, v4, v7

    if-ltz v2, :cond_53

    new-instance v2, Ljava/lang/StringBuilder;

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

    const-string v3, ""

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

    invoke-virtual {v2, v4, v5}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

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

    move-result-object v2

    move-object/from16 v18, v2

    goto :goto_55

    :cond_53
    move-object/from16 v18, v14

    :goto_55
    move-object v2, v0

    move-object/from16 v3, p1

    move-object v4, v6

    move-object v5, v9

    move-object v6, v10

    move-object v7, v15

    move-object/from16 v8, v16

    move-object/from16 v9, v17

    move-object/from16 v10, v18

    .line 1
    invoke-virtual/range {v2 .. v10}, Landroid/database/sqlite/SQLiteDatabase;->query(Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v2
    :try_end_66
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_f .. :try_end_66} :catch_fd
    .catch Ljava/lang/StackOverflowError; {:try_start_f .. :try_end_66} :catch_d1
    .catch Ljava/lang/IllegalStateException; {:try_start_f .. :try_end_66} :catch_b6
    .catch Ljava/lang/RuntimeException; {:try_start_f .. :try_end_66} :catch_9c
    .catchall {:try_start_f .. :try_end_66} :catchall_99

    .line 2
    :goto_66
    :try_start_66
    invoke-interface {v2}, Landroid/database/Cursor;->moveToNext()Z

    move-result v0

    if-eqz v0, :cond_89

    invoke-interface {v2, v12}, Landroid/database/Cursor;->getLong(I)J

    move-result-wide v3

    invoke-interface {v2, v13}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v0

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

    move-result v5

    if-eqz v5, :cond_7b

    goto :goto_66

    :cond_7b
    new-instance v5, Lorg/json/JSONObject;

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

    const-string v0, "event_id"

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

    invoke-virtual {v11, v5}, Ljava/util/LinkedList;->add(Ljava/lang/Object;)Z
    :try_end_88
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_66 .. :try_end_88} :catch_96
    .catch Ljava/lang/StackOverflowError; {:try_start_66 .. :try_end_88} :catch_93
    .catch Ljava/lang/IllegalStateException; {:try_start_66 .. :try_end_88} :catch_90
    .catch Ljava/lang/RuntimeException; {:try_start_66 .. :try_end_88} :catch_8e
    .catchall {:try_start_66 .. :try_end_88} :catchall_b3

    goto :goto_66

    :cond_89
    :try_start_89
    invoke-interface {v2}, Landroid/database/Cursor;->close()V
    :try_end_8c
    .catchall {:try_start_89 .. :try_end_8c} :catchall_138

    goto/16 :goto_129

    :catch_8e
    move-exception v0

    goto :goto_9e

    :catch_90
    move-exception v0

    move-object v14, v2

    goto :goto_b7

    :catch_93
    move-exception v0

    move-object v14, v2

    goto :goto_d2

    :catch_96
    move-exception v0

    move-object v14, v2

    goto :goto_fe

    :catchall_99
    move-exception v0

    goto/16 :goto_12e

    :catch_9c
    move-exception v0

    move-object v2, v14

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

    move-result-object v3

    const-string v4, "DB: Failed to getEventsFromTable %s"

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

    aput-object p1, v5, v12

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

    move-result-object v4

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

    invoke-static {v0}, Lg3/n;->e(Ljava/lang/RuntimeException;)V

    throw v14
    :try_end_b3
    .catchall {:try_start_9e .. :try_end_b3} :catchall_b3

    :catchall_b3
    move-exception v0

    goto/16 :goto_12f

    :catch_b6
    move-exception v0

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

    move-result-object v2

    const-string v3, "DB: Failed to getEventsFromTable %s"

    new-array v4, v13, [Ljava/lang/Object;

    aput-object p1, v4, v12

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

    move-result-object v3

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

    invoke-virtual {v1, v0}, Lg3/n;->Y(Ljava/lang/IllegalStateException;)V
    :try_end_cb
    .catchall {:try_start_b7 .. :try_end_cb} :catchall_99

    if-eqz v14, :cond_129

    :goto_cd
    :try_start_cd
    invoke-interface {v14}, Landroid/database/Cursor;->close()V
    :try_end_d0
    .catchall {:try_start_cd .. :try_end_d0} :catchall_138

    goto :goto_129

    :catch_d1
    move-exception v0

    :goto_d2
    :try_start_d2
    sget-object v2, Lg3/n;->v:Lg3/l;

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

    const-string v4, "getEvents from %s failed"

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

    aput-object p1, v5, v12

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

    move-result-object v4

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

    .line 3
    invoke-static {v3, v4, v0}, 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 v2

    const-string v3, "DB: Failed to getEventsFromTable %s"

    new-array v4, v13, [Ljava/lang/Object;

    aput-object p1, v4, v12

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

    move-result-object v3

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

    invoke-virtual/range {p0 .. p0}, Lg3/n;->g()V

    if-eqz v14, :cond_129

    goto :goto_cd

    :catch_fd
    move-exception v0

    :goto_fe
    sget-object v2, Lg3/n;->v:Lg3/l;

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

    const-string v4, "getEvents from %s failed"

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

    aput-object p1, v5, v12

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

    move-result-object v4

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

    .line 5
    invoke-static {v3, v4, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

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

    move-result-object v2

    const-string v3, "DB: Failed to getEventsFromTable %s"

    new-array v4, v13, [Ljava/lang/Object;

    aput-object p1, v4, v12

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

    move-result-object v3

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

    invoke-virtual/range {p0 .. p0}, Lg3/n;->g()V
    :try_end_126
    .catchall {:try_start_d2 .. :try_end_126} :catchall_99

    if-eqz v14, :cond_129

    goto :goto_cd

    :cond_129
    :goto_129
    :try_start_129
    invoke-virtual/range {p0 .. p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V
    :try_end_12c
    .catchall {:try_start_129 .. :try_end_12c} :catchall_138

    monitor-exit p0

    return-object v11

    :goto_12e
    move-object v2, v14

    :goto_12f
    if-eqz v2, :cond_134

    :try_start_131
    invoke-interface {v2}, Landroid/database/Cursor;->close()V

    :cond_134
    invoke-virtual/range {p0 .. p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    throw v0
    :try_end_138
    .catchall {:try_start_131 .. :try_end_138} :catchall_138

    :catchall_138
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized K(Ljava/lang/String;)Ljava/lang/Long;
    .registers 3

    monitor-enter p0

    :try_start_1
    const-string v0, "long_store"

    invoke-virtual {p0, v0, p1}, Lg3/n;->W(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/Long;
    :try_end_9
    .catchall {:try_start_1 .. :try_end_9} :catchall_b

    monitor-exit p0

    return-object p1

    :catchall_b
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public final declared-synchronized L(Ljava/lang/String;J)J
    .registers 13

    monitor-enter p0

    const-wide/16 v0, -0x1

    const/4 v2, 0x0

    const/4 v3, 0x1

    const/4 v4, 0x0

    :try_start_6
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->getReadableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v5

    new-instance v6, Ljava/lang/StringBuilder;

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

    const-string v7, "SELECT id FROM "

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

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

    const-string v7, " LIMIT 1 OFFSET "

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

    const-wide/16 v7, 0x1

    sub-long/2addr p2, v7

    invoke-virtual {v6, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

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

    move-result-object p2

    invoke-virtual {v5, p2}, Landroid/database/sqlite/SQLiteDatabase;->compileStatement(Ljava/lang/String;)Landroid/database/sqlite/SQLiteStatement;

    move-result-object v4
    :try_end_2a
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_6 .. :try_end_2a} :catch_6e
    .catch Ljava/lang/StackOverflowError; {:try_start_6 .. :try_end_2a} :catch_42
    .catchall {:try_start_6 .. :try_end_2a} :catchall_40

    :try_start_2a
    invoke-virtual {v4}, Landroid/database/sqlite/SQLiteStatement;->simpleQueryForLong()J

    move-result-wide v0
    :try_end_2e
    .catch Landroid/database/sqlite/SQLiteDoneException; {:try_start_2a .. :try_end_2e} :catch_2f
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_2a .. :try_end_2e} :catch_6e
    .catch Ljava/lang/StackOverflowError; {:try_start_2a .. :try_end_2e} :catch_42
    .catchall {:try_start_2a .. :try_end_2e} :catchall_40

    goto :goto_3a

    :catch_2f
    move-exception p2

    :try_start_30
    sget-object p3, Lg3/n;->v:Lg3/l;

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

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

    .line 1
    invoke-static {v5, p2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_3a
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_30 .. :try_end_3a} :catch_6e
    .catch Ljava/lang/StackOverflowError; {:try_start_30 .. :try_end_3a} :catch_42
    .catchall {:try_start_30 .. :try_end_3a} :catchall_40

    :goto_3a
    if-eqz v4, :cond_9a

    .line 2
    :goto_3c
    :try_start_3c
    invoke-virtual {v4}, Landroid/database/sqlite/SQLiteStatement;->close()V
    :try_end_3f
    .catchall {:try_start_3c .. :try_end_3f} :catchall_a8

    goto :goto_9a

    :catchall_40
    move-exception p1

    goto :goto_9f

    :catch_42
    move-exception p2

    :try_start_43
    sget-object p3, Lg3/n;->v:Lg3/l;

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

    const-string v6, "getNthEventId from %s failed"

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

    aput-object p1, v7, v2

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

    move-result-object v6

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

    .line 3
    invoke-static {v5, v6, p2}, 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 p3

    const-string v5, "DB: Failed to getNthEventId from table %s"

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

    aput-object p1, v3, v2

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

    move-result-object p1

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

    invoke-virtual {p0}, Lg3/n;->g()V

    if-eqz v4, :cond_9a

    goto :goto_3c

    :catch_6e
    move-exception p2

    sget-object p3, Lg3/n;->v:Lg3/l;

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

    const-string v6, "getNthEventId from %s failed"

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

    aput-object p1, v7, v2

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

    move-result-object v6

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

    .line 5
    invoke-static {v5, v6, p2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

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

    move-result-object p3

    const-string v5, "DB: Failed to getNthEventId from table %s"

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

    aput-object p1, v3, v2

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

    move-result-object p1

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

    invoke-virtual {p0}, Lg3/n;->g()V
    :try_end_97
    .catchall {:try_start_43 .. :try_end_97} :catchall_40

    if-eqz v4, :cond_9a

    goto :goto_3c

    :cond_9a
    :goto_9a
    :try_start_9a
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V
    :try_end_9d
    .catchall {:try_start_9a .. :try_end_9d} :catchall_a8

    monitor-exit p0

    return-wide v0

    :goto_9f
    if-eqz v4, :cond_a4

    :try_start_a1
    invoke-virtual {v4}, Landroid/database/sqlite/SQLiteStatement;->close()V

    :cond_a4
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    throw p1
    :try_end_a8
    .catchall {:try_start_a1 .. :try_end_a8} :catchall_a8

    :catchall_a8
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public declared-synchronized P(J)J
    .registers 4

    monitor-enter p0

    :try_start_1
    const-string v0, "identifys"

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

    move-result-wide p1
    :try_end_7
    .catchall {:try_start_1 .. :try_end_7} :catchall_9

    monitor-exit p0

    return-wide p1

    :catchall_9
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public declared-synchronized Q()J
    .registers 5

    monitor-enter p0

    :try_start_1
    invoke-virtual {p0}, Lg3/n;->q()J

    move-result-wide v0

    .line 1
    monitor-enter p0
    :try_end_6
    .catchall {:try_start_1 .. :try_end_6} :catchall_13

    :try_start_6
    const-string v2, "identifys"

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

    move-result-wide v2
    :try_end_c
    .catchall {:try_start_6 .. :try_end_c} :catchall_10

    :try_start_c
    monitor-exit p0
    :try_end_d
    .catchall {:try_start_c .. :try_end_d} :catchall_13

    add-long/2addr v0, v2

    .line 2
    monitor-exit p0

    return-wide v0

    :catchall_10
    move-exception v0

    .line 3
    :try_start_11
    monitor-exit p0

    throw v0
    :try_end_13
    .catchall {:try_start_11 .. :try_end_13} :catchall_13

    :catchall_13
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized T(Ljava/lang/String;)Ljava/lang/String;
    .registers 3

    monitor-enter p0

    :try_start_1
    const-string v0, "store"

    invoke-virtual {p0, v0, p1}, Lg3/n;->W(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/String;
    :try_end_9
    .catchall {:try_start_1 .. :try_end_9} :catchall_b

    monitor-exit p0

    return-object p1

    :catchall_b
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public declared-synchronized W(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
    .registers 15

    monitor-enter p0

    const/4 v0, 0x0

    const/4 v1, 0x0

    const/4 v2, 0x1

    :try_start_4
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->getReadableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v3

    const-string v4, "key"

    const-string v5, "value"

    filled-new-array {v4, v5}, [Ljava/lang/String;

    move-result-object v5

    const-string v6, "key = ?"

    new-array v7, v2, [Ljava/lang/String;

    aput-object p2, v7, v1

    const/4 v8, 0x0

    const/4 v9, 0x0

    const/4 v10, 0x0

    const/4 v11, 0x0

    move-object v4, p1

    .line 1
    invoke-virtual/range {v3 .. v11}, Landroid/database/sqlite/SQLiteDatabase;->query(Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v3
    :try_end_1f
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_4 .. :try_end_1f} :catch_a9
    .catch Ljava/lang/StackOverflowError; {:try_start_4 .. :try_end_1f} :catch_7b
    .catch Ljava/lang/IllegalStateException; {:try_start_4 .. :try_end_1f} :catch_62
    .catch Ljava/lang/RuntimeException; {:try_start_4 .. :try_end_1f} :catch_4b
    .catchall {:try_start_4 .. :try_end_1f} :catchall_48

    .line 2
    :try_start_1f
    invoke-interface {v3}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v4

    if-eqz v4, :cond_3b

    const-string v4, "store"

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

    move-result v4

    if-eqz v4, :cond_32

    invoke-interface {v3, v2}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object p1

    goto :goto_3a

    :cond_32
    invoke-interface {v3, v2}, Landroid/database/Cursor;->getLong(I)J

    move-result-wide v4

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

    move-result-object p1
    :try_end_3a
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_1f .. :try_end_3a} :catch_46
    .catch Ljava/lang/StackOverflowError; {:try_start_1f .. :try_end_3a} :catch_44
    .catch Ljava/lang/IllegalStateException; {:try_start_1f .. :try_end_3a} :catch_42
    .catch Ljava/lang/RuntimeException; {:try_start_1f .. :try_end_3a} :catch_40
    .catchall {:try_start_1f .. :try_end_3a} :catchall_dd

    :goto_3a
    move-object v0, p1

    :cond_3b
    :goto_3b
    :try_start_3b
    invoke-interface {v3}, Landroid/database/Cursor;->close()V
    :try_end_3e
    .catchall {:try_start_3b .. :try_end_3e} :catchall_e8

    goto/16 :goto_d8

    :catch_40
    move-exception p1

    goto :goto_4d

    :catch_42
    move-exception p1

    goto :goto_64

    :catch_44
    move-exception v4

    goto :goto_7e

    :catch_46
    move-exception v4

    goto :goto_ac

    :catchall_48
    move-exception p1

    goto/16 :goto_df

    :catch_4b
    move-exception p1

    move-object v3, v0

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

    move-result-object v4

    const-string v5, "DB: Failed to getValue: %s"

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

    aput-object p2, v2, v1

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

    move-result-object p2

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

    invoke-static {p1}, Lg3/n;->e(Ljava/lang/RuntimeException;)V

    throw v0

    :catch_62
    move-exception p1

    move-object v3, v0

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

    move-result-object v4

    const-string v5, "DB: Failed to getValue: %s"

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

    aput-object p2, v2, v1

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

    move-result-object p2

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

    invoke-virtual {p0, p1}, Lg3/n;->Y(Ljava/lang/IllegalStateException;)V

    if-eqz v3, :cond_d8

    goto :goto_3b

    :catch_7b
    move-exception v3

    move-object v4, v3

    move-object v3, v0

    :goto_7e
    sget-object v5, Lg3/n;->v:Lg3/l;

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

    const-string v7, "getValue from %s failed"

    new-array v8, v2, [Ljava/lang/Object;

    aput-object p1, v8, v1

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

    move-result-object p1

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

    .line 3
    invoke-static {v6, p1, v4}, 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 p1

    const-string v5, "DB: Failed to getValue: %s"

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

    aput-object p2, v2, v1

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

    move-result-object p2

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

    invoke-virtual {p0}, Lg3/n;->g()V

    if-eqz v3, :cond_d8

    goto :goto_3b

    :catch_a9
    move-exception v3

    move-object v4, v3

    move-object v3, v0

    :goto_ac
    sget-object v5, Lg3/n;->v:Lg3/l;

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

    const-string v7, "getValue from %s failed"

    new-array v8, v2, [Ljava/lang/Object;

    aput-object p1, v8, v1

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

    move-result-object p1

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

    .line 5
    invoke-static {v6, p1, v4}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

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

    move-result-object p1

    const-string v5, "DB: Failed to getValue: %s"

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

    aput-object p2, v2, v1

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

    move-result-object p2

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

    invoke-virtual {p0}, Lg3/n;->g()V
    :try_end_d4
    .catchall {:try_start_4d .. :try_end_d4} :catchall_dd

    if-eqz v3, :cond_d8

    goto/16 :goto_3b

    :cond_d8
    :goto_d8
    :try_start_d8
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V
    :try_end_db
    .catchall {:try_start_d8 .. :try_end_db} :catchall_e8

    monitor-exit p0

    return-object v0

    :catchall_dd
    move-exception p1

    move-object v0, v3

    :goto_df
    if-eqz v0, :cond_e4

    :try_start_e1
    invoke-interface {v0}, Landroid/database/Cursor;->close()V

    :cond_e4
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    throw p1
    :try_end_e8
    .catchall {:try_start_e1 .. :try_end_e8} :catchall_e8

    :catchall_e8
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public final Y(Ljava/lang/IllegalStateException;)V
    .registers 4

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

    move-result-object v0

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

    move-result v1

    if-nez v1, :cond_1e

    const-string v1, "Couldn\'t read"

    invoke-virtual {v0, v1}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_1e

    const-string v1, "CursorWindow"

    invoke-virtual {v0, v1}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_1e

    invoke-virtual {p0}, Lg3/n;->g()V

    return-void

    :cond_1e
    throw p1
.end method

.method public declared-synchronized Z(Landroid/database/sqlite/SQLiteDatabase;Ljava/lang/String;Landroid/content/ContentValues;)J
    .registers 5

    monitor-enter p0

    const/4 v0, 0x0

    :try_start_2
    invoke-virtual {p1, p2, v0, p3}, Landroid/database/sqlite/SQLiteDatabase;->insert(Ljava/lang/String;Ljava/lang/String;Landroid/content/ContentValues;)J

    move-result-wide p1
    :try_end_6
    .catchall {:try_start_2 .. :try_end_6} :catchall_8

    monitor-exit p0

    return-wide p1

    :catchall_8
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public declared-synchronized a0(Ljava/lang/String;Ljava/lang/Long;)J
    .registers 4

    monitor-enter p0

    if-nez p2, :cond_a

    :try_start_3
    const-string p2, "long_store"

    invoke-virtual {p0, p2, p1}, Lg3/n;->k(Ljava/lang/String;Ljava/lang/String;)J

    move-result-wide p1

    goto :goto_10

    :cond_a
    const-string v0, "long_store"

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

    move-result-wide p1
    :try_end_10
    .catchall {:try_start_3 .. :try_end_10} :catchall_12

    :goto_10
    monitor-exit p0

    return-wide p1

    :catchall_12
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public final declared-synchronized b(Ljava/lang/String;Ljava/lang/String;)J
    .registers 14

    monitor-enter p0

    const-wide/16 v0, -0x1

    const/4 v2, 0x0

    const/4 v3, 0x1

    :try_start_5
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v4

    new-instance v5, Landroid/content/ContentValues;

    invoke-direct {v5}, Landroid/content/ContentValues;-><init>()V

    const-string v6, "event"

    invoke-virtual {v5, v6, p2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    invoke-virtual {p0, v4, p1, v5}, Lg3/n;->Z(Landroid/database/sqlite/SQLiteDatabase;Ljava/lang/String;Landroid/content/ContentValues;)J

    move-result-wide v4
    :try_end_17
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_5 .. :try_end_17} :catch_63
    .catch Ljava/lang/StackOverflowError; {:try_start_5 .. :try_end_17} :catch_36
    .catchall {:try_start_5 .. :try_end_17} :catchall_34

    cmp-long v0, v4, v0

    if-nez v0, :cond_8d

    :try_start_1b
    sget-object v0, Lg3/n;->v:Lg3/l;

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

    const-string v6, "Insert into %s failed"

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

    aput-object p1, v7, v2

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

    move-result-object v6

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

    .line 1
    invoke-static {v1, v6}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_2f
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_1b .. :try_end_2f} :catch_32
    .catch Ljava/lang/StackOverflowError; {:try_start_1b .. :try_end_2f} :catch_30
    .catchall {:try_start_1b .. :try_end_2f} :catchall_34

    goto :goto_8d

    :catch_30
    move-exception v0

    goto :goto_3a

    :catch_32
    move-exception v0

    goto :goto_67

    :catchall_34
    move-exception p1

    goto :goto_92

    :catch_36
    move-exception v4

    move-wide v9, v0

    move-object v0, v4

    move-wide v4, v9

    .line 2
    :goto_3a
    :try_start_3a
    sget-object v1, Lg3/n;->v:Lg3/l;

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

    const-string v7, "addEvent to %s failed"

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

    aput-object p1, v8, v2

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

    move-result-object p1

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

    .line 3
    invoke-static {v6, p1, v0}, 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 p1

    const-string v1, "DB: Failed to addEvent: %s"

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

    aput-object p2, v3, v2

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

    move-result-object p2

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

    :goto_5f
    invoke-virtual {p0}, Lg3/n;->g()V

    goto :goto_8d

    :catch_63
    move-exception v4

    move-wide v9, v0

    move-object v0, v4

    move-wide v4, v9

    :goto_67
    sget-object v1, Lg3/n;->v:Lg3/l;

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

    const-string v7, "addEvent to %s failed"

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

    aput-object p1, v8, v2

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

    move-result-object p1

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

    .line 5
    invoke-static {v6, p1, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

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

    move-result-object p1

    const-string v1, "DB: Failed to addEvent: %s"

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

    aput-object p2, v3, v2

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

    move-result-object p2

    invoke-virtual {p1, p2, v0}, Lg3/q;->b(Ljava/lang/String;Ljava/lang/Throwable;)Lg3/q;
    :try_end_8c
    .catchall {:try_start_3a .. :try_end_8c} :catchall_34

    goto :goto_5f

    :cond_8d
    :goto_8d
    :try_start_8d
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V
    :try_end_90
    .catchall {:try_start_8d .. :try_end_90} :catchall_96

    monitor-exit p0

    return-wide v4

    :goto_92
    :try_start_92
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    throw p1
    :try_end_96
    .catchall {:try_start_92 .. :try_end_96} :catchall_96

    :catchall_96
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public declared-synchronized b0(Ljava/lang/String;Ljava/lang/String;)J
    .registers 4

    monitor-enter p0

    if-nez p2, :cond_a

    :try_start_3
    const-string p2, "store"

    invoke-virtual {p0, p2, p1}, Lg3/n;->k(Ljava/lang/String;Ljava/lang/String;)J

    move-result-wide p1

    goto :goto_10

    :cond_a
    const-string v0, "store"

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

    move-result-wide p1
    :try_end_10
    .catchall {:try_start_3 .. :try_end_10} :catchall_12

    :goto_10
    monitor-exit p0

    return-wide p1

    :catchall_12
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public declared-synchronized c0(Landroid/database/sqlite/SQLiteDatabase;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)J
    .registers 7

    monitor-enter p0

    :try_start_1
    new-instance v0, Landroid/content/ContentValues;

    invoke-direct {v0}, Landroid/content/ContentValues;-><init>()V

    const-string v1, "key"

    invoke-virtual {v0, v1, p3}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    instance-of p3, p4, Ljava/lang/Long;

    if-eqz p3, :cond_17

    const-string p3, "value"

    check-cast p4, Ljava/lang/Long;

    invoke-virtual {v0, p3, p4}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Long;)V

    goto :goto_1e

    :cond_17
    const-string p3, "value"

    check-cast p4, Ljava/lang/String;

    invoke-virtual {v0, p3, p4}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 1
    :goto_1e
    monitor-enter p0
    :try_end_1f
    .catchall {:try_start_1 .. :try_end_1f} :catchall_3d

    const/4 p3, 0x0

    const/4 p4, 0x5

    :try_start_21
    invoke-virtual {p1, p2, p3, v0, p4}, Landroid/database/sqlite/SQLiteDatabase;->insertWithOnConflict(Ljava/lang/String;Ljava/lang/String;Landroid/content/ContentValues;I)J

    move-result-wide p1
    :try_end_25
    .catchall {:try_start_21 .. :try_end_25} :catchall_3a

    :try_start_25
    monitor-exit p0

    const-wide/16 p3, -0x1

    cmp-long p3, p1, p3

    if-nez p3, :cond_38

    .line 2
    sget-object p3, Lg3/n;->v:Lg3/l;

    const-string p4, "com.amplitude.api.DatabaseHelper"

    const-string v0, "Insert failed"

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

    .line 3
    invoke-static {p4, v0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_38
    .catchall {:try_start_25 .. :try_end_38} :catchall_3d

    .line 4
    :cond_38
    monitor-exit p0

    return-wide p1

    :catchall_3a
    move-exception p1

    .line 5
    :try_start_3b
    monitor-exit p0

    throw p1
    :try_end_3d
    .catchall {:try_start_3b .. :try_end_3d} :catchall_3d

    :catchall_3d
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public declared-synchronized d0(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)J
    .registers 11

    monitor-enter p0

    const/4 v0, 0x0

    const/4 v1, 0x1

    const/4 v2, 0x0

    :try_start_4
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v2

    invoke-virtual {p0, v2, p1, p2, p3}, Lg3/n;->c0(Landroid/database/sqlite/SQLiteDatabase;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)J

    move-result-wide p1
    :try_end_c
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_4 .. :try_end_c} :catch_4d
    .catch Ljava/lang/StackOverflowError; {:try_start_4 .. :try_end_c} :catch_1b
    .catchall {:try_start_4 .. :try_end_c} :catchall_19

    :try_start_c
    invoke-virtual {v2}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result p3

    if-eqz p3, :cond_83

    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V
    :try_end_15
    .catchall {:try_start_c .. :try_end_15} :catchall_16

    goto :goto_83

    :catchall_16
    move-exception p1

    goto/16 :goto_91

    :catchall_19
    move-exception p1

    goto :goto_85

    :catch_1b
    move-exception p3

    :try_start_1c
    sget-object v3, Lg3/n;->v:Lg3/l;

    const-string v4, "com.amplitude.api.DatabaseHelper"

    const-string v5, "insertOrReplaceKeyValue in %s failed"

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

    aput-object p1, v6, v0

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

    move-result-object p1

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

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

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

    move-result-object p1

    const-string v3, "DB: Failed to insertOrReplaceKeyValue %s"

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

    aput-object p2, v1, v0

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

    move-result-object p2

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

    invoke-virtual {p0}, Lg3/n;->g()V
    :try_end_44
    .catchall {:try_start_1c .. :try_end_44} :catchall_19

    if-eqz v2, :cond_81

    :try_start_46
    invoke-virtual {v2}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result p1
    :try_end_4a
    .catchall {:try_start_46 .. :try_end_4a} :catchall_16

    if-eqz p1, :cond_81

    goto :goto_7e

    :catch_4d
    move-exception p3

    :try_start_4e
    sget-object v3, Lg3/n;->v:Lg3/l;

    const-string v4, "com.amplitude.api.DatabaseHelper"

    const-string v5, "insertOrReplaceKeyValue in %s failed"

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

    aput-object p1, v6, v0

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

    move-result-object p1

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

    .line 3
    invoke-static {v4, p1, p3}, 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 p1

    const-string v3, "DB: Failed to insertOrReplaceKeyValue %s"

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

    aput-object p2, v1, v0

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

    move-result-object p2

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

    invoke-virtual {p0}, Lg3/n;->g()V
    :try_end_76
    .catchall {:try_start_4e .. :try_end_76} :catchall_19

    if-eqz v2, :cond_81

    :try_start_78
    invoke-virtual {v2}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result p1

    if-eqz p1, :cond_81

    :goto_7e
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V
    :try_end_81
    .catchall {:try_start_78 .. :try_end_81} :catchall_16

    :cond_81
    const-wide/16 p1, -0x1

    :cond_83
    :goto_83
    monitor-exit p0

    return-wide p1

    :goto_85
    if-eqz v2, :cond_90

    :try_start_87
    invoke-virtual {v2}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result p2

    if-eqz p2, :cond_90

    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    :cond_90
    throw p1
    :try_end_91
    .catchall {:try_start_87 .. :try_end_91} :catchall_16

    :goto_91
    monitor-exit p0

    throw p1
.end method

.method public declared-synchronized e0(J)V
    .registers 4

    monitor-enter p0

    :try_start_1
    const-string v0, "events"

    invoke-virtual {p0, v0, p1, p2}, Lg3/n;->f0(Ljava/lang/String;J)V
    :try_end_6
    .catchall {:try_start_1 .. :try_end_6} :catchall_8

    monitor-exit p0

    return-void

    :catchall_8
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public final declared-synchronized f0(Ljava/lang/String;J)V
    .registers 9

    monitor-enter p0

    const/4 v0, 0x0

    const/4 v1, 0x1

    :try_start_3
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v2

    new-instance v3, Ljava/lang/StringBuilder;

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

    const-string v4, "id = "

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

    invoke-virtual {v3, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

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

    move-result-object p2

    const/4 p3, 0x0

    invoke-virtual {v2, p1, p2, p3}, Landroid/database/sqlite/SQLiteDatabase;->delete(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)I
    :try_end_1c
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_3 .. :try_end_1c} :catch_49
    .catch Ljava/lang/StackOverflowError; {:try_start_3 .. :try_end_1c} :catch_1f
    .catchall {:try_start_3 .. :try_end_1c} :catchall_1d

    goto :goto_70

    :catchall_1d
    move-exception p1

    goto :goto_75

    :catch_1f
    move-exception p2

    :try_start_20
    sget-object p3, Lg3/n;->v:Lg3/l;

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

    const-string v3, "removeEvent from %s failed"

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

    aput-object p1, v4, v0

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

    move-result-object v3

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

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

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

    move-result-object p3

    const-string v2, "DB: Failed to removeEvent from table %s"

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

    aput-object p1, v1, v0

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

    move-result-object p1

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

    :goto_45
    invoke-virtual {p0}, Lg3/n;->g()V

    goto :goto_70

    :catch_49
    move-exception p2

    sget-object p3, Lg3/n;->v:Lg3/l;

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

    const-string v3, "removeEvent from %s failed"

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

    aput-object p1, v4, v0

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

    move-result-object v3

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

    .line 3
    invoke-static {v2, v3, p2}, 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 p3

    const-string v2, "DB: Failed to removeEvent from table %s"

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

    aput-object p1, v1, v0

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

    move-result-object p1

    invoke-virtual {p3, p1, p2}, Lg3/q;->b(Ljava/lang/String;Ljava/lang/Throwable;)Lg3/q;
    :try_end_6f
    .catchall {:try_start_20 .. :try_end_6f} :catchall_1d

    goto :goto_45

    .line 5
    :goto_70
    :try_start_70
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V
    :try_end_73
    .catchall {:try_start_70 .. :try_end_73} :catchall_79

    .line 6
    monitor-exit p0

    return-void

    :goto_75
    :try_start_75
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    throw p1
    :try_end_79
    .catchall {:try_start_75 .. :try_end_79} :catchall_79

    :catchall_79
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public final g()V
    .registers 11

    const-string v0, "DB: Failed to run databaseReset callback in delete"

    const-string v1, "databaseReset callback failed during delete"

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

    const/4 v3, 0x0

    const/4 v4, 0x1

    const/4 v5, 0x0

    :try_start_9
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    iget-object v6, p0, Lg3/n;->r:Ljava/io/File;

    invoke-virtual {v6}, Ljava/io/File;->delete()Z
    :try_end_11
    .catch Ljava/lang/SecurityException; {:try_start_9 .. :try_end_11} :catch_6c
    .catchall {:try_start_9 .. :try_end_11} :catchall_6a

    iget-object v6, p0, Lg3/n;->t:Lg3/o;

    if-eqz v6, :cond_d6

    iget-boolean v6, p0, Lg3/n;->s:Z

    if-eqz v6, :cond_d6

    iput-boolean v5, p0, Lg3/n;->s:Z

    :try_start_1b
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v3

    iget-object v6, p0, Lg3/n;->t:Lg3/o;

    check-cast v6, Lg3/c$a;

    invoke-virtual {v6, v3}, Lg3/c$a;->a(Landroid/database/sqlite/SQLiteDatabase;)V
    :try_end_26
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_1b .. :try_end_26} :catch_35
    .catchall {:try_start_1b .. :try_end_26} :catchall_33

    iput-boolean v4, p0, Lg3/n;->s:Z

    invoke-virtual {v3}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result v0

    if-eqz v0, :cond_d6

    :goto_2e
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    goto/16 :goto_d6

    :catchall_33
    move-exception v0

    goto :goto_5c

    :catch_35
    move-exception v6

    :try_start_36
    sget-object v7, Lg3/n;->v:Lg3/l;

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

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

    move-result-object v1

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

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

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

    move-result-object v1

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

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

    move-result-object v0

    invoke-virtual {v1, v0, v6}, Lg3/q;->b(Ljava/lang/String;Ljava/lang/Throwable;)Lg3/q;
    :try_end_51
    .catchall {:try_start_36 .. :try_end_51} :catchall_33

    iput-boolean v4, p0, Lg3/n;->s:Z

    if-eqz v3, :cond_d6

    invoke-virtual {v3}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result v0

    if-eqz v0, :cond_d6

    goto :goto_2e

    :goto_5c
    iput-boolean v4, p0, Lg3/n;->s:Z

    if-eqz v3, :cond_69

    invoke-virtual {v3}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result v1

    if-eqz v1, :cond_69

    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    :cond_69
    throw v0

    :catchall_6a
    move-exception v6

    goto :goto_d7

    :catch_6c
    move-exception v6

    :try_start_6d
    sget-object v7, Lg3/n;->v:Lg3/l;

    const-string v8, "delete failed"

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

    .line 3
    invoke-static {v2, v8, v6}, 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 v6

    const-string v7, "DB: Failed to delete database"

    .line 5
    invoke-virtual {v6, v7, v3}, Lg3/q;->b(Ljava/lang/String;Ljava/lang/Throwable;)Lg3/q;
    :try_end_80
    .catchall {:try_start_6d .. :try_end_80} :catchall_6a

    .line 6
    iget-object v6, p0, Lg3/n;->t:Lg3/o;

    if-eqz v6, :cond_d6

    iget-boolean v6, p0, Lg3/n;->s:Z

    if-eqz v6, :cond_d6

    iput-boolean v5, p0, Lg3/n;->s:Z

    :try_start_8a
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v3

    iget-object v6, p0, Lg3/n;->t:Lg3/o;

    check-cast v6, Lg3/c$a;

    invoke-virtual {v6, v3}, Lg3/c$a;->a(Landroid/database/sqlite/SQLiteDatabase;)V
    :try_end_95
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_8a .. :try_end_95} :catch_a0
    .catchall {:try_start_8a .. :try_end_95} :catchall_9e

    iput-boolean v4, p0, Lg3/n;->s:Z

    invoke-virtual {v3}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result v0

    if-eqz v0, :cond_d6

    goto :goto_2e

    :catchall_9e
    move-exception v0

    goto :goto_c8

    :catch_a0
    move-exception v6

    :try_start_a1
    sget-object v7, Lg3/n;->v:Lg3/l;

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

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

    move-result-object v1

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

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

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

    move-result-object v1

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

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

    move-result-object v0

    invoke-virtual {v1, v0, v6}, Lg3/q;->b(Ljava/lang/String;Ljava/lang/Throwable;)Lg3/q;
    :try_end_bc
    .catchall {:try_start_a1 .. :try_end_bc} :catchall_9e

    iput-boolean v4, p0, Lg3/n;->s:Z

    if-eqz v3, :cond_d6

    invoke-virtual {v3}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result v0

    if-eqz v0, :cond_d6

    goto/16 :goto_2e

    :goto_c8
    iput-boolean v4, p0, Lg3/n;->s:Z

    if-eqz v3, :cond_d5

    invoke-virtual {v3}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result v1

    if-eqz v1, :cond_d5

    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    :cond_d5
    throw v0

    :cond_d6
    :goto_d6
    return-void

    :goto_d7
    iget-object v7, p0, Lg3/n;->t:Lg3/o;

    if-eqz v7, :cond_12f

    iget-boolean v7, p0, Lg3/n;->s:Z

    if-eqz v7, :cond_12f

    iput-boolean v5, p0, Lg3/n;->s:Z

    :try_start_e1
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v3

    iget-object v7, p0, Lg3/n;->t:Lg3/o;

    check-cast v7, Lg3/c$a;

    invoke-virtual {v7, v3}, Lg3/c$a;->a(Landroid/database/sqlite/SQLiteDatabase;)V
    :try_end_ec
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_e1 .. :try_end_ec} :catch_fa
    .catchall {:try_start_e1 .. :try_end_ec} :catchall_f8

    iput-boolean v4, p0, Lg3/n;->s:Z

    invoke-virtual {v3}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result v0

    if-eqz v0, :cond_12f

    :goto_f4
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    goto :goto_12f

    :catchall_f8
    move-exception v0

    goto :goto_121

    :catch_fa
    move-exception v7

    :try_start_fb
    sget-object v8, Lg3/n;->v:Lg3/l;

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

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

    move-result-object v1

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

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

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

    move-result-object v1

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

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

    move-result-object v0

    invoke-virtual {v1, v0, v7}, Lg3/q;->b(Ljava/lang/String;Ljava/lang/Throwable;)Lg3/q;
    :try_end_116
    .catchall {:try_start_fb .. :try_end_116} :catchall_f8

    iput-boolean v4, p0, Lg3/n;->s:Z

    if-eqz v3, :cond_12f

    invoke-virtual {v3}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result v0

    if-eqz v0, :cond_12f

    goto :goto_f4

    :goto_121
    iput-boolean v4, p0, Lg3/n;->s:Z

    if-eqz v3, :cond_12e

    invoke-virtual {v3}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result v1

    if-eqz v1, :cond_12e

    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    :cond_12e
    throw v0

    :cond_12f
    :goto_12f
    throw v6
.end method

.method public final declared-synchronized g0(Ljava/lang/String;J)V
    .registers 9

    monitor-enter p0

    const/4 v0, 0x0

    const/4 v1, 0x1

    :try_start_3
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v2

    new-instance v3, Ljava/lang/StringBuilder;

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

    const-string v4, "id <= "

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

    invoke-virtual {v3, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

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

    move-result-object p2

    const/4 p3, 0x0

    invoke-virtual {v2, p1, p2, p3}, Landroid/database/sqlite/SQLiteDatabase;->delete(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)I
    :try_end_1c
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_3 .. :try_end_1c} :catch_49
    .catch Ljava/lang/StackOverflowError; {:try_start_3 .. :try_end_1c} :catch_1f
    .catchall {:try_start_3 .. :try_end_1c} :catchall_1d

    goto :goto_70

    :catchall_1d
    move-exception p1

    goto :goto_75

    :catch_1f
    move-exception p2

    :try_start_20
    sget-object p3, Lg3/n;->v:Lg3/l;

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

    const-string v3, "removeEvents from %s failed"

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

    aput-object p1, v4, v0

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

    move-result-object v3

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

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

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

    move-result-object p3

    const-string v2, "DB: Failed to removeEvents from table %s"

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

    aput-object p1, v1, v0

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

    move-result-object p1

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

    :goto_45
    invoke-virtual {p0}, Lg3/n;->g()V

    goto :goto_70

    :catch_49
    move-exception p2

    sget-object p3, Lg3/n;->v:Lg3/l;

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

    const-string v3, "removeEvents from %s failed"

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

    aput-object p1, v4, v0

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

    move-result-object v3

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

    .line 3
    invoke-static {v2, v3, p2}, 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 p3

    const-string v2, "DB: Failed to removeEvents from table %s"

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

    aput-object p1, v1, v0

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

    move-result-object p1

    invoke-virtual {p3, p1, p2}, Lg3/q;->b(Ljava/lang/String;Ljava/lang/Throwable;)Lg3/q;
    :try_end_6f
    .catchall {:try_start_20 .. :try_end_6f} :catchall_1d

    goto :goto_45

    .line 5
    :goto_70
    :try_start_70
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V
    :try_end_73
    .catchall {:try_start_70 .. :try_end_73} :catchall_79

    .line 6
    monitor-exit p0

    return-void

    :goto_75
    :try_start_75
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    throw p1
    :try_end_79
    .catchall {:try_start_75 .. :try_end_79} :catchall_79

    :catchall_79
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public declared-synchronized h0(J)V
    .registers 4

    monitor-enter p0

    :try_start_1
    const-string v0, "identifys"

    invoke-virtual {p0, v0, p1, p2}, Lg3/n;->f0(Ljava/lang/String;J)V
    :try_end_6
    .catchall {:try_start_1 .. :try_end_6} :catchall_8

    monitor-exit p0

    return-void

    :catchall_8
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public declared-synchronized i0(J)V
    .registers 4

    monitor-enter p0

    :try_start_1
    const-string v0, "identifys"

    invoke-virtual {p0, v0, p1, p2}, Lg3/n;->g0(Ljava/lang/String;J)V
    :try_end_6
    .catchall {:try_start_1 .. :try_end_6} :catchall_8

    monitor-exit p0

    return-void

    :catchall_8
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public declared-synchronized k(Ljava/lang/String;Ljava/lang/String;)J
    .registers 10

    monitor-enter p0

    const/4 v0, 0x0

    const/4 v1, 0x1

    :try_start_3
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v2

    const-string v3, "key=?"

    new-array v4, v1, [Ljava/lang/String;

    aput-object p2, v4, v0

    invoke-virtual {v2, p1, v3, v4}, Landroid/database/sqlite/SQLiteDatabase;->delete(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)I

    move-result p1
    :try_end_11
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_3 .. :try_end_11} :catch_42
    .catch Ljava/lang/StackOverflowError; {:try_start_3 .. :try_end_11} :catch_18
    .catchall {:try_start_3 .. :try_end_11} :catchall_16

    int-to-long p1, p1

    :try_start_12
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V
    :try_end_15
    .catchall {:try_start_12 .. :try_end_15} :catchall_74

    goto :goto_6e

    :catchall_16
    move-exception p1

    goto :goto_70

    :catch_18
    move-exception v2

    :try_start_19
    sget-object v3, Lg3/n;->v:Lg3/l;

    const-string v4, "com.amplitude.api.DatabaseHelper"

    const-string v5, "deleteKey from %s failed"

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

    aput-object p1, v6, v0

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

    move-result-object p1

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

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

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

    move-result-object p1

    const-string v3, "DB: Failed to deleteKey: %s"

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

    aput-object p2, v1, v0

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

    move-result-object p2

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

    :goto_3e
    invoke-virtual {p0}, Lg3/n;->g()V

    goto :goto_69

    :catch_42
    move-exception v2

    sget-object v3, Lg3/n;->v:Lg3/l;

    const-string v4, "com.amplitude.api.DatabaseHelper"

    const-string v5, "deleteKey from %s failed"

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

    aput-object p1, v6, v0

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

    move-result-object p1

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

    .line 3
    invoke-static {v4, p1, v2}, 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 p1

    const-string v3, "DB: Failed to deleteKey: %s"

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

    aput-object p2, v1, v0

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

    move-result-object p2

    invoke-virtual {p1, p2, v2}, Lg3/q;->b(Ljava/lang/String;Ljava/lang/Throwable;)Lg3/q;
    :try_end_68
    .catchall {:try_start_19 .. :try_end_68} :catchall_16

    goto :goto_3e

    :goto_69
    :try_start_69
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V
    :try_end_6c
    .catchall {:try_start_69 .. :try_end_6c} :catchall_74

    const-wide/16 p1, -0x1

    :goto_6e
    monitor-exit p0

    return-wide p1

    :goto_70
    :try_start_70
    invoke-virtual {p0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    throw p1
    :try_end_74
    .catchall {:try_start_70 .. :try_end_74} :catchall_74

    :catchall_74
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public onCreate(Landroid/database/sqlite/SQLiteDatabase;)V
    .registers 8

    const-string v0, "CREATE TABLE IF NOT EXISTS store (key TEXT PRIMARY KEY NOT NULL, value TEXT);"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    const-string v0, "CREATE TABLE IF NOT EXISTS long_store (key TEXT PRIMARY KEY NOT NULL, value INTEGER);"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    const-string v0, "CREATE TABLE IF NOT EXISTS events (id INTEGER PRIMARY KEY AUTOINCREMENT, event TEXT);"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    const-string v0, "CREATE TABLE IF NOT EXISTS identifys (id INTEGER PRIMARY KEY AUTOINCREMENT, event TEXT);"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    iget-object v0, p0, Lg3/n;->t:Lg3/o;

    if-eqz v0, :cond_50

    iget-boolean v1, p0, Lg3/n;->s:Z

    if-eqz v1, :cond_50

    const/4 v1, 0x1

    const/4 v2, 0x0

    :try_start_1e
    iput-boolean v2, p0, Lg3/n;->s:Z

    check-cast v0, Lg3/c$a;

    invoke-virtual {v0, p1}, Lg3/c$a;->a(Landroid/database/sqlite/SQLiteDatabase;)V
    :try_end_25
    .catch Landroid/database/sqlite/SQLiteException; {:try_start_1e .. :try_end_25} :catch_2a
    .catchall {:try_start_1e .. :try_end_25} :catchall_28

    :goto_25
    iput-boolean v1, p0, Lg3/n;->s:Z

    goto :goto_50

    :catchall_28
    move-exception p1

    goto :goto_4d

    :catch_2a
    move-exception p1

    :try_start_2b
    sget-object v0, Lg3/n;->v:Lg3/l;

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

    const-string v4, "databaseReset callback failed during onCreate"

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

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

    move-result-object v4

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

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

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

    move-result-object v0

    const-string v3, "DB: Failed to run databaseReset callback during onCreate"

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

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

    move-result-object v2

    invoke-virtual {v0, v2, p1}, Lg3/q;->b(Ljava/lang/String;Ljava/lang/Throwable;)Lg3/q;
    :try_end_4c
    .catchall {:try_start_2b .. :try_end_4c} :catchall_28

    goto :goto_25

    :goto_4d
    iput-boolean v1, p0, Lg3/n;->s:Z

    throw p1

    :cond_50
    :goto_50
    return-void
.end method

.method public onUpgrade(Landroid/database/sqlite/SQLiteDatabase;II)V
    .registers 11

    const-string v0, "DROP TABLE IF EXISTS identifys"

    const-string v1, "DROP TABLE IF EXISTS events"

    const-string v2, "DROP TABLE IF EXISTS long_store"

    const-string v3, "DROP TABLE IF EXISTS store"

    const-string v4, "com.amplitude.api.DatabaseHelper"

    if-le p2, p3, :cond_26

    sget-object p2, Lg3/n;->v:Lg3/l;

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

    const-string p2, "onUpgrade() with invalid oldVersion and newVersion"

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

    .line 2
    invoke-virtual {p1, v3}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    invoke-virtual {p1, v2}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    invoke-virtual {p0, p1}, Lg3/n;->onCreate(Landroid/database/sqlite/SQLiteDatabase;)V

    return-void

    :cond_26
    const/4 v5, 0x1

    if-gt p3, v5, :cond_2a

    return-void

    :cond_2a
    const/4 v6, 0x2

    if-eq p2, v5, :cond_5b

    if-eq p2, v6, :cond_63

    const/4 p3, 0x3

    if-eq p2, p3, :cond_6d

    .line 3
    sget-object p3, Lg3/n;->v:Lg3/l;

    new-instance v5, Ljava/lang/StringBuilder;

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

    const-string v6, "onUpgrade() with unknown oldVersion "

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

    invoke-virtual {v5, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

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

    move-result-object p2

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

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

    .line 5
    invoke-virtual {p1, v3}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    invoke-virtual {p1, v2}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    invoke-virtual {p0, p1}, Lg3/n;->onCreate(Landroid/database/sqlite/SQLiteDatabase;)V

    goto :goto_6d

    :cond_5b
    const-string p2, "CREATE TABLE IF NOT EXISTS store (key TEXT PRIMARY KEY NOT NULL, value TEXT);"

    .line 6
    invoke-virtual {p1, p2}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    if-gt p3, v6, :cond_63

    goto :goto_6d

    :cond_63
    const-string p2, "CREATE TABLE IF NOT EXISTS identifys (id INTEGER PRIMARY KEY AUTOINCREMENT, event TEXT);"

    invoke-virtual {p1, p2}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    const-string p2, "CREATE TABLE IF NOT EXISTS long_store (key TEXT PRIMARY KEY NOT NULL, value INTEGER);"

    invoke-virtual {p1, p2}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    :cond_6d
    :goto_6d
    return-void
.end method

.method public declared-synchronized q()J
    .registers 3

    monitor-enter p0

    :try_start_1
    const-string v0, "events"

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

    move-result-wide v0
    :try_end_7
    .catchall {:try_start_1 .. :try_end_7} :catchall_9

    monitor-exit p0

    return-wide v0

    :catchall_9
    move-exception v0

    monitor-exit p0

    throw v0
.end method
