apkfuckery/com.discord/smali/androidx/room/InvalidationTracker.smali
2019-11-20 23:09:14 +01:00

1252 lines
36 KiB
Smali

.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 private static final CREATE_TRACKING_TABLE_SQL:Ljava/lang/String; = "CREATE TEMP TABLE room_table_modification_log(table_id INTEGER PRIMARY KEY, invalidated INTEGER NOT NULL DEFAULT 0)"
.field private static final INVALIDATED_COLUMN_NAME:Ljava/lang/String; = "invalidated"
.field static final RESET_UPDATED_TABLES_SQL:Ljava/lang/String; = "UPDATE room_table_modification_log SET invalidated = 0 WHERE invalidated = 1 "
.field static final SELECT_UPDATED_TABLES_SQL:Ljava/lang/String; = "SELECT * FROM room_table_modification_log WHERE invalidated = 1;"
.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"
# instance fields
.field volatile mCleanupStatement:Landroidx/sqlite/db/SupportSQLiteStatement;
.field final mDatabase:Landroidx/room/RoomDatabase;
.field private volatile mInitialized:Z
.field private final mInvalidationLiveDataContainer:Landroidx/room/InvalidationLiveDataContainer;
.field private mMultiInstanceInvalidationClient:Landroidx/room/MultiInstanceInvalidationClient;
.field private mObservedTableTracker:Landroidx/room/InvalidationTracker$ObservedTableTracker;
.field final mObserverMap:Landroidx/arch/core/internal/SafeIterableMap;
.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 mRefreshRunnable:Ljava/lang/Runnable;
.field final mTableIdLookup:Landroidx/collection/ArrayMap;
.annotation system Ldalvik/annotation/Signature;
value = {
"Landroidx/collection/ArrayMap<",
"Ljava/lang/String;",
"Ljava/lang/Integer;",
">;"
}
.end annotation
.end field
.field final mTableNames:[Ljava/lang/String;
.field private mViewTables:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/String;",
"Ljava/util/Set<",
"Ljava/lang/String;",
">;>;"
}
.end annotation
.end field
# direct methods
.method static constructor <clinit>()V
.locals 3
const-string v0, "UPDATE"
const-string v1, "DELETE"
const-string v2, "INSERT"
filled-new-array {v0, v1, v2}, [Ljava/lang/String;
move-result-object v0
sput-object v0, Landroidx/room/InvalidationTracker;->TRIGGERS:[Ljava/lang/String;
return-void
.end method
.method public varargs constructor <init>(Landroidx/room/RoomDatabase;Ljava/util/Map;Ljava/util/Map;[Ljava/lang/String;)V
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroidx/room/RoomDatabase;",
"Ljava/util/Map<",
"Ljava/lang/String;",
"Ljava/lang/String;",
">;",
"Ljava/util/Map<",
"Ljava/lang/String;",
"Ljava/util/Set<",
"Ljava/lang/String;",
">;>;[",
"Ljava/lang/String;",
")V"
}
.end annotation
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v0, Ljava/util/concurrent/atomic/AtomicBoolean;
const/4 v1, 0x0
invoke-direct {v0, v1}, Ljava/util/concurrent/atomic/AtomicBoolean;-><init>(Z)V
iput-object v0, p0, Landroidx/room/InvalidationTracker;->mPendingRefresh:Ljava/util/concurrent/atomic/AtomicBoolean;
iput-boolean v1, p0, Landroidx/room/InvalidationTracker;->mInitialized:Z
new-instance v0, Landroidx/arch/core/internal/SafeIterableMap;
invoke-direct {v0}, Landroidx/arch/core/internal/SafeIterableMap;-><init>()V
iput-object v0, p0, Landroidx/room/InvalidationTracker;->mObserverMap:Landroidx/arch/core/internal/SafeIterableMap;
new-instance v0, Landroidx/room/InvalidationTracker$1;
invoke-direct {v0, p0}, Landroidx/room/InvalidationTracker$1;-><init>(Landroidx/room/InvalidationTracker;)V
iput-object v0, 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 v0, p4
invoke-direct {p1, v0}, 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;
iput-object p3, p0, Landroidx/room/InvalidationTracker;->mViewTables:Ljava/util/Map;
new-instance p1, Landroidx/room/InvalidationLiveDataContainer;
iget-object p3, p0, Landroidx/room/InvalidationTracker;->mDatabase:Landroidx/room/RoomDatabase;
invoke-direct {p1, p3}, Landroidx/room/InvalidationLiveDataContainer;-><init>(Landroidx/room/RoomDatabase;)V
iput-object p1, p0, Landroidx/room/InvalidationTracker;->mInvalidationLiveDataContainer:Landroidx/room/InvalidationLiveDataContainer;
array-length p1, p4
new-array p3, p1, [Ljava/lang/String;
iput-object p3, p0, Landroidx/room/InvalidationTracker;->mTableNames:[Ljava/lang/String;
:goto_0
if-ge v1, p1, :cond_1
aget-object p3, p4, v1
sget-object v0, Ljava/util/Locale;->US:Ljava/util/Locale;
invoke-virtual {p3, v0}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
move-result-object p3
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mTableIdLookup:Landroidx/collection/ArrayMap;
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v2
invoke-virtual {v0, p3, v2}, Landroidx/collection/ArrayMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
aget-object v0, p4, v1
invoke-interface {p2, v0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/String;
if-eqz v0, :cond_0
iget-object p3, p0, Landroidx/room/InvalidationTracker;->mTableNames:[Ljava/lang/String;
sget-object v2, Ljava/util/Locale;->US:Ljava/util/Locale;
invoke-virtual {v0, v2}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
move-result-object v0
aput-object v0, p3, v1
goto :goto_1
:cond_0
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mTableNames:[Ljava/lang/String;
aput-object p3, v0, v1
:goto_1
add-int/lit8 v1, v1, 0x1
goto :goto_0
:cond_1
invoke-interface {p2}, Ljava/util/Map;->entrySet()Ljava/util/Set;
move-result-object p1
invoke-interface {p1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object p1
:cond_2
:goto_2
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
move-result p2
if-eqz p2, :cond_3
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object p2
check-cast p2, Ljava/util/Map$Entry;
invoke-interface {p2}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object p3
check-cast p3, Ljava/lang/String;
sget-object p4, Ljava/util/Locale;->US:Ljava/util/Locale;
invoke-virtual {p3, p4}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
move-result-object p3
iget-object p4, p0, Landroidx/room/InvalidationTracker;->mTableIdLookup:Landroidx/collection/ArrayMap;
invoke-virtual {p4, p3}, Landroidx/collection/ArrayMap;->containsKey(Ljava/lang/Object;)Z
move-result p4
if-eqz p4, :cond_2
invoke-interface {p2}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
move-result-object p2
check-cast p2, Ljava/lang/String;
sget-object p4, Ljava/util/Locale;->US:Ljava/util/Locale;
invoke-virtual {p2, p4}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
move-result-object p2
iget-object p4, p0, Landroidx/room/InvalidationTracker;->mTableIdLookup:Landroidx/collection/ArrayMap;
invoke-virtual {p4, p3}, Landroidx/collection/ArrayMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p3
invoke-virtual {p4, p2, p3}, Landroidx/collection/ArrayMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_2
:cond_3
return-void
.end method
.method public varargs constructor <init>(Landroidx/room/RoomDatabase;[Ljava/lang/String;)V
.locals 2
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
invoke-static {}, Ljava/util/Collections;->emptyMap()Ljava/util/Map;
move-result-object v1
invoke-direct {p0, p1, v0, v1, p2}, Landroidx/room/InvalidationTracker;-><init>(Landroidx/room/RoomDatabase;Ljava/util/Map;Ljava/util/Map;[Ljava/lang/String;)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 resolveViews([Ljava/lang/String;)[Ljava/lang/String;
.locals 6
new-instance v0, Landroidx/collection/ArraySet;
invoke-direct {v0}, Landroidx/collection/ArraySet;-><init>()V
array-length v1, p1
const/4 v2, 0x0
:goto_0
if-ge v2, v1, :cond_1
aget-object v3, p1, v2
sget-object v4, Ljava/util/Locale;->US:Ljava/util/Locale;
invoke-virtual {v3, v4}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
move-result-object v4
iget-object v5, p0, Landroidx/room/InvalidationTracker;->mViewTables:Ljava/util/Map;
invoke-interface {v5, v4}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v5
if-eqz v5, :cond_0
iget-object v3, p0, Landroidx/room/InvalidationTracker;->mViewTables:Ljava/util/Map;
invoke-interface {v3, v4}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v3
check-cast v3, Ljava/util/Collection;
invoke-interface {v0, v3}, Ljava/util/Set;->addAll(Ljava/util/Collection;)Z
goto :goto_1
:cond_0
invoke-interface {v0, v3}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
:goto_1
add-int/lit8 v2, v2, 0x1
goto :goto_0
:cond_1
invoke-interface {v0}, Ljava/util/Set;->size()I
move-result p1
new-array p1, p1, [Ljava/lang/String;
invoke-interface {v0, p1}, Ljava/util/Set;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
move-result-object p1
check-cast p1, [Ljava/lang/String;
return-object p1
.end method
.method private startTrackingTable(Landroidx/sqlite/db/SupportSQLiteDatabase;I)V
.locals 8
new-instance v0, Ljava/lang/StringBuilder;
const-string v1, "INSERT OR IGNORE INTO room_table_modification_log VALUES("
invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
const-string v1, ", 0)"
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-interface {p1, v0}, Landroidx/sqlite/db/SupportSQLiteDatabase;->execSQL(Ljava/lang/String;)V
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 UPDATE room_table_modification_log SET invalidated"
invoke-virtual {v1, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v6, " = 1 WHERE table_id = "
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, " AND invalidated = 0; 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
.method private validateAndResolveTableNames([Ljava/lang/String;)[Ljava/lang/String;
.locals 5
invoke-direct {p0, p1}, Landroidx/room/InvalidationTracker;->resolveViews([Ljava/lang/String;)[Ljava/lang/String;
move-result-object p1
array-length v0, p1
const/4 v1, 0x0
:goto_0
if-ge v1, v0, :cond_1
aget-object v2, p1, v1
iget-object v3, p0, Landroidx/room/InvalidationTracker;->mTableIdLookup:Landroidx/collection/ArrayMap;
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 v4
invoke-virtual {v3, v4}, Landroidx/collection/ArrayMap;->containsKey(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_0
add-int/lit8 v1, v1, 0x1
goto :goto_0
:cond_0
new-instance p1, Ljava/lang/IllegalArgumentException;
invoke-static {v2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
move-result-object v0
const-string v1, "There is no table with name "
invoke-virtual {v1, v0}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
:cond_1
return-object p1
.end method
# virtual methods
.method public addObserver(Landroidx/room/InvalidationTracker$Observer;)V
.locals 7
iget-object v0, p1, Landroidx/room/InvalidationTracker$Observer;->mTables:[Ljava/lang/String;
invoke-direct {p0, v0}, Landroidx/room/InvalidationTracker;->resolveViews([Ljava/lang/String;)[Ljava/lang/String;
move-result-object v0
array-length v1, v0
new-array v1, v1, [I
array-length v2, v0
const/4 v3, 0x0
:goto_0
if-ge v3, v2, :cond_1
iget-object v4, p0, Landroidx/room/InvalidationTracker;->mTableIdLookup:Landroidx/collection/ArrayMap;
aget-object v5, v0, v3
sget-object v6, Ljava/util/Locale;->US:Ljava/util/Locale;
invoke-virtual {v5, v6}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
move-result-object v5
invoke-virtual {v4, v5}, Landroidx/collection/ArrayMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v4
check-cast v4, Ljava/lang/Integer;
if-eqz v4, :cond_0
invoke-virtual {v4}, Ljava/lang/Integer;->intValue()I
move-result v4
aput v4, v1, v3
add-int/lit8 v3, v3, 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, v3
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}, Landroidx/room/InvalidationTracker$ObserverWrapper;-><init>(Landroidx/room/InvalidationTracker$Observer;[I[Ljava/lang/String;)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
throw p1
.end method
.method public addWeakObserver(Landroidx/room/InvalidationTracker$Observer;)V
.locals 1
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 public createLiveData([Ljava/lang/String;Ljava/util/concurrent/Callable;)Landroidx/lifecycle/LiveData;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">([",
"Ljava/lang/String;",
"Ljava/util/concurrent/Callable<",
"TT;>;)",
"Landroidx/lifecycle/LiveData<",
"TT;>;"
}
.end annotation
.annotation runtime Ljava/lang/Deprecated;
.end annotation
const/4 v0, 0x0
invoke-virtual {p0, p1, v0, p2}, Landroidx/room/InvalidationTracker;->createLiveData([Ljava/lang/String;ZLjava/util/concurrent/Callable;)Landroidx/lifecycle/LiveData;
move-result-object p1
return-object p1
.end method
.method public createLiveData([Ljava/lang/String;ZLjava/util/concurrent/Callable;)Landroidx/lifecycle/LiveData;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">([",
"Ljava/lang/String;",
"Z",
"Ljava/util/concurrent/Callable<",
"TT;>;)",
"Landroidx/lifecycle/LiveData<",
"TT;>;"
}
.end annotation
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mInvalidationLiveDataContainer:Landroidx/room/InvalidationLiveDataContainer;
invoke-direct {p0, p1}, Landroidx/room/InvalidationTracker;->validateAndResolveTableNames([Ljava/lang/String;)[Ljava/lang/String;
move-result-object p1
invoke-virtual {v0, p1, p2, p3}, Landroidx/room/InvalidationLiveDataContainer;->create([Ljava/lang/String;ZLjava/util/concurrent/Callable;)Landroidx/lifecycle/LiveData;
move-result-object p1
return-object p1
.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
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(table_id INTEGER PRIMARY KEY, invalidated INTEGER NOT NULL DEFAULT 0)"
invoke-interface {p1, v0}, Landroidx/sqlite/db/SupportSQLiteDatabase;->execSQL(Ljava/lang/String;)V
invoke-virtual {p0, p1}, Landroidx/room/InvalidationTracker;->syncTriggers(Landroidx/sqlite/db/SupportSQLiteDatabase;)V
const-string v0, "UPDATE room_table_modification_log SET invalidated = 0 WHERE invalidated = 1 "
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 p1
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw p1
.end method
.method public varargs notifyObserversByTableNames([Ljava/lang/String;)V
.locals 4
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}, Landroidx/arch/core/internal/SafeIterableMap;->iterator()Ljava/util/Iterator;
move-result-object v1
:cond_0
:goto_0
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v2
if-eqz v2, :cond_1
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/util/Map$Entry;
invoke-interface {v2}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
move-result-object v3
check-cast v3, Landroidx/room/InvalidationTracker$Observer;
invoke-virtual {v3}, Landroidx/room/InvalidationTracker$Observer;->isRemote()Z
move-result v3
if-nez v3, :cond_0
invoke-interface {v2}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object v2
check-cast v2, Landroidx/room/InvalidationTracker$ObserverWrapper;
invoke-virtual {v2, p1}, Landroidx/room/InvalidationTracker$ObserverWrapper;->notifyByTableNames([Ljava/lang/String;)V
goto :goto_0
:cond_1
monitor-exit v0
return-void
:catchall_0
move-exception p1
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
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
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
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 startMultiInstanceInvalidation(Landroid/content/Context;Ljava/lang/String;)V
.locals 2
new-instance v0, Landroidx/room/MultiInstanceInvalidationClient;
iget-object v1, p0, Landroidx/room/InvalidationTracker;->mDatabase:Landroidx/room/RoomDatabase;
invoke-virtual {v1}, Landroidx/room/RoomDatabase;->getQueryExecutor()Ljava/util/concurrent/Executor;
move-result-object v1
invoke-direct {v0, p1, p2, p0, v1}, Landroidx/room/MultiInstanceInvalidationClient;-><init>(Landroid/content/Context;Ljava/lang/String;Landroidx/room/InvalidationTracker;Ljava/util/concurrent/Executor;)V
iput-object v0, p0, Landroidx/room/InvalidationTracker;->mMultiInstanceInvalidationClient:Landroidx/room/MultiInstanceInvalidationClient;
return-void
.end method
.method stopMultiInstanceInvalidation()V
.locals 1
iget-object v0, p0, Landroidx/room/InvalidationTracker;->mMultiInstanceInvalidationClient:Landroidx/room/MultiInstanceInvalidationClient;
if-eqz v0, :cond_0
invoke-virtual {v0}, Landroidx/room/MultiInstanceInvalidationClient;->stop()V
const/4 v0, 0x0
iput-object v0, p0, Landroidx/room/InvalidationTracker;->mMultiInstanceInvalidationClient:Landroidx/room/MultiInstanceInvalidationClient;
:cond_0
return-void
.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
invoke-interface {p1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->beginTransaction()V
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_1
const/4 v3, 0x0
:goto_1
if-ge v3, v2, :cond_4
:try_start_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