apkfuckery/com.discord/smali/androidx/room/InvalidationTracker$1.smali
2019-12-06 04:29:40 +01:00

346 lines
9.7 KiB
Smali

.class public Landroidx/room/InvalidationTracker$1;
.super Ljava/lang/Object;
.source "InvalidationTracker.java"
# interfaces
.implements Ljava/lang/Runnable;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Landroidx/room/InvalidationTracker;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x1
name = null
.end annotation
# instance fields
.field public final synthetic this$0:Landroidx/room/InvalidationTracker;
# direct methods
.method public constructor <init>(Landroidx/room/InvalidationTracker;)V
.locals 0
iput-object p1, p0, Landroidx/room/InvalidationTracker$1;->this$0:Landroidx/room/InvalidationTracker;
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method private checkUpdatedTable()Ljava/util/Set;
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/Set<",
"Ljava/lang/Integer;",
">;"
}
.end annotation
new-instance v0, Landroidx/collection/ArraySet;
invoke-direct {v0}, Landroidx/collection/ArraySet;-><init>()V
iget-object v1, p0, Landroidx/room/InvalidationTracker$1;->this$0:Landroidx/room/InvalidationTracker;
iget-object v1, v1, Landroidx/room/InvalidationTracker;->mDatabase:Landroidx/room/RoomDatabase;
new-instance v2, Landroidx/sqlite/db/SimpleSQLiteQuery;
const-string v3, "SELECT * FROM room_table_modification_log WHERE invalidated = 1;"
invoke-direct {v2, v3}, Landroidx/sqlite/db/SimpleSQLiteQuery;-><init>(Ljava/lang/String;)V
invoke-virtual {v1, v2}, Landroidx/room/RoomDatabase;->query(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroid/database/Cursor;
move-result-object v1
:goto_0
:try_start_0
invoke-interface {v1}, Landroid/database/Cursor;->moveToNext()Z
move-result v2
if-eqz v2, :cond_0
const/4 v2, 0x0
invoke-interface {v1, v2}, Landroid/database/Cursor;->getInt(I)I
move-result v2
invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v2
invoke-virtual {v0, v2}, Landroidx/collection/ArraySet;->add(Ljava/lang/Object;)Z
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
goto :goto_0
:cond_0
invoke-interface {v1}, Landroid/database/Cursor;->close()V
invoke-virtual {v0}, Landroidx/collection/ArraySet;->isEmpty()Z
move-result v1
if-nez v1, :cond_1
iget-object v1, p0, Landroidx/room/InvalidationTracker$1;->this$0:Landroidx/room/InvalidationTracker;
iget-object v1, v1, Landroidx/room/InvalidationTracker;->mCleanupStatement:Landroidx/sqlite/db/SupportSQLiteStatement;
invoke-interface {v1}, Landroidx/sqlite/db/SupportSQLiteStatement;->executeUpdateDelete()I
:cond_1
return-object v0
:catchall_0
move-exception v0
invoke-interface {v1}, Landroid/database/Cursor;->close()V
throw v0
.end method
# virtual methods
.method public run()V
.locals 5
iget-object v0, p0, Landroidx/room/InvalidationTracker$1;->this$0:Landroidx/room/InvalidationTracker;
iget-object v0, v0, Landroidx/room/InvalidationTracker;->mDatabase:Landroidx/room/RoomDatabase;
invoke-virtual {v0}, Landroidx/room/RoomDatabase;->getCloseLock()Ljava/util/concurrent/locks/Lock;
move-result-object v0
const/4 v1, 0x0
:try_start_0
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->lock()V
iget-object v2, p0, Landroidx/room/InvalidationTracker$1;->this$0:Landroidx/room/InvalidationTracker;
invoke-virtual {v2}, Landroidx/room/InvalidationTracker;->ensureInitialization()Z
move-result v2
: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
.catchall {:try_start_0 .. :try_end_0} :catchall_1
if-nez v2, :cond_0
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->unlock()V
return-void
:cond_0
:try_start_1
iget-object v2, p0, Landroidx/room/InvalidationTracker$1;->this$0:Landroidx/room/InvalidationTracker;
iget-object v2, v2, Landroidx/room/InvalidationTracker;->mPendingRefresh:Ljava/util/concurrent/atomic/AtomicBoolean;
const/4 v3, 0x1
const/4 v4, 0x0
invoke-virtual {v2, v3, v4}, Ljava/util/concurrent/atomic/AtomicBoolean;->compareAndSet(ZZ)Z
move-result v2
:try_end_1
.catch Ljava/lang/IllegalStateException; {:try_start_1 .. :try_end_1} :catch_1
.catch Landroid/database/sqlite/SQLiteException; {:try_start_1 .. :try_end_1} :catch_0
.catchall {:try_start_1 .. :try_end_1} :catchall_1
if-nez v2, :cond_1
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->unlock()V
return-void
:cond_1
:try_start_2
iget-object v2, p0, Landroidx/room/InvalidationTracker$1;->this$0:Landroidx/room/InvalidationTracker;
iget-object v2, v2, Landroidx/room/InvalidationTracker;->mDatabase:Landroidx/room/RoomDatabase;
invoke-virtual {v2}, Landroidx/room/RoomDatabase;->inTransaction()Z
move-result v2
: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
.catchall {:try_start_2 .. :try_end_2} :catchall_1
if-eqz v2, :cond_2
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->unlock()V
return-void
:cond_2
:try_start_3
iget-object v2, p0, Landroidx/room/InvalidationTracker$1;->this$0:Landroidx/room/InvalidationTracker;
iget-object v2, v2, Landroidx/room/InvalidationTracker;->mDatabase:Landroidx/room/RoomDatabase;
iget-boolean v2, v2, Landroidx/room/RoomDatabase;->mWriteAheadLoggingEnabled:Z
if-eqz v2, :cond_3
iget-object v2, p0, Landroidx/room/InvalidationTracker$1;->this$0:Landroidx/room/InvalidationTracker;
iget-object v2, v2, Landroidx/room/InvalidationTracker;->mDatabase:Landroidx/room/RoomDatabase;
invoke-virtual {v2}, Landroidx/room/RoomDatabase;->getOpenHelper()Landroidx/sqlite/db/SupportSQLiteOpenHelper;
move-result-object v2
invoke-interface {v2}, Landroidx/sqlite/db/SupportSQLiteOpenHelper;->getWritableDatabase()Landroidx/sqlite/db/SupportSQLiteDatabase;
move-result-object v2
invoke-interface {v2}, Landroidx/sqlite/db/SupportSQLiteDatabase;->beginTransaction()V
:try_end_3
.catch Ljava/lang/IllegalStateException; {:try_start_3 .. :try_end_3} :catch_1
.catch Landroid/database/sqlite/SQLiteException; {:try_start_3 .. :try_end_3} :catch_0
.catchall {:try_start_3 .. :try_end_3} :catchall_1
:try_start_4
invoke-direct {p0}, Landroidx/room/InvalidationTracker$1;->checkUpdatedTable()Ljava/util/Set;
move-result-object v1
invoke-interface {v2}, Landroidx/sqlite/db/SupportSQLiteDatabase;->setTransactionSuccessful()V
:try_end_4
.catchall {:try_start_4 .. :try_end_4} :catchall_0
:try_start_5
invoke-interface {v2}, Landroidx/sqlite/db/SupportSQLiteDatabase;->endTransaction()V
goto :goto_1
:catchall_0
move-exception v3
invoke-interface {v2}, Landroidx/sqlite/db/SupportSQLiteDatabase;->endTransaction()V
throw v3
:cond_3
invoke-direct {p0}, Landroidx/room/InvalidationTracker$1;->checkUpdatedTable()Ljava/util/Set;
move-result-object v1
:try_end_5
.catch Ljava/lang/IllegalStateException; {:try_start_5 .. :try_end_5} :catch_1
.catch Landroid/database/sqlite/SQLiteException; {:try_start_5 .. :try_end_5} :catch_0
.catchall {:try_start_5 .. :try_end_5} :catchall_1
goto :goto_1
:catchall_1
move-exception v1
goto :goto_4
:catch_0
move-exception v2
goto :goto_0
:catch_1
move-exception v2
:goto_0
:try_start_6
const-string v3, "ROOM"
const-string v4, "Cannot run invalidation tracker. Is the db closed?"
invoke-static {v3, v4, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:try_end_6
.catchall {:try_start_6 .. :try_end_6} :catchall_1
:goto_1
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->unlock()V
if-eqz v1, :cond_5
invoke-interface {v1}, Ljava/util/Set;->isEmpty()Z
move-result v0
if-nez v0, :cond_5
iget-object v0, p0, Landroidx/room/InvalidationTracker$1;->this$0:Landroidx/room/InvalidationTracker;
iget-object v0, v0, Landroidx/room/InvalidationTracker;->mObserverMap:Landroidx/arch/core/internal/SafeIterableMap;
monitor-enter v0
:try_start_7
iget-object v2, p0, Landroidx/room/InvalidationTracker$1;->this$0:Landroidx/room/InvalidationTracker;
iget-object v2, v2, Landroidx/room/InvalidationTracker;->mObserverMap:Landroidx/arch/core/internal/SafeIterableMap;
invoke-virtual {v2}, Landroidx/arch/core/internal/SafeIterableMap;->iterator()Ljava/util/Iterator;
move-result-object v2
:goto_2
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
move-result v3
if-eqz v3, :cond_4
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v3
check-cast v3, Ljava/util/Map$Entry;
invoke-interface {v3}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object v3
check-cast v3, Landroidx/room/InvalidationTracker$ObserverWrapper;
invoke-virtual {v3, v1}, Landroidx/room/InvalidationTracker$ObserverWrapper;->notifyByTableInvalidStatus(Ljava/util/Set;)V
goto :goto_2
:cond_4
monitor-exit v0
goto :goto_3
:catchall_2
move-exception v1
monitor-exit v0
:try_end_7
.catchall {:try_start_7 .. :try_end_7} :catchall_2
throw v1
:cond_5
:goto_3
return-void
:goto_4
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->unlock()V
throw v1
.end method