.class public Landroid/arch/persistence/room/InvalidationTracker;
.super Ljava/lang/Object;
.source "InvalidationTracker.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Landroid/arch/persistence/room/InvalidationTracker$WeakObserver;,
        Landroid/arch/persistence/room/InvalidationTracker$ObservedTableTracker;,
        Landroid/arch/persistence/room/InvalidationTracker$Observer;,
        Landroid/arch/persistence/room/InvalidationTracker$ObserverWrapper;
    }
.end annotation


# static fields
.field private static final d:[Ljava/lang/String;


# instance fields
.field a:[J
    .annotation build Landroid/support/annotation/NonNull;
    .end annotation

    .annotation build Landroid/support/annotation/VisibleForTesting;
    .end annotation
.end field

.field b:Ljava/util/concurrent/atomic/AtomicBoolean;

.field final c:Landroid/arch/core/internal/SafeIterableMap;
    .annotation build Landroid/support/annotation/VisibleForTesting;
    .end annotation

    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/arch/core/internal/SafeIterableMap<",
            "Landroid/arch/persistence/room/InvalidationTracker$Observer;",
            "Landroid/arch/persistence/room/InvalidationTracker$ObserverWrapper;",
            ">;"
        }
    .end annotation
.end field

.field private e:[Ljava/lang/String;

.field private f:[Ljava/lang/Object;

.field private g:J

.field private final h:Landroid/arch/persistence/room/RoomDatabase;

.field private volatile i:Z

.field private volatile j:Landroid/arch/persistence/db/SupportSQLiteStatement;

.field private k:Landroid/arch/persistence/room/InvalidationTracker$ObservedTableTracker;

.field private l:Ljava/lang/Runnable;


# direct methods
.method static constructor <clinit>()V
    .locals 3

    const/4 v0, 0x3

    .line 64
    new-array v0, v0, [Ljava/lang/String;

    const-string v1, "UPDATE"

    const/4 v2, 0x0

    aput-object v1, v0, v2

    const-string v1, "DELETE"

    const/4 v2, 0x1

    aput-object v1, v0, v2

    const-string v1, "INSERT"

    const/4 v2, 0x2

    aput-object v1, v0, v2

    sput-object v0, Landroid/arch/persistence/room/InvalidationTracker;->d:[Ljava/lang/String;

    return-void
.end method

.method static synthetic a(Landroid/arch/persistence/room/InvalidationTracker;J)J
    .locals 0

    .line 62
    iput-wide p1, p0, Landroid/arch/persistence/room/InvalidationTracker;->g:J

    return-wide p1
.end method

.method static synthetic a(Landroid/arch/persistence/room/InvalidationTracker;)Landroid/arch/persistence/room/RoomDatabase;
    .locals 0

    .line 62
    iget-object p0, p0, Landroid/arch/persistence/room/InvalidationTracker;->h:Landroid/arch/persistence/room/RoomDatabase;

    return-object p0
.end method

.method private a(Landroid/arch/persistence/db/SupportSQLiteDatabase;I)V
    .locals 7

    .line 178
    iget-object v0, p0, Landroid/arch/persistence/room/InvalidationTracker;->e:[Ljava/lang/String;

    aget-object p2, v0, p2

    .line 179
    new-instance v0, Ljava/lang/StringBuilder;

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

    .line 180
    sget-object v1, Landroid/arch/persistence/room/InvalidationTracker;->d:[Ljava/lang/String;

    array-length v2, v1

    const/4 v3, 0x0

    const/4 v4, 0x0

    :goto_0
    if-ge v4, v2, :cond_0

    aget-object v5, v1, v4

    .line 181
    invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->setLength(I)V

    const-string v6, "DROP TRIGGER IF EXISTS "

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

    .line 183
    invoke-static {v0, p2, v5}, Landroid/arch/persistence/room/InvalidationTracker;->a(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/String;)V

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

    move-result-object v5

    invoke-interface {p1, v5}, Landroid/arch/persistence/db/SupportSQLiteDatabase;->a(Ljava/lang/String;)V

    add-int/lit8 v4, v4, 0x1

    goto :goto_0

    :cond_0
    return-void
.end method

.method static synthetic a(Landroid/arch/persistence/room/InvalidationTracker;Landroid/arch/persistence/db/SupportSQLiteDatabase;I)V
    .locals 0

    .line 62
    invoke-direct {p0, p1, p2}, Landroid/arch/persistence/room/InvalidationTracker;->b(Landroid/arch/persistence/db/SupportSQLiteDatabase;I)V

    return-void
.end method

.method private static a(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/String;)V
    .locals 1

    const-string v0, "`"

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

    const-string v0, "room_table_modification_trigger_"

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

    .line 171
    invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string p1, "_"

    .line 172
    invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 173
    invoke-virtual {p0, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string p1, "`"

    .line 174
    invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    return-void
.end method

.method private a()Z
    .locals 3

    .line 328
    iget-object v0, p0, Landroid/arch/persistence/room/InvalidationTracker;->h:Landroid/arch/persistence/room/RoomDatabase;

    invoke-virtual {v0}, Landroid/arch/persistence/room/RoomDatabase;->d()Z

    move-result v0

    const/4 v1, 0x0

    if-nez v0, :cond_0

    return v1

    .line 331
    :cond_0
    iget-boolean v0, p0, Landroid/arch/persistence/room/InvalidationTracker;->i:Z

    if-nez v0, :cond_1

    .line 333
    iget-object v0, p0, Landroid/arch/persistence/room/InvalidationTracker;->h:Landroid/arch/persistence/room/RoomDatabase;

    invoke-virtual {v0}, Landroid/arch/persistence/room/RoomDatabase;->b()Landroid/arch/persistence/db/SupportSQLiteOpenHelper;

    move-result-object v0

    invoke-interface {v0}, Landroid/arch/persistence/db/SupportSQLiteOpenHelper;->a()Landroid/arch/persistence/db/SupportSQLiteDatabase;

    .line 335
    :cond_1
    iget-boolean v0, p0, Landroid/arch/persistence/room/InvalidationTracker;->i:Z

    if-nez v0, :cond_2

    const-string v0, "ROOM"

    const-string v2, "database is not initialized even though it is open"

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

    return v1

    :cond_2
    const/4 v0, 0x1

    return v0
.end method

.method private b(Landroid/arch/persistence/db/SupportSQLiteDatabase;I)V
    .locals 8

    .line 189
    iget-object v0, p0, Landroid/arch/persistence/room/InvalidationTracker;->e:[Ljava/lang/String;

    aget-object v0, v0, p2

    .line 190
    new-instance v1, Ljava/lang/StringBuilder;

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

    .line 191
    sget-object v2, Landroid/arch/persistence/room/InvalidationTracker;->d:[Ljava/lang/String;

    array-length v3, v2

    const/4 v4, 0x0

    const/4 v5, 0x0

    :goto_0
    if-ge v5, v3, :cond_0

    aget-object v6, v2, v5

    .line 192
    invoke-virtual {v1, v4}, Ljava/lang/StringBuilder;->setLength(I)V

    const-string v7, "CREATE TEMP TRIGGER IF NOT EXISTS "

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

    .line 194
    invoke-static {v1, v0, v6}, Landroid/arch/persistence/room/InvalidationTracker;->a(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/String;)V

    const-string v7, " AFTER "

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

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

    const-string v6, " ON `"

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

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

    const-string v6, "` BEGIN INSERT OR REPLACE INTO "

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

    const-string v6, "room_table_modification_log"

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

    const-string v6, " VALUES(null, "

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

    .line 202
    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v6, "); END"

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

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

    move-result-object v6

    invoke-interface {p1, v6}, Landroid/arch/persistence/db/SupportSQLiteDatabase;->a(Ljava/lang/String;)V

    add-int/lit8 v5, v5, 0x1

    goto :goto_0

    :cond_0
    return-void
.end method

.method static synthetic b(Landroid/arch/persistence/room/InvalidationTracker;Landroid/arch/persistence/db/SupportSQLiteDatabase;I)V
    .locals 0

    .line 62
    invoke-direct {p0, p1, p2}, Landroid/arch/persistence/room/InvalidationTracker;->a(Landroid/arch/persistence/db/SupportSQLiteDatabase;I)V

    return-void
.end method

.method static synthetic b(Landroid/arch/persistence/room/InvalidationTracker;)Z
    .locals 0

    .line 62
    invoke-direct {p0}, Landroid/arch/persistence/room/InvalidationTracker;->a()Z

    move-result p0

    return p0
.end method

.method static synthetic c(Landroid/arch/persistence/room/InvalidationTracker;)Landroid/arch/persistence/room/InvalidationTracker$ObservedTableTracker;
    .locals 0

    .line 62
    iget-object p0, p0, Landroid/arch/persistence/room/InvalidationTracker;->k:Landroid/arch/persistence/room/InvalidationTracker$ObservedTableTracker;

    return-object p0
.end method

.method static synthetic d(Landroid/arch/persistence/room/InvalidationTracker;)Landroid/arch/persistence/db/SupportSQLiteStatement;
    .locals 0

    .line 62
    iget-object p0, p0, Landroid/arch/persistence/room/InvalidationTracker;->j:Landroid/arch/persistence/db/SupportSQLiteStatement;

    return-object p0
.end method

.method static synthetic e(Landroid/arch/persistence/room/InvalidationTracker;)[Ljava/lang/Object;
    .locals 0

    .line 62
    iget-object p0, p0, Landroid/arch/persistence/room/InvalidationTracker;->f:[Ljava/lang/Object;

    return-object p0
.end method

.method static synthetic f(Landroid/arch/persistence/room/InvalidationTracker;)J
    .locals 2

    .line 62
    iget-wide v0, p0, Landroid/arch/persistence/room/InvalidationTracker;->g:J

    return-wide v0
.end method


# virtual methods
.method public a(Landroid/arch/persistence/room/InvalidationTracker$Observer;)V
    .locals 2
    .param p1    # Landroid/arch/persistence/room/InvalidationTracker$Observer;
        .annotation build Landroid/support/annotation/NonNull;
        .end annotation
    .end param

    .line 270
    iget-object v0, p0, Landroid/arch/persistence/room/InvalidationTracker;->c:Landroid/arch/core/internal/SafeIterableMap;

    monitor-enter v0

    .line 271
    :try_start_0
    iget-object v1, p0, Landroid/arch/persistence/room/InvalidationTracker;->c:Landroid/arch/core/internal/SafeIterableMap;

    invoke-virtual {v1, p1}, Landroid/arch/core/internal/SafeIterableMap;->b(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Landroid/arch/persistence/room/InvalidationTracker$ObserverWrapper;

    .line 272
    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-eqz p1, :cond_0

    .line 273
    iget-object v0, p0, Landroid/arch/persistence/room/InvalidationTracker;->k:Landroid/arch/persistence/room/InvalidationTracker$ObservedTableTracker;

    iget-object p1, p1, Landroid/arch/persistence/room/InvalidationTracker$ObserverWrapper;->a:[I

    invoke-virtual {v0, p1}, Landroid/arch/persistence/room/InvalidationTracker$ObservedTableTracker;->a([I)Z

    move-result p1

    if-eqz p1, :cond_0

    .line 274
    invoke-static {}, Landroid/arch/core/executor/ArchTaskExecutor;->a()Landroid/arch/core/executor/ArchTaskExecutor;

    move-result-object p1

    iget-object v0, p0, Landroid/arch/persistence/room/InvalidationTracker;->l:Ljava/lang/Runnable;

    invoke-virtual {p1, v0}, Landroid/arch/core/executor/ArchTaskExecutor;->a(Ljava/lang/Runnable;)V

    :cond_0
    return-void

    :catchall_0
    move-exception p1

    .line 272
    :try_start_1
    monitor-exit v0
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw p1
.end method
