apkfuckery/com.discord/smali/androidx/room/RoomDatabase.smali
2019-10-08 01:23:22 +02:00

659 lines
19 KiB
Smali

.class public abstract Landroidx/room/RoomDatabase;
.super Ljava/lang/Object;
.source "RoomDatabase.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Landroidx/room/RoomDatabase$Callback;,
Landroidx/room/RoomDatabase$MigrationContainer;,
Landroidx/room/RoomDatabase$Builder;,
Landroidx/room/RoomDatabase$JournalMode;
}
.end annotation
# static fields
.field private static final DB_IMPL_SUFFIX:Ljava/lang/String; = "_Impl"
.field public static final MAX_BIND_PARAMETER_CNT:I = 0x3e7
# instance fields
.field private mAllowMainThreadQueries:Z
.field private final mBackingFieldMap:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/String;",
"Ljava/lang/Object;",
">;"
}
.end annotation
.end field
.field public mCallbacks:Ljava/util/List;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/List<",
"Landroidx/room/RoomDatabase$Callback;",
">;"
}
.end annotation
.annotation runtime Ljava/lang/Deprecated;
.end annotation
.end field
.field private final mCloseLock:Ljava/util/concurrent/locks/ReentrantReadWriteLock;
.field public volatile mDatabase:Landroidx/sqlite/db/SupportSQLiteDatabase;
.annotation runtime Ljava/lang/Deprecated;
.end annotation
.end field
.field private final mInvalidationTracker:Landroidx/room/InvalidationTracker;
.field private mOpenHelper:Landroidx/sqlite/db/SupportSQLiteOpenHelper;
.field private mQueryExecutor:Ljava/util/concurrent/Executor;
.field private final mSuspendingTransactionId:Ljava/lang/ThreadLocal;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/lang/ThreadLocal<",
"Ljava/lang/Integer;",
">;"
}
.end annotation
.end field
.field private mTransactionExecutor:Ljava/util/concurrent/Executor;
.field mWriteAheadLoggingEnabled:Z
# direct methods
.method public constructor <init>()V
.locals 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v0, Ljava/util/concurrent/locks/ReentrantReadWriteLock;
invoke-direct {v0}, Ljava/util/concurrent/locks/ReentrantReadWriteLock;-><init>()V
iput-object v0, p0, Landroidx/room/RoomDatabase;->mCloseLock:Ljava/util/concurrent/locks/ReentrantReadWriteLock;
new-instance v0, Ljava/lang/ThreadLocal;
invoke-direct {v0}, Ljava/lang/ThreadLocal;-><init>()V
iput-object v0, p0, Landroidx/room/RoomDatabase;->mSuspendingTransactionId:Ljava/lang/ThreadLocal;
new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;
invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
iput-object v0, p0, Landroidx/room/RoomDatabase;->mBackingFieldMap:Ljava/util/Map;
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->createInvalidationTracker()Landroidx/room/InvalidationTracker;
move-result-object v0
iput-object v0, p0, Landroidx/room/RoomDatabase;->mInvalidationTracker:Landroidx/room/InvalidationTracker;
return-void
.end method
.method private static isMainThread()Z
.locals 2
invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;
move-result-object v0
invoke-virtual {v0}, Landroid/os/Looper;->getThread()Ljava/lang/Thread;
move-result-object v0
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
move-result-object v1
if-ne v0, v1, :cond_0
const/4 v0, 0x1
return v0
:cond_0
const/4 v0, 0x0
return v0
.end method
# virtual methods
.method public assertNotMainThread()V
.locals 2
iget-boolean v0, p0, Landroidx/room/RoomDatabase;->mAllowMainThreadQueries:Z
if-eqz v0, :cond_0
return-void
:cond_0
invoke-static {}, Landroidx/room/RoomDatabase;->isMainThread()Z
move-result v0
if-nez v0, :cond_1
return-void
:cond_1
new-instance v0, Ljava/lang/IllegalStateException;
const-string v1, "Cannot access database on the main thread since it may potentially lock the UI for a long period of time."
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method public assertNotSuspendingTransaction()V
.locals 2
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->inTransaction()Z
move-result v0
if-nez v0, :cond_1
iget-object v0, p0, Landroidx/room/RoomDatabase;->mSuspendingTransactionId:Ljava/lang/ThreadLocal;
invoke-virtual {v0}, Ljava/lang/ThreadLocal;->get()Ljava/lang/Object;
move-result-object v0
if-nez v0, :cond_0
goto :goto_0
:cond_0
new-instance v0, Ljava/lang/IllegalStateException;
const-string v1, "Cannot access database on a different coroutine context inherited from a suspending transaction."
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
:cond_1
:goto_0
return-void
.end method
.method public beginTransaction()V
.locals 2
.annotation runtime Ljava/lang/Deprecated;
.end annotation
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->assertNotMainThread()V
iget-object v0, p0, Landroidx/room/RoomDatabase;->mOpenHelper:Landroidx/sqlite/db/SupportSQLiteOpenHelper;
invoke-interface {v0}, Landroidx/sqlite/db/SupportSQLiteOpenHelper;->getWritableDatabase()Landroidx/sqlite/db/SupportSQLiteDatabase;
move-result-object v0
iget-object v1, p0, Landroidx/room/RoomDatabase;->mInvalidationTracker:Landroidx/room/InvalidationTracker;
invoke-virtual {v1, v0}, Landroidx/room/InvalidationTracker;->syncTriggers(Landroidx/sqlite/db/SupportSQLiteDatabase;)V
invoke-interface {v0}, Landroidx/sqlite/db/SupportSQLiteDatabase;->beginTransaction()V
return-void
.end method
.method public abstract clearAllTables()V
.end method
.method public close()V
.locals 2
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->isOpen()Z
move-result v0
if-eqz v0, :cond_0
iget-object v0, p0, Landroidx/room/RoomDatabase;->mCloseLock:Ljava/util/concurrent/locks/ReentrantReadWriteLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantReadWriteLock;->writeLock()Ljava/util/concurrent/locks/ReentrantReadWriteLock$WriteLock;
move-result-object v0
:try_start_0
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->lock()V
iget-object v1, p0, Landroidx/room/RoomDatabase;->mInvalidationTracker:Landroidx/room/InvalidationTracker;
invoke-virtual {v1}, Landroidx/room/InvalidationTracker;->stopMultiInstanceInvalidation()V
iget-object v1, p0, Landroidx/room/RoomDatabase;->mOpenHelper:Landroidx/sqlite/db/SupportSQLiteOpenHelper;
invoke-interface {v1}, Landroidx/sqlite/db/SupportSQLiteOpenHelper;->close()V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->unlock()V
return-void
:catchall_0
move-exception v1
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->unlock()V
throw v1
:cond_0
return-void
.end method
.method public compileStatement(Ljava/lang/String;)Landroidx/sqlite/db/SupportSQLiteStatement;
.locals 1
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->assertNotMainThread()V
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->assertNotSuspendingTransaction()V
iget-object v0, p0, Landroidx/room/RoomDatabase;->mOpenHelper:Landroidx/sqlite/db/SupportSQLiteOpenHelper;
invoke-interface {v0}, Landroidx/sqlite/db/SupportSQLiteOpenHelper;->getWritableDatabase()Landroidx/sqlite/db/SupportSQLiteDatabase;
move-result-object v0
invoke-interface {v0, p1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->compileStatement(Ljava/lang/String;)Landroidx/sqlite/db/SupportSQLiteStatement;
move-result-object p1
return-object p1
.end method
.method protected abstract createInvalidationTracker()Landroidx/room/InvalidationTracker;
.end method
.method protected abstract createOpenHelper(Landroidx/room/DatabaseConfiguration;)Landroidx/sqlite/db/SupportSQLiteOpenHelper;
.end method
.method public endTransaction()V
.locals 1
.annotation runtime Ljava/lang/Deprecated;
.end annotation
iget-object v0, p0, Landroidx/room/RoomDatabase;->mOpenHelper:Landroidx/sqlite/db/SupportSQLiteOpenHelper;
invoke-interface {v0}, Landroidx/sqlite/db/SupportSQLiteOpenHelper;->getWritableDatabase()Landroidx/sqlite/db/SupportSQLiteDatabase;
move-result-object v0
invoke-interface {v0}, Landroidx/sqlite/db/SupportSQLiteDatabase;->endTransaction()V
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->inTransaction()Z
move-result v0
if-nez v0, :cond_0
iget-object v0, p0, Landroidx/room/RoomDatabase;->mInvalidationTracker:Landroidx/room/InvalidationTracker;
invoke-virtual {v0}, Landroidx/room/InvalidationTracker;->refreshVersionsAsync()V
:cond_0
return-void
.end method
.method getBackingFieldMap()Ljava/util/Map;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/Map<",
"Ljava/lang/String;",
"Ljava/lang/Object;",
">;"
}
.end annotation
iget-object v0, p0, Landroidx/room/RoomDatabase;->mBackingFieldMap:Ljava/util/Map;
return-object v0
.end method
.method getCloseLock()Ljava/util/concurrent/locks/Lock;
.locals 1
iget-object v0, p0, Landroidx/room/RoomDatabase;->mCloseLock:Ljava/util/concurrent/locks/ReentrantReadWriteLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantReadWriteLock;->readLock()Ljava/util/concurrent/locks/ReentrantReadWriteLock$ReadLock;
move-result-object v0
return-object v0
.end method
.method public getInvalidationTracker()Landroidx/room/InvalidationTracker;
.locals 1
iget-object v0, p0, Landroidx/room/RoomDatabase;->mInvalidationTracker:Landroidx/room/InvalidationTracker;
return-object v0
.end method
.method public getOpenHelper()Landroidx/sqlite/db/SupportSQLiteOpenHelper;
.locals 1
iget-object v0, p0, Landroidx/room/RoomDatabase;->mOpenHelper:Landroidx/sqlite/db/SupportSQLiteOpenHelper;
return-object v0
.end method
.method public getQueryExecutor()Ljava/util/concurrent/Executor;
.locals 1
iget-object v0, p0, Landroidx/room/RoomDatabase;->mQueryExecutor:Ljava/util/concurrent/Executor;
return-object v0
.end method
.method getSuspendingTransactionId()Ljava/lang/ThreadLocal;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/lang/ThreadLocal<",
"Ljava/lang/Integer;",
">;"
}
.end annotation
iget-object v0, p0, Landroidx/room/RoomDatabase;->mSuspendingTransactionId:Ljava/lang/ThreadLocal;
return-object v0
.end method
.method public getTransactionExecutor()Ljava/util/concurrent/Executor;
.locals 1
iget-object v0, p0, Landroidx/room/RoomDatabase;->mTransactionExecutor:Ljava/util/concurrent/Executor;
return-object v0
.end method
.method public inTransaction()Z
.locals 1
iget-object v0, p0, Landroidx/room/RoomDatabase;->mOpenHelper:Landroidx/sqlite/db/SupportSQLiteOpenHelper;
invoke-interface {v0}, Landroidx/sqlite/db/SupportSQLiteOpenHelper;->getWritableDatabase()Landroidx/sqlite/db/SupportSQLiteDatabase;
move-result-object v0
invoke-interface {v0}, Landroidx/sqlite/db/SupportSQLiteDatabase;->inTransaction()Z
move-result v0
return v0
.end method
.method public init(Landroidx/room/DatabaseConfiguration;)V
.locals 3
invoke-virtual {p0, p1}, Landroidx/room/RoomDatabase;->createOpenHelper(Landroidx/room/DatabaseConfiguration;)Landroidx/sqlite/db/SupportSQLiteOpenHelper;
move-result-object v0
iput-object v0, p0, Landroidx/room/RoomDatabase;->mOpenHelper:Landroidx/sqlite/db/SupportSQLiteOpenHelper;
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/4 v1, 0x0
const/16 v2, 0x10
if-lt v0, v2, :cond_1
iget-object v0, p1, Landroidx/room/DatabaseConfiguration;->journalMode:Landroidx/room/RoomDatabase$JournalMode;
sget-object v2, Landroidx/room/RoomDatabase$JournalMode;->WRITE_AHEAD_LOGGING:Landroidx/room/RoomDatabase$JournalMode;
if-ne v0, v2, :cond_0
const/4 v0, 0x1
const/4 v1, 0x1
:cond_0
iget-object v0, p0, Landroidx/room/RoomDatabase;->mOpenHelper:Landroidx/sqlite/db/SupportSQLiteOpenHelper;
invoke-interface {v0, v1}, Landroidx/sqlite/db/SupportSQLiteOpenHelper;->setWriteAheadLoggingEnabled(Z)V
:cond_1
iget-object v0, p1, Landroidx/room/DatabaseConfiguration;->callbacks:Ljava/util/List;
iput-object v0, p0, Landroidx/room/RoomDatabase;->mCallbacks:Ljava/util/List;
iget-object v0, p1, Landroidx/room/DatabaseConfiguration;->queryExecutor:Ljava/util/concurrent/Executor;
iput-object v0, p0, Landroidx/room/RoomDatabase;->mQueryExecutor:Ljava/util/concurrent/Executor;
new-instance v0, Landroidx/room/TransactionExecutor;
iget-object v2, p1, Landroidx/room/DatabaseConfiguration;->transactionExecutor:Ljava/util/concurrent/Executor;
invoke-direct {v0, v2}, Landroidx/room/TransactionExecutor;-><init>(Ljava/util/concurrent/Executor;)V
iput-object v0, p0, Landroidx/room/RoomDatabase;->mTransactionExecutor:Ljava/util/concurrent/Executor;
iget-boolean v0, p1, Landroidx/room/DatabaseConfiguration;->allowMainThreadQueries:Z
iput-boolean v0, p0, Landroidx/room/RoomDatabase;->mAllowMainThreadQueries:Z
iput-boolean v1, p0, Landroidx/room/RoomDatabase;->mWriteAheadLoggingEnabled:Z
iget-boolean v0, p1, Landroidx/room/DatabaseConfiguration;->multiInstanceInvalidation:Z
if-eqz v0, :cond_2
iget-object v0, p0, Landroidx/room/RoomDatabase;->mInvalidationTracker:Landroidx/room/InvalidationTracker;
iget-object v1, p1, Landroidx/room/DatabaseConfiguration;->context:Landroid/content/Context;
iget-object p1, p1, Landroidx/room/DatabaseConfiguration;->name:Ljava/lang/String;
invoke-virtual {v0, v1, p1}, Landroidx/room/InvalidationTracker;->startMultiInstanceInvalidation(Landroid/content/Context;Ljava/lang/String;)V
:cond_2
return-void
.end method
.method public internalInitInvalidationTracker(Landroidx/sqlite/db/SupportSQLiteDatabase;)V
.locals 1
iget-object v0, p0, Landroidx/room/RoomDatabase;->mInvalidationTracker:Landroidx/room/InvalidationTracker;
invoke-virtual {v0, p1}, Landroidx/room/InvalidationTracker;->internalInit(Landroidx/sqlite/db/SupportSQLiteDatabase;)V
return-void
.end method
.method public isOpen()Z
.locals 1
iget-object v0, p0, Landroidx/room/RoomDatabase;->mDatabase:Landroidx/sqlite/db/SupportSQLiteDatabase;
if-eqz v0, :cond_0
invoke-interface {v0}, Landroidx/sqlite/db/SupportSQLiteDatabase;->isOpen()Z
move-result v0
if-eqz v0, :cond_0
const/4 v0, 0x1
return v0
:cond_0
const/4 v0, 0x0
return v0
.end method
.method public query(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroid/database/Cursor;
.locals 1
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->assertNotMainThread()V
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->assertNotSuspendingTransaction()V
iget-object v0, p0, Landroidx/room/RoomDatabase;->mOpenHelper:Landroidx/sqlite/db/SupportSQLiteOpenHelper;
invoke-interface {v0}, Landroidx/sqlite/db/SupportSQLiteOpenHelper;->getWritableDatabase()Landroidx/sqlite/db/SupportSQLiteDatabase;
move-result-object v0
invoke-interface {v0, p1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->query(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroid/database/Cursor;
move-result-object p1
return-object p1
.end method
.method public query(Ljava/lang/String;[Ljava/lang/Object;)Landroid/database/Cursor;
.locals 2
iget-object v0, p0, Landroidx/room/RoomDatabase;->mOpenHelper:Landroidx/sqlite/db/SupportSQLiteOpenHelper;
invoke-interface {v0}, Landroidx/sqlite/db/SupportSQLiteOpenHelper;->getWritableDatabase()Landroidx/sqlite/db/SupportSQLiteDatabase;
move-result-object v0
new-instance v1, Landroidx/sqlite/db/SimpleSQLiteQuery;
invoke-direct {v1, p1, p2}, Landroidx/sqlite/db/SimpleSQLiteQuery;-><init>(Ljava/lang/String;[Ljava/lang/Object;)V
invoke-interface {v0, v1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->query(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroid/database/Cursor;
move-result-object p1
return-object p1
.end method
.method public runInTransaction(Ljava/util/concurrent/Callable;)Ljava/lang/Object;
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"<V:",
"Ljava/lang/Object;",
">(",
"Ljava/util/concurrent/Callable<",
"TV;>;)TV;"
}
.end annotation
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->beginTransaction()V
:try_start_0
invoke-interface {p1}, Ljava/util/concurrent/Callable;->call()Ljava/lang/Object;
move-result-object p1
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->setTransactionSuccessful()V
:try_end_0
.catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_1
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->endTransaction()V
return-object p1
:catchall_0
move-exception p1
goto :goto_0
:catch_0
move-exception p1
:try_start_1
invoke-static {p1}, Landroidx/room/util/SneakyThrow;->reThrow(Ljava/lang/Exception;)V
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->endTransaction()V
const/4 p1, 0x0
return-object p1
:catch_1
move-exception p1
:try_start_2
throw p1
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_0
:goto_0
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->endTransaction()V
throw p1
.end method
.method public runInTransaction(Ljava/lang/Runnable;)V
.locals 0
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->beginTransaction()V
:try_start_0
invoke-interface {p1}, Ljava/lang/Runnable;->run()V
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->setTransactionSuccessful()V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->endTransaction()V
return-void
:catchall_0
move-exception p1
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->endTransaction()V
throw p1
.end method
.method public setTransactionSuccessful()V
.locals 1
.annotation runtime Ljava/lang/Deprecated;
.end annotation
iget-object v0, p0, Landroidx/room/RoomDatabase;->mOpenHelper:Landroidx/sqlite/db/SupportSQLiteOpenHelper;
invoke-interface {v0}, Landroidx/sqlite/db/SupportSQLiteOpenHelper;->getWritableDatabase()Landroidx/sqlite/db/SupportSQLiteDatabase;
move-result-object v0
invoke-interface {v0}, Landroidx/sqlite/db/SupportSQLiteDatabase;->setTransactionSuccessful()V
return-void
.end method