apkfuckery/com.discord/smali/androidx/room/InvalidationTracker.smali

927 lines
27 KiB
Smali
Raw Normal View History

2019-07-24 11:27:29 +00:00
.class public Landroidx/room/InvalidationTracker;
.super Ljava/lang/Object;
.source "InvalidationTracker.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Landroidx/room/InvalidationTracker$WeakObserver;,
Landroidx/room/InvalidationTracker$ObservedTableTracker;,
Landroidx/room/InvalidationTracker$Observer;,
Landroidx/room/InvalidationTracker$ObserverWrapper;
}
.end annotation
# static fields
.field static final CLEANUP_SQL:Ljava/lang/String; = "DELETE FROM room_table_modification_log WHERE version NOT IN( SELECT MAX(version) FROM room_table_modification_log GROUP BY table_id)"
.annotation build Landroidx/annotation/VisibleForTesting;
.end annotation
.end field
.field private static final CREATE_VERSION_TABLE_SQL:Ljava/lang/String; = "CREATE TEMP TABLE room_table_modification_log(version INTEGER PRIMARY KEY AUTOINCREMENT, table_id INTEGER)"
.field static final SELECT_UPDATED_TABLES_SQL:Ljava/lang/String; = "SELECT * FROM room_table_modification_log WHERE version > ? ORDER BY version ASC;"
.annotation build Landroidx/annotation/VisibleForTesting;
.end annotation
.end field
.field private static final TABLE_ID_COLUMN_NAME:Ljava/lang/String; = "table_id"
.field private static final TRIGGERS:[Ljava/lang/String;
.field private static final UPDATE_TABLE_NAME:Ljava/lang/String; = "room_table_modification_log"
.field private static final VERSION_COLUMN_NAME:Ljava/lang/String; = "version"
# instance fields
.field volatile mCleanupStatement:Landroidx/sqlite/db/SupportSQLiteStatement;
.field final mDatabase:Landroidx/room/RoomDatabase;
.field private volatile mInitialized:Z
.field mMaxVersion:J
.field private mObservedTableTracker:Landroidx/room/InvalidationTracker$ObservedTableTracker;
.field final mObserverMap:Landroidx/arch/core/internal/SafeIterableMap;
.annotation build Landroidx/annotation/VisibleForTesting;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"Landroidx/arch/core/internal/SafeIterableMap<",
"Landroidx/room/InvalidationTracker$Observer;",
"Landroidx/room/InvalidationTracker$ObserverWrapper;",
">;"
}
.end annotation
.end field
.field mPendingRefresh:Ljava/util/concurrent/atomic/AtomicBoolean;
.field mQueryArgs:[Ljava/lang/Object;
.field mRefreshRunnable:Ljava/lang/Runnable;
.annotation build Landroidx/annotation/VisibleForTesting;
.end annotation
.end field
.field mTableIdLookup:Landroidx/collection/ArrayMap;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.annotation build Landroidx/annotation/VisibleForTesting;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"Landroidx/collection/ArrayMap<",
"Ljava/lang/String;",
"Ljava/lang/Integer;",
">;"
}
.end annotation
.end field
.field private mTableNames:[Ljava/lang/String;
.field mTableVersions:[J
.annotation build Landroidx/annotation/NonNull;
.end annotation
.annotation build Landroidx/annotation/VisibleForTesting;
.end annotation
.end field
# direct methods
.method static constructor <clinit>()V
.locals 3
const/4 v0, 0x3
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "UPDATE"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "DELETE"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "INSERT"
aput-object v2, v0, v1
sput-object v0, Landroidx/room/InvalidationTracker;->TRIGGERS:[Ljava/lang/String;
return-void
.end method
.method public varargs constructor <init>(Landroidx/room/RoomDatabase;[Ljava/lang/String;)V
.locals 6
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const/4 v0, 0x1
new-array v0, v0, [Ljava/lang/Object;
iput-object v0, p0, Landroidx/room/InvalidationTracker;->mQueryArgs:[Ljava/lang/Object;
const-wide/16 v0, 0x0
iput-wide v0, p0, Landroidx/room/InvalidationTracker;->mMaxVersion:J
new-instance v2, Ljava/util/concurrent/atomic/AtomicBoolean;
const/4 v3, 0x0
invoke-direct {v2, v3}, Ljava/util/concurrent/atomic/AtomicBoolean;-><init>(Z)V
iput-object v2, p0, Landroidx/room/InvalidationTracker;->mPendingRefresh:Ljava/util/concurrent/atomic/AtomicBoolean;
iput-boolean v3, p0, Landroidx/room/InvalidationTracker;->mInitialized:Z
new-instance v2, Landroidx/arch/core/internal/SafeIterableMap;
invoke-direct {v2}, Landroidx/arch/core/internal/SafeIterableMap;-><init>()V
iput-object v2, p0, Landroidx/room/InvalidationTracker;->mObserverMap:Landroidx/arch/core/internal/SafeIterableMap;
new-instance v2, Landroidx/room/InvalidationTracker$1;
invoke-direct {v2, p0}, Landroidx/room/InvalidationTracker$1;-><init>(Landroidx/room/InvalidationTracker;)V
iput-object v2, p0, Landroidx/room/InvalidationTracker;->mRefreshRunnable:Ljava/lang/Runnable;
iput-object p1, p0, Landroidx/room/InvalidationTracker;->mDatabase:Landroidx/room/RoomDatabase;
new-instance p1, Landroidx/room/InvalidationTracker$ObservedTableTracker;
array-length v2, p2
invoke-direct {p1, v2}, Landroidx/room/InvalidationTracker$ObservedTableTracker;-><init>(I)V
iput-object p1, p0, Landroidx/room/InvalidationTracker;->mObservedTableTracker:Landroidx/room/InvalidationTracker$ObservedTableTracker;
new-instance p1, Landroidx/collection/ArrayMap;
invoke-direct {p1}, Landroidx/collection/ArrayMap;-><init>()V
iput-object p1, p0, Landroidx/room/InvalidationTracker;->mTableIdLookup:Landroidx/collection/ArrayMap;
array-length p1, p2
new-array v2, p1, [Ljava/lang/String;
iput-object v2, p0, Landroidx/room/InvalidationTracker;->mTableNames:[Ljava/lang/String;
:goto_0
if-ge v3, p1, :cond_0
aget-object v2, p2, v3
sget-object v4, Ljava/util/Locale;->US:Ljava/util/Locale;
invoke-virtual {v2, v4}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
move-result-object v2
iget-object v4, p0, Landroidx/room/InvalidationTracker;->mTableIdLookup:Landroidx/collection/ArrayMap;
invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v5
invoke-virtual {v4, v2, v5}, Landroidx/collection/ArrayMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
iget-object v4, p0, Landroidx/room/InvalidationTracker;->mTableNames:[Ljava/lang/String;
aput-object v2, v4, v3
add-int/lit8 v3, v3, 0x1
goto :goto_0
:cond_0
array-length p1, p2
new-array p1, p1, [J
iput-object p1, p0, Landroidx/room/InvalidationTracker;->mTableVersions:[J
iget-object p1, p0, Landroidx/room/InvalidationTracker;->mTableVersions:[J
invoke-static {p1, v0, v1}, Ljava/util/Arrays;->fill([JJ)V
return-void
.end method
.method private static appendTriggerName(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/String;)V
.locals 1
const-string v0, "`room_table_modification_trigger_"
invoke-virtual {p0, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string p1, "_"
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p0, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string p1, "`"
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
return-void
.end method
.method private startTrackingTable(Landroidx/sqlite/db/SupportSQLiteDatabase;I)V
.locals 8
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mTableNames:[Ljava/lang/String;
aget-object v0, v0, p2
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
sget-object v2, Landroidx/room/InvalidationTracker;->TRIGGERS:[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
invoke-virtual {v1, v4}, Ljava/lang/StringBuilder;->setLength(I)V
const-string v7, "CREATE TEMP TRIGGER IF NOT EXISTS "
invoke-virtual {v1, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-static {v1, v0, v6}, Landroidx/room/InvalidationTracker;->appendTriggerName(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/String;)V
const-string v7, " AFTER "
invoke-virtual {v1, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v6, " ON `"
invoke-virtual {v1, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v6, "` BEGIN INSERT OR REPLACE INTO room_table_modification_log VALUES(null, "
invoke-virtual {v1, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
const-string v6, "); END"
invoke-virtual {v1, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v6
invoke-interface {p1, v6}, Landroidx/sqlite/db/SupportSQLiteDatabase;->execSQL(Ljava/lang/String;)V
add-int/lit8 v5, v5, 0x1
goto :goto_0
:cond_0
return-void
.end method
.method private stopTrackingTable(Landroidx/sqlite/db/SupportSQLiteDatabase;I)V
.locals 7
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mTableNames:[Ljava/lang/String;
aget-object p2, v0, p2
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
sget-object v1, Landroidx/room/InvalidationTracker;->TRIGGERS:[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
invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->setLength(I)V
const-string v6, "DROP TRIGGER IF EXISTS "
invoke-virtual {v0, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-static {v0, p2, v5}, Landroidx/room/InvalidationTracker;->appendTriggerName(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v5
invoke-interface {p1, v5}, Landroidx/sqlite/db/SupportSQLiteDatabase;->execSQL(Ljava/lang/String;)V
add-int/lit8 v4, v4, 0x1
goto :goto_0
:cond_0
return-void
.end method
# virtual methods
.method public addObserver(Landroidx/room/InvalidationTracker$Observer;)V
.locals 8
.param p1 # Landroidx/room/InvalidationTracker$Observer;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/WorkerThread;
.end annotation
iget-object v0, p1, Landroidx/room/InvalidationTracker$Observer;->mTables:[Ljava/lang/String;
array-length v1, v0
new-array v1, v1, [I
array-length v2, v0
array-length v3, v0
new-array v3, v3, [J
const/4 v4, 0x0
:goto_0
if-ge v4, v2, :cond_1
iget-object v5, p0, Landroidx/room/InvalidationTracker;->mTableIdLookup:Landroidx/collection/ArrayMap;
aget-object v6, v0, v4
sget-object v7, Ljava/util/Locale;->US:Ljava/util/Locale;
invoke-virtual {v6, v7}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
move-result-object v6
invoke-virtual {v5, v6}, Landroidx/collection/ArrayMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v5
check-cast v5, Ljava/lang/Integer;
if-eqz v5, :cond_0
invoke-virtual {v5}, Ljava/lang/Integer;->intValue()I
move-result v5
aput v5, v1, v4
iget-wide v5, p0, Landroidx/room/InvalidationTracker;->mMaxVersion:J
aput-wide v5, v3, v4
add-int/lit8 v4, v4, 0x1
goto :goto_0
:cond_0
new-instance p1, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "There is no table with name "
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
aget-object v0, v0, v4
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 v0
invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
:cond_1
new-instance v2, Landroidx/room/InvalidationTracker$ObserverWrapper;
invoke-direct {v2, p1, v1, v0, v3}, Landroidx/room/InvalidationTracker$ObserverWrapper;-><init>(Landroidx/room/InvalidationTracker$Observer;[I[Ljava/lang/String;[J)V
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mObserverMap:Landroidx/arch/core/internal/SafeIterableMap;
monitor-enter v0
:try_start_0
iget-object v3, p0, Landroidx/room/InvalidationTracker;->mObserverMap:Landroidx/arch/core/internal/SafeIterableMap;
invoke-virtual {v3, p1, v2}, Landroidx/arch/core/internal/SafeIterableMap;->putIfAbsent(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Landroidx/room/InvalidationTracker$ObserverWrapper;
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-nez p1, :cond_2
iget-object p1, p0, Landroidx/room/InvalidationTracker;->mObservedTableTracker:Landroidx/room/InvalidationTracker$ObservedTableTracker;
invoke-virtual {p1, v1}, Landroidx/room/InvalidationTracker$ObservedTableTracker;->onAdded([I)Z
move-result p1
if-eqz p1, :cond_2
invoke-virtual {p0}, Landroidx/room/InvalidationTracker;->syncTriggers()V
:cond_2
return-void
:catchall_0
move-exception p1
:try_start_1
monitor-exit v0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
goto :goto_2
:goto_1
throw p1
:goto_2
goto :goto_1
.end method
.method public addWeakObserver(Landroidx/room/InvalidationTracker$Observer;)V
.locals 1
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
new-instance v0, Landroidx/room/InvalidationTracker$WeakObserver;
invoke-direct {v0, p0, p1}, Landroidx/room/InvalidationTracker$WeakObserver;-><init>(Landroidx/room/InvalidationTracker;Landroidx/room/InvalidationTracker$Observer;)V
invoke-virtual {p0, v0}, Landroidx/room/InvalidationTracker;->addObserver(Landroidx/room/InvalidationTracker$Observer;)V
return-void
.end method
.method ensureInitialization()Z
.locals 3
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mDatabase:Landroidx/room/RoomDatabase;
invoke-virtual {v0}, Landroidx/room/RoomDatabase;->isOpen()Z
move-result v0
const/4 v1, 0x0
if-nez v0, :cond_0
return v1
:cond_0
iget-boolean v0, p0, Landroidx/room/InvalidationTracker;->mInitialized:Z
if-nez v0, :cond_1
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mDatabase:Landroidx/room/RoomDatabase;
invoke-virtual {v0}, Landroidx/room/RoomDatabase;->getOpenHelper()Landroidx/sqlite/db/SupportSQLiteOpenHelper;
move-result-object v0
invoke-interface {v0}, Landroidx/sqlite/db/SupportSQLiteOpenHelper;->getWritableDatabase()Landroidx/sqlite/db/SupportSQLiteDatabase;
:cond_1
iget-boolean v0, p0, Landroidx/room/InvalidationTracker;->mInitialized:Z
if-nez v0, :cond_2
const-string v0, "ROOM"
const-string v2, "database is not initialized even though it is open"
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 internalInit(Landroidx/sqlite/db/SupportSQLiteDatabase;)V
.locals 1
monitor-enter p0
:try_start_0
iget-boolean v0, p0, Landroidx/room/InvalidationTracker;->mInitialized:Z
if-eqz v0, :cond_0
const-string p1, "ROOM"
const-string v0, "Invalidation tracker is initialized twice :/."
invoke-static {p1, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
monitor-exit p0
return-void
:cond_0
invoke-interface {p1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->beginTransaction()V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_1
:try_start_1
const-string v0, "PRAGMA temp_store = MEMORY;"
invoke-interface {p1, v0}, Landroidx/sqlite/db/SupportSQLiteDatabase;->execSQL(Ljava/lang/String;)V
const-string v0, "PRAGMA recursive_triggers=\'ON\';"
invoke-interface {p1, v0}, Landroidx/sqlite/db/SupportSQLiteDatabase;->execSQL(Ljava/lang/String;)V
const-string v0, "CREATE TEMP TABLE room_table_modification_log(version INTEGER PRIMARY KEY AUTOINCREMENT, table_id INTEGER)"
invoke-interface {p1, v0}, Landroidx/sqlite/db/SupportSQLiteDatabase;->execSQL(Ljava/lang/String;)V
invoke-interface {p1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->setTransactionSuccessful()V
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
:try_start_2
invoke-interface {p1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->endTransaction()V
invoke-virtual {p0, p1}, Landroidx/room/InvalidationTracker;->syncTriggers(Landroidx/sqlite/db/SupportSQLiteDatabase;)V
const-string v0, "DELETE FROM room_table_modification_log WHERE version NOT IN( SELECT MAX(version) FROM room_table_modification_log GROUP BY table_id)"
invoke-interface {p1, v0}, Landroidx/sqlite/db/SupportSQLiteDatabase;->compileStatement(Ljava/lang/String;)Landroidx/sqlite/db/SupportSQLiteStatement;
move-result-object p1
iput-object p1, p0, Landroidx/room/InvalidationTracker;->mCleanupStatement:Landroidx/sqlite/db/SupportSQLiteStatement;
const/4 p1, 0x1
iput-boolean p1, p0, Landroidx/room/InvalidationTracker;->mInitialized:Z
monitor-exit p0
return-void
:catchall_0
move-exception v0
invoke-interface {p1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->endTransaction()V
throw v0
:catchall_1
move-exception p1
monitor-exit p0
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_1
throw p1
.end method
.method public refreshVersionsAsync()V
.locals 3
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mPendingRefresh:Ljava/util/concurrent/atomic/AtomicBoolean;
const/4 v1, 0x0
const/4 v2, 0x1
invoke-virtual {v0, v1, v2}, Ljava/util/concurrent/atomic/AtomicBoolean;->compareAndSet(ZZ)Z
move-result v0
if-eqz v0, :cond_0
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mDatabase:Landroidx/room/RoomDatabase;
invoke-virtual {v0}, Landroidx/room/RoomDatabase;->getQueryExecutor()Ljava/util/concurrent/Executor;
move-result-object v0
iget-object v1, p0, Landroidx/room/InvalidationTracker;->mRefreshRunnable:Ljava/lang/Runnable;
invoke-interface {v0, v1}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
:cond_0
return-void
.end method
.method public refreshVersionsSync()V
.locals 1
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
.annotation build Landroidx/annotation/WorkerThread;
.end annotation
invoke-virtual {p0}, Landroidx/room/InvalidationTracker;->syncTriggers()V
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mRefreshRunnable:Ljava/lang/Runnable;
invoke-interface {v0}, Ljava/lang/Runnable;->run()V
return-void
.end method
.method public removeObserver(Landroidx/room/InvalidationTracker$Observer;)V
.locals 2
.param p1 # Landroidx/room/InvalidationTracker$Observer;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/WorkerThread;
.end annotation
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mObserverMap:Landroidx/arch/core/internal/SafeIterableMap;
monitor-enter v0
:try_start_0
iget-object v1, p0, Landroidx/room/InvalidationTracker;->mObserverMap:Landroidx/arch/core/internal/SafeIterableMap;
invoke-virtual {v1, p1}, Landroidx/arch/core/internal/SafeIterableMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Landroidx/room/InvalidationTracker$ObserverWrapper;
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-eqz p1, :cond_0
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mObservedTableTracker:Landroidx/room/InvalidationTracker$ObservedTableTracker;
iget-object p1, p1, Landroidx/room/InvalidationTracker$ObserverWrapper;->mTableIds:[I
invoke-virtual {v0, p1}, Landroidx/room/InvalidationTracker$ObservedTableTracker;->onRemoved([I)Z
move-result p1
if-eqz p1, :cond_0
invoke-virtual {p0}, Landroidx/room/InvalidationTracker;->syncTriggers()V
:cond_0
return-void
:catchall_0
move-exception p1
:try_start_1
monitor-exit v0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw p1
.end method
.method syncTriggers()V
.locals 1
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mDatabase:Landroidx/room/RoomDatabase;
invoke-virtual {v0}, Landroidx/room/RoomDatabase;->isOpen()Z
move-result v0
if-nez v0, :cond_0
return-void
:cond_0
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mDatabase:Landroidx/room/RoomDatabase;
invoke-virtual {v0}, Landroidx/room/RoomDatabase;->getOpenHelper()Landroidx/sqlite/db/SupportSQLiteOpenHelper;
move-result-object v0
invoke-interface {v0}, Landroidx/sqlite/db/SupportSQLiteOpenHelper;->getWritableDatabase()Landroidx/sqlite/db/SupportSQLiteDatabase;
move-result-object v0
invoke-virtual {p0, v0}, Landroidx/room/InvalidationTracker;->syncTriggers(Landroidx/sqlite/db/SupportSQLiteDatabase;)V
return-void
.end method
.method syncTriggers(Landroidx/sqlite/db/SupportSQLiteDatabase;)V
.locals 6
invoke-interface {p1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->inTransaction()Z
move-result v0
if-eqz v0, :cond_0
return-void
:cond_0
:goto_0
:try_start_0
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mDatabase:Landroidx/room/RoomDatabase;
invoke-virtual {v0}, Landroidx/room/RoomDatabase;->getCloseLock()Ljava/util/concurrent/locks/Lock;
move-result-object v0
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->lock()V
:try_end_0
.catch Ljava/lang/IllegalStateException; {:try_start_0 .. :try_end_0} :catch_1
.catch Landroid/database/sqlite/SQLiteException; {:try_start_0 .. :try_end_0} :catch_0
:try_start_1
iget-object v1, p0, Landroidx/room/InvalidationTracker;->mObservedTableTracker:Landroidx/room/InvalidationTracker$ObservedTableTracker;
invoke-virtual {v1}, Landroidx/room/InvalidationTracker$ObservedTableTracker;->getTablesToSync()[I
move-result-object v1
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_1
if-nez v1, :cond_1
:try_start_2
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->unlock()V
:try_end_2
.catch Ljava/lang/IllegalStateException; {:try_start_2 .. :try_end_2} :catch_1
.catch Landroid/database/sqlite/SQLiteException; {:try_start_2 .. :try_end_2} :catch_0
return-void
:cond_1
:try_start_3
array-length v2, v1
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_1
:try_start_4
invoke-interface {p1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->beginTransaction()V
const/4 v3, 0x0
:goto_1
if-ge v3, v2, :cond_4
aget v4, v1, v3
const/4 v5, 0x1
if-eq v4, v5, :cond_3
const/4 v5, 0x2
if-eq v4, v5, :cond_2
goto :goto_2
:cond_2
invoke-direct {p0, p1, v3}, Landroidx/room/InvalidationTracker;->stopTrackingTable(Landroidx/sqlite/db/SupportSQLiteDatabase;I)V
goto :goto_2
:cond_3
invoke-direct {p0, p1, v3}, Landroidx/room/InvalidationTracker;->startTrackingTable(Landroidx/sqlite/db/SupportSQLiteDatabase;I)V
:goto_2
add-int/lit8 v3, v3, 0x1
goto :goto_1
:cond_4
invoke-interface {p1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->setTransactionSuccessful()V
:try_end_4
.catchall {:try_start_4 .. :try_end_4} :catchall_0
:try_start_5
invoke-interface {p1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->endTransaction()V
iget-object v1, p0, Landroidx/room/InvalidationTracker;->mObservedTableTracker:Landroidx/room/InvalidationTracker$ObservedTableTracker;
invoke-virtual {v1}, Landroidx/room/InvalidationTracker$ObservedTableTracker;->onSyncCompleted()V
:try_end_5
.catchall {:try_start_5 .. :try_end_5} :catchall_1
:try_start_6
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->unlock()V
:try_end_6
.catch Ljava/lang/IllegalStateException; {:try_start_6 .. :try_end_6} :catch_1
.catch Landroid/database/sqlite/SQLiteException; {:try_start_6 .. :try_end_6} :catch_0
goto :goto_0
:catchall_0
move-exception v1
:try_start_7
invoke-interface {p1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->endTransaction()V
throw v1
:try_end_7
.catchall {:try_start_7 .. :try_end_7} :catchall_1
:catchall_1
move-exception p1
:try_start_8
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->unlock()V
throw p1
:try_end_8
.catch Ljava/lang/IllegalStateException; {:try_start_8 .. :try_end_8} :catch_1
.catch Landroid/database/sqlite/SQLiteException; {:try_start_8 .. :try_end_8} :catch_0
:catch_0
move-exception p1
goto :goto_3
:catch_1
move-exception p1
:goto_3
const-string v0, "ROOM"
const-string v1, "Cannot run invalidation tracker. Is the db closed?"
invoke-static {v0, v1, p1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
return-void
.end method