apkfuckery/com.discord/smali/androidx/room/InvalidationTracker.smali
2020-11-30 22:35:21 +00:00

1349 lines
39 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 public static final RESET_UPDATED_TABLES_SQL:Ljava/lang/String; = "UPDATE room_table_modification_log SET invalidated = 0 WHERE invalidated = 1 "
.annotation build Landroidx/annotation/VisibleForTesting;
.end annotation
.end field
.field public static final SELECT_UPDATED_TABLES_SQL:Ljava/lang/String; = "SELECT * FROM room_table_modification_log WHERE invalidated = 1;"
.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"
# instance fields
.field public volatile mCleanupStatement:Landroidx/sqlite/db/SupportSQLiteStatement;
.field public 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 public final mObserverMap:Landroidx/arch/core/internal/SafeIterableMap;
.annotation build Landroid/annotation/SuppressLint;
value = {
"RestrictedApi"
}
.end annotation
.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 public mPendingRefresh:Ljava/util/concurrent/atomic/AtomicBoolean;
.field public mRefreshRunnable:Ljava/lang/Runnable;
.annotation build Landroidx/annotation/VisibleForTesting;
.end annotation
.end field
.field public final mTableIdLookup:Ljava/util/HashMap;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/HashMap<",
"Ljava/lang/String;",
"Ljava/lang/Integer;",
">;"
}
.end annotation
.end field
.field public final mTableNames:[Ljava/lang/String;
.field private mViewTables:Ljava/util/Map;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.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 public 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 4
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP_PREFIX:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
.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 v0, Landroidx/room/InvalidationTracker$ObservedTableTracker;
array-length v2, p4
invoke-direct {v0, v2}, Landroidx/room/InvalidationTracker$ObservedTableTracker;-><init>(I)V
iput-object v0, p0, Landroidx/room/InvalidationTracker;->mObservedTableTracker:Landroidx/room/InvalidationTracker$ObservedTableTracker;
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Landroidx/room/InvalidationTracker;->mTableIdLookup:Ljava/util/HashMap;
iput-object p3, p0, Landroidx/room/InvalidationTracker;->mViewTables:Ljava/util/Map;
new-instance p3, Landroidx/room/InvalidationLiveDataContainer;
invoke-direct {p3, p1}, Landroidx/room/InvalidationLiveDataContainer;-><init>(Landroidx/room/RoomDatabase;)V
iput-object p3, 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 v2, p0, Landroidx/room/InvalidationTracker;->mTableIdLookup:Ljava/util/HashMap;
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v3
invoke-virtual {v2, p3, v3}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
aget-object v2, p4, v1
invoke-interface {p2, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/lang/String;
if-eqz v2, :cond_0
iget-object p3, p0, Landroidx/room/InvalidationTracker;->mTableNames:[Ljava/lang/String;
invoke-virtual {v2, v0}, 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 v0, p0, Landroidx/room/InvalidationTracker;->mTableIdLookup:Ljava/util/HashMap;
invoke-virtual {v0, p3}, Ljava/util/HashMap;->containsKey(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_2
invoke-interface {p2}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
move-result-object p2
check-cast p2, Ljava/lang/String;
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:Ljava/util/HashMap;
invoke-virtual {p4, p3}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p3
invoke-virtual {p4, p2, p3}, Ljava/util/HashMap;->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
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP_PREFIX:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
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 3
const-string v0, "`"
const-string v1, "room_table_modification_trigger_"
const-string v2, "_"
invoke-static {p0, v0, v1, p1, v2}, Lf/e/c/a/a;->X(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {p0, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p0, v0}, 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, Ljava/util/HashSet;
invoke-direct {v0}, Ljava/util/HashSet;-><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-virtual {v0, v3}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z
:goto_1
add-int/lit8 v2, v2, 0x1
goto :goto_0
:cond_1
invoke-virtual {v0}, Ljava/util/HashSet;->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 11
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
const-string v1, "INSERT OR IGNORE INTO room_table_modification_log VALUES("
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
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 "
const-string v8, " ON `"
invoke-static {v1, v7, v6, v8, v0}, Lf/e/c/a/a;->X(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
const-string v6, "` BEGIN UPDATE "
const-string v7, "room_table_modification_log"
const-string v8, " SET "
const-string v9, "invalidated"
invoke-static {v1, v6, v7, v8, v9}, Lf/e/c/a/a;->X(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
const-string v6, " = 1"
const-string v7, " WHERE "
const-string/jumbo v8, "table_id"
const-string v10, " = "
invoke-static {v1, v6, v7, v8, v10}, Lf/e/c/a/a;->X(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
const-string v6, " AND "
invoke-virtual {v1, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v6, " = 0"
invoke-virtual {v1, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)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
.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:Ljava/util/HashMap;
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}, Ljava/util/HashMap;->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;
const-string v0, "There is no table with name "
invoke-static {v0, v2}, Lf/e/c/a/a;->r(Ljava/lang/String;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
.param p1 # Landroidx/room/InvalidationTracker$Observer;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroid/annotation/SuppressLint;
value = {
"RestrictedApi"
}
.end annotation
.annotation build Landroidx/annotation/WorkerThread;
.end annotation
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:Ljava/util/HashMap;
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}, Ljava/util/HashMap;->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;
const-string v1, "There is no table with name "
invoke-static {v1}, Lf/e/c/a/a;->G(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
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
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP_PREFIX: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 public createLiveData([Ljava/lang/String;Ljava/util/concurrent/Callable;)Landroidx/lifecycle/LiveData;
.locals 1
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP_PREFIX:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
.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 build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP_PREFIX:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
.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 public 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 public 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
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
.annotation build Landroidx/annotation/VisibleForTesting;
otherwise = 0x3
.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}, 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
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP_PREFIX: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 Landroid/annotation/SuppressLint;
value = {
"RestrictedApi"
}
.end annotation
.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 public 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 public 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 public 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 public 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