Rabbit-R1/original r1/smali/smali_classes2/androidx/room/paging/LimitOffsetDataSource.smali
2024-05-21 17:08:36 -04:00

660 lines
18 KiB
Smali

.class public abstract Landroidx/room/paging/LimitOffsetDataSource;
.super Landroidx/paging/PositionalDataSource;
.source "LimitOffsetDataSource.java"
# annotations
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">",
"Landroidx/paging/PositionalDataSource<",
"TT;>;"
}
.end annotation
# instance fields
.field private final mCountQuery:Ljava/lang/String;
.field private final mDb:Landroidx/room/RoomDatabase;
.field private final mInTransaction:Z
.field private final mLimitOffsetQuery:Ljava/lang/String;
.field private final mObserver:Landroidx/room/InvalidationTracker$Observer;
.field private final mRegisteredObserver:Ljava/util/concurrent/atomic/AtomicBoolean;
.field private final mSourceQuery:Landroidx/room/RoomSQLiteQuery;
# direct methods
.method protected varargs constructor <init>(Landroidx/room/RoomDatabase;Landroidx/room/RoomSQLiteQuery;ZZ[Ljava/lang/String;)V
.locals 2
.line 94
invoke-direct {p0}, Landroidx/paging/PositionalDataSource;-><init>()V
.line 61
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/paging/LimitOffsetDataSource;->mRegisteredObserver:Ljava/util/concurrent/atomic/AtomicBoolean;
iput-object p1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
iput-object p2, p0, Landroidx/room/paging/LimitOffsetDataSource;->mSourceQuery:Landroidx/room/RoomSQLiteQuery;
iput-boolean p3, p0, Landroidx/room/paging/LimitOffsetDataSource;->mInTransaction:Z
.line 98
new-instance p1, Ljava/lang/StringBuilder;
const-string p3, "SELECT COUNT(*) FROM ( "
invoke-direct {p1, p3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p2}, Landroidx/room/RoomSQLiteQuery;->getSql()Ljava/lang/String;
move-result-object p3
invoke-virtual {p1, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p1
const-string p3, " )"
invoke-virtual {p1, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p1
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
iput-object p1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mCountQuery:Ljava/lang/String;
.line 99
new-instance p1, Ljava/lang/StringBuilder;
const-string p3, "SELECT * FROM ( "
invoke-direct {p1, p3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p2}, Landroidx/room/RoomSQLiteQuery;->getSql()Ljava/lang/String;
move-result-object p2
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p1
const-string p2, " ) LIMIT ? OFFSET ?"
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p1
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
iput-object p1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mLimitOffsetQuery:Ljava/lang/String;
.line 100
new-instance p1, Landroidx/room/paging/LimitOffsetDataSource$1;
invoke-direct {p1, p0, p5}, Landroidx/room/paging/LimitOffsetDataSource$1;-><init>(Landroidx/room/paging/LimitOffsetDataSource;[Ljava/lang/String;)V
iput-object p1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mObserver:Landroidx/room/InvalidationTracker$Observer;
if-eqz p4, :cond_0
.line 107
invoke-direct {p0}, Landroidx/room/paging/LimitOffsetDataSource;->registerObserverIfNecessary()V
:cond_0
return-void
.end method
.method protected varargs constructor <init>(Landroidx/room/RoomDatabase;Landroidx/room/RoomSQLiteQuery;Z[Ljava/lang/String;)V
.locals 6
const/4 v4, 0x1
move-object v0, p0
move-object v1, p1
move-object v2, p2
move v3, p3
move-object v5, p4
.line 86
invoke-direct/range {v0 .. v5}, Landroidx/room/paging/LimitOffsetDataSource;-><init>(Landroidx/room/RoomDatabase;Landroidx/room/RoomSQLiteQuery;ZZ[Ljava/lang/String;)V
return-void
.end method
.method protected varargs constructor <init>(Landroidx/room/RoomDatabase;Landroidx/sqlite/db/SupportSQLiteQuery;ZZ[Ljava/lang/String;)V
.locals 6
.line 77
invoke-static {p2}, Landroidx/room/RoomSQLiteQuery;->copyFrom(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroidx/room/RoomSQLiteQuery;
move-result-object v2
move-object v0, p0
move-object v1, p1
move v3, p3
move v4, p4
move-object v5, p5
invoke-direct/range {v0 .. v5}, Landroidx/room/paging/LimitOffsetDataSource;-><init>(Landroidx/room/RoomDatabase;Landroidx/room/RoomSQLiteQuery;ZZ[Ljava/lang/String;)V
return-void
.end method
.method protected varargs constructor <init>(Landroidx/room/RoomDatabase;Landroidx/sqlite/db/SupportSQLiteQuery;Z[Ljava/lang/String;)V
.locals 0
.line 68
invoke-static {p2}, Landroidx/room/RoomSQLiteQuery;->copyFrom(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroidx/room/RoomSQLiteQuery;
move-result-object p2
invoke-direct {p0, p1, p2, p3, p4}, Landroidx/room/paging/LimitOffsetDataSource;-><init>(Landroidx/room/RoomDatabase;Landroidx/room/RoomSQLiteQuery;Z[Ljava/lang/String;)V
return-void
.end method
.method private getSQLiteQuery(II)Landroidx/room/RoomSQLiteQuery;
.locals 3
iget-object v0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mLimitOffsetQuery:Ljava/lang/String;
iget-object v1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mSourceQuery:Landroidx/room/RoomSQLiteQuery;
.line 233
invoke-virtual {v1}, Landroidx/room/RoomSQLiteQuery;->getArgCount()I
move-result v1
add-int/lit8 v1, v1, 0x2
.line 232
invoke-static {v0, v1}, Landroidx/room/RoomSQLiteQuery;->acquire(Ljava/lang/String;I)Landroidx/room/RoomSQLiteQuery;
move-result-object v0
iget-object p0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mSourceQuery:Landroidx/room/RoomSQLiteQuery;
.line 234
invoke-virtual {v0, p0}, Landroidx/room/RoomSQLiteQuery;->copyArgumentsFrom(Landroidx/room/RoomSQLiteQuery;)V
.line 235
invoke-virtual {v0}, Landroidx/room/RoomSQLiteQuery;->getArgCount()I
move-result p0
add-int/lit8 p0, p0, -0x1
int-to-long v1, p2
invoke-virtual {v0, p0, v1, v2}, Landroidx/room/RoomSQLiteQuery;->bindLong(IJ)V
.line 236
invoke-virtual {v0}, Landroidx/room/RoomSQLiteQuery;->getArgCount()I
move-result p0
int-to-long p1, p1
invoke-virtual {v0, p0, p1, p2}, Landroidx/room/RoomSQLiteQuery;->bindLong(IJ)V
return-object v0
.end method
.method private registerObserverIfNecessary()V
.locals 3
iget-object v0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mRegisteredObserver:Ljava/util/concurrent/atomic/AtomicBoolean;
const/4 v1, 0x0
const/4 v2, 0x1
.line 112
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/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
.line 113
invoke-virtual {v0}, Landroidx/room/RoomDatabase;->getInvalidationTracker()Landroidx/room/InvalidationTracker;
move-result-object v0
iget-object p0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mObserver:Landroidx/room/InvalidationTracker$Observer;
invoke-virtual {v0, p0}, Landroidx/room/InvalidationTracker;->addWeakObserver(Landroidx/room/InvalidationTracker$Observer;)V
:cond_0
return-void
.end method
# virtual methods
.method protected abstract convertRows(Landroid/database/Cursor;)Ljava/util/List;
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/database/Cursor;",
")",
"Ljava/util/List<",
"TT;>;"
}
.end annotation
.end method
.method public countItems()I
.locals 3
.line 124
invoke-direct {p0}, Landroidx/room/paging/LimitOffsetDataSource;->registerObserverIfNecessary()V
iget-object v0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mCountQuery:Ljava/lang/String;
iget-object v1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mSourceQuery:Landroidx/room/RoomSQLiteQuery;
.line 126
invoke-virtual {v1}, Landroidx/room/RoomSQLiteQuery;->getArgCount()I
move-result v1
.line 125
invoke-static {v0, v1}, Landroidx/room/RoomSQLiteQuery;->acquire(Ljava/lang/String;I)Landroidx/room/RoomSQLiteQuery;
move-result-object v0
iget-object v1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mSourceQuery:Landroidx/room/RoomSQLiteQuery;
.line 127
invoke-virtual {v0, v1}, Landroidx/room/RoomSQLiteQuery;->copyArgumentsFrom(Landroidx/room/RoomSQLiteQuery;)V
iget-object p0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
.line 128
invoke-virtual {p0, v0}, Landroidx/room/RoomDatabase;->query(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroid/database/Cursor;
move-result-object p0
.line 130
:try_start_0
invoke-interface {p0}, Landroid/database/Cursor;->moveToFirst()Z
move-result v1
const/4 v2, 0x0
if-eqz v1, :cond_0
.line 131
invoke-interface {p0, v2}, Landroid/database/Cursor;->getInt(I)I
move-result v1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 135
invoke-interface {p0}, Landroid/database/Cursor;->close()V
.line 136
invoke-virtual {v0}, Landroidx/room/RoomSQLiteQuery;->release()V
return v1
.line 135
:cond_0
invoke-interface {p0}, Landroid/database/Cursor;->close()V
.line 136
invoke-virtual {v0}, Landroidx/room/RoomSQLiteQuery;->release()V
return v2
:catchall_0
move-exception v1
.line 135
invoke-interface {p0}, Landroid/database/Cursor;->close()V
.line 136
invoke-virtual {v0}, Landroidx/room/RoomSQLiteQuery;->release()V
.line 137
throw v1
.end method
.method public isInvalid()Z
.locals 1
.line 142
invoke-direct {p0}, Landroidx/room/paging/LimitOffsetDataSource;->registerObserverIfNecessary()V
iget-object v0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
.line 143
invoke-virtual {v0}, Landroidx/room/RoomDatabase;->getInvalidationTracker()Landroidx/room/InvalidationTracker;
move-result-object v0
invoke-virtual {v0}, Landroidx/room/InvalidationTracker;->refreshVersionsSync()V
.line 144
invoke-super {p0}, Landroidx/paging/PositionalDataSource;->isInvalid()Z
move-result p0
return p0
.end method
.method public loadInitial(Landroidx/paging/PositionalDataSource$LoadInitialParams;Landroidx/paging/PositionalDataSource$LoadInitialCallback;)V
.locals 6
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroidx/paging/PositionalDataSource$LoadInitialParams;",
"Landroidx/paging/PositionalDataSource$LoadInitialCallback<",
"TT;>;)V"
}
.end annotation
.line 155
invoke-direct {p0}, Landroidx/room/paging/LimitOffsetDataSource;->registerObserverIfNecessary()V
.line 156
invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
move-result-object v0
iget-object v1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
.line 161
invoke-virtual {v1}, Landroidx/room/RoomDatabase;->beginTransaction()V
const/4 v1, 0x0
.line 163
:try_start_0
invoke-virtual {p0}, Landroidx/room/paging/LimitOffsetDataSource;->countItems()I
move-result v2
if-eqz v2, :cond_0
.line 166
invoke-static {p1, v2}, Landroidx/room/paging/LimitOffsetDataSource;->computeInitialLoadPosition(Landroidx/paging/PositionalDataSource$LoadInitialParams;I)I
move-result v0
.line 167
invoke-static {p1, v0, v2}, Landroidx/room/paging/LimitOffsetDataSource;->computeInitialLoadSize(Landroidx/paging/PositionalDataSource$LoadInitialParams;II)I
move-result p1
.line 169
invoke-direct {p0, v0, p1}, Landroidx/room/paging/LimitOffsetDataSource;->getSQLiteQuery(II)Landroidx/room/RoomSQLiteQuery;
move-result-object p1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_1
:try_start_1
iget-object v3, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
.line 170
invoke-virtual {v3, p1}, Landroidx/room/RoomDatabase;->query(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroid/database/Cursor;
move-result-object v1
.line 171
invoke-virtual {p0, v1}, Landroidx/room/paging/LimitOffsetDataSource;->convertRows(Landroid/database/Cursor;)Ljava/util/List;
move-result-object v3
iget-object v4, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
.line 172
invoke-virtual {v4}, Landroidx/room/RoomDatabase;->setTransactionSuccessful()V
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
move-object v5, v3
move-object v3, p1
move p1, v0
move-object v0, v5
goto :goto_0
:catchall_0
move-exception p2
goto :goto_1
:cond_0
const/4 p1, 0x0
move-object v3, v1
:goto_0
if-eqz v1, :cond_1
.line 177
invoke-interface {v1}, Landroid/database/Cursor;->close()V
:cond_1
iget-object p0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
.line 179
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->endTransaction()V
if-eqz v3, :cond_2
.line 181
invoke-virtual {v3}, Landroidx/room/RoomSQLiteQuery;->release()V
.line 185
:cond_2
invoke-virtual {p2, v0, p1, v2}, Landroidx/paging/PositionalDataSource$LoadInitialCallback;->onResult(Ljava/util/List;II)V
return-void
:catchall_1
move-exception p2
move-object p1, v1
:goto_1
if-eqz v1, :cond_3
.line 177
invoke-interface {v1}, Landroid/database/Cursor;->close()V
:cond_3
iget-object p0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
.line 179
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->endTransaction()V
if-eqz p1, :cond_4
.line 181
invoke-virtual {p1}, Landroidx/room/RoomSQLiteQuery;->release()V
.line 183
:cond_4
throw p2
.end method
.method public loadRange(II)Ljava/util/List;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(II)",
"Ljava/util/List<",
"TT;>;"
}
.end annotation
.line 202
invoke-direct {p0, p1, p2}, Landroidx/room/paging/LimitOffsetDataSource;->getSQLiteQuery(II)Landroidx/room/RoomSQLiteQuery;
move-result-object p1
iget-boolean p2, p0, Landroidx/room/paging/LimitOffsetDataSource;->mInTransaction:Z
if-eqz p2, :cond_2
iget-object p2, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
.line 204
invoke-virtual {p2}, Landroidx/room/RoomDatabase;->beginTransaction()V
const/4 p2, 0x0
:try_start_0
iget-object v0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
.line 208
invoke-virtual {v0, p1}, Landroidx/room/RoomDatabase;->query(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroid/database/Cursor;
move-result-object p2
.line 209
invoke-virtual {p0, p2}, Landroidx/room/paging/LimitOffsetDataSource;->convertRows(Landroid/database/Cursor;)Ljava/util/List;
move-result-object v0
iget-object v1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
.line 210
invoke-virtual {v1}, Landroidx/room/RoomDatabase;->setTransactionSuccessful()V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-eqz p2, :cond_0
.line 214
invoke-interface {p2}, Landroid/database/Cursor;->close()V
:cond_0
iget-object p0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
.line 216
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->endTransaction()V
.line 217
invoke-virtual {p1}, Landroidx/room/RoomSQLiteQuery;->release()V
return-object v0
:catchall_0
move-exception v0
if-eqz p2, :cond_1
.line 214
invoke-interface {p2}, Landroid/database/Cursor;->close()V
:cond_1
iget-object p0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
.line 216
invoke-virtual {p0}, Landroidx/room/RoomDatabase;->endTransaction()V
.line 217
invoke-virtual {p1}, Landroidx/room/RoomSQLiteQuery;->release()V
.line 218
throw v0
:cond_2
iget-object p2, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
.line 220
invoke-virtual {p2, p1}, Landroidx/room/RoomDatabase;->query(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroid/database/Cursor;
move-result-object p2
.line 223
:try_start_1
invoke-virtual {p0, p2}, Landroidx/room/paging/LimitOffsetDataSource;->convertRows(Landroid/database/Cursor;)Ljava/util/List;
move-result-object p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_1
.line 225
invoke-interface {p2}, Landroid/database/Cursor;->close()V
.line 226
invoke-virtual {p1}, Landroidx/room/RoomSQLiteQuery;->release()V
return-object p0
:catchall_1
move-exception p0
.line 225
invoke-interface {p2}, Landroid/database/Cursor;->close()V
.line 226
invoke-virtual {p1}, Landroidx/room/RoomSQLiteQuery;->release()V
.line 227
throw p0
.end method
.method public loadRange(Landroidx/paging/PositionalDataSource$LoadRangeParams;Landroidx/paging/PositionalDataSource$LoadRangeCallback;)V
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroidx/paging/PositionalDataSource$LoadRangeParams;",
"Landroidx/paging/PositionalDataSource$LoadRangeCallback<",
"TT;>;)V"
}
.end annotation
.line 191
iget v0, p1, Landroidx/paging/PositionalDataSource$LoadRangeParams;->startPosition:I
iget p1, p1, Landroidx/paging/PositionalDataSource$LoadRangeParams;->loadSize:I
invoke-virtual {p0, v0, p1}, Landroidx/room/paging/LimitOffsetDataSource;->loadRange(II)Ljava/util/List;
move-result-object p0
invoke-virtual {p2, p0}, Landroidx/paging/PositionalDataSource$LoadRangeCallback;->onResult(Ljava/util/List;)V
return-void
.end method