DBUtil.smali
.class public Landroidx/room/util/DBUtil;
.super Ljava/lang/Object;
.source "SourceFile"
# direct methods
.method private constructor <init>()V
.registers 1
.line 173
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static createCancellationSignal()Landroid/os/CancellationSignal;
.registers 2
.line 167
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x10
if-lt v0, v1, :cond_c
.line 168
new-instance v0, Landroid/os/CancellationSignal;
invoke-direct {v0}, Landroid/os/CancellationSignal;-><init>()V
return-object v0
:cond_c
const/4 v0, 0x0
return-object v0
.end method
.method public static dropFtsSyncTriggers(Landroidx/sqlite/db/SupportSQLiteDatabase;)V
.registers 4
.line 110
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
const-string v1, "SELECT name FROM sqlite_master WHERE type = \'trigger\'"
.line 111
invoke-interface {p0, v1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->query(Ljava/lang/String;)Landroid/database/Cursor;
move-result-object v1
.line 114
:goto_b
:try_start_b
invoke-interface {v1}, Landroid/database/Cursor;->moveToNext()Z
move-result v2
if-eqz v2, :cond_1a
const/4 v2, 0x0
.line 115
invoke-interface {v1, v2}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;
move-result-object v2
invoke-interface {v0, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
:try_end_19
.catchall {:try_start_b .. :try_end_19} :catchall_44
goto :goto_b
.line 118
:cond_1a
invoke-interface {v1}, Landroid/database/Cursor;->close()V
.line 121
invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object v0
:cond_21
:goto_21
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_43
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/lang/String;
const-string v2, "room_fts_content_sync_"
.line 122
invoke-virtual {v1, v2}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v2
if-eqz v2, :cond_21
.line 123
invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
move-result-object v1
const-string v2, "DROP TRIGGER IF EXISTS "
invoke-virtual {v2, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
move-result-object v1
invoke-interface {p0, v1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->execSQL(Ljava/lang/String;)V
goto :goto_21
:cond_43
return-void
:catchall_44
move-exception p0
.line 118
invoke-interface {v1}, Landroid/database/Cursor;->close()V
.line 119
goto :goto_4a
:goto_49
throw p0
:goto_4a
goto :goto_49
.end method
.method public static query(Landroidx/room/RoomDatabase;Landroidx/sqlite/db/SupportSQLiteQuery;Z)Landroid/database/Cursor;
.registers 4
.annotation runtime Ljava/lang/Deprecated;
.end annotation
const/4 v0, 0x0
.line 64
invoke-static {p0, p1, p2, v0}, Landroidx/room/util/DBUtil;->query(Landroidx/room/RoomDatabase;Landroidx/sqlite/db/SupportSQLiteQuery;ZLandroid/os/CancellationSignal;)Landroid/database/Cursor;
move-result-object p0
return-object p0
.end method
.method public static query(Landroidx/room/RoomDatabase;Landroidx/sqlite/db/SupportSQLiteQuery;ZLandroid/os/CancellationSignal;)Landroid/database/Cursor;
.registers 6
.line 83
invoke-virtual {p0, p1, p3}, Landroidx/room/RoomDatabase;->query(Landroidx/sqlite/db/SupportSQLiteQuery;Landroid/os/CancellationSignal;)Landroid/database/Cursor;
move-result-object p0
if-eqz p2, :cond_2d
.line 84
instance-of p1, p0, Landroid/database/AbstractWindowedCursor;
if-eqz p1, :cond_2d
.line 85
move-object p1, p0
check-cast p1, Landroid/database/AbstractWindowedCursor;
.line 86
invoke-virtual {p1}, Landroid/database/AbstractWindowedCursor;->getCount()I
move-result p2
.line 88
invoke-virtual {p1}, Landroid/database/AbstractWindowedCursor;->hasWindow()Z
move-result p3
if-eqz p3, :cond_20
.line 89
invoke-virtual {p1}, Landroid/database/AbstractWindowedCursor;->getWindow()Landroid/database/CursorWindow;
move-result-object p3
invoke-virtual {p3}, Landroid/database/CursorWindow;->getNumRows()I
move-result p3
goto :goto_21
:cond_20
move p3, p2
.line 93
:goto_21
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x17
if-lt v0, v1, :cond_29
if-ge p3, p2, :cond_2d
.line 94
:cond_29
invoke-static {p1}, Landroidx/room/util/CursorUtil;->copyAndClose(Landroid/database/Cursor;)Landroid/database/Cursor;
move-result-object p0
:cond_2d
return-object p0
.end method
.method public static readVersion(Ljava/io/File;)I
.registers 11
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
const/4 v0, 0x4
const/4 v1, 0x0
.line 142
:try_start_2
invoke-static {v0}, Ljava/nio/ByteBuffer;->allocate(I)Ljava/nio/ByteBuffer;
move-result-object v2
.line 143
new-instance v3, Ljava/io/FileInputStream;
invoke-direct {v3, p0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
invoke-virtual {v3}, Ljava/io/FileInputStream;->getChannel()Ljava/nio/channels/FileChannel;
move-result-object v1
const-wide/16 v5, 0x3c
const-wide/16 v7, 0x4
const/4 v9, 0x1
move-object v4, v1
.line 144
invoke-virtual/range {v4 .. v9}, Ljava/nio/channels/FileChannel;->tryLock(JJZ)Ljava/nio/channels/FileLock;
const-wide/16 v3, 0x3c
.line 145
invoke-virtual {v1, v3, v4}, Ljava/nio/channels/FileChannel;->position(J)Ljava/nio/channels/FileChannel;
.line 146
invoke-virtual {v1, v2}, Ljava/nio/channels/FileChannel;->read(Ljava/nio/ByteBuffer;)I
move-result p0
if-ne p0, v0, :cond_30
.line 150
invoke-virtual {v2}, Ljava/nio/ByteBuffer;->rewind()Ljava/nio/Buffer;
.line 151
invoke-virtual {v2}, Ljava/nio/ByteBuffer;->getInt()I
move-result p0
:try_end_2a
.catchall {:try_start_2 .. :try_end_2a} :catchall_38
if-eqz v1, :cond_2f
.line 154
invoke-virtual {v1}, Ljava/nio/channels/FileChannel;->close()V
:cond_2f
return p0
.line 148
:cond_30
:try_start_30
new-instance p0, Ljava/io/IOException;
const-string v0, "Bad database header, unable to read 4 bytes at offset 60"
invoke-direct {p0, v0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw p0
:try_end_38
.catchall {:try_start_30 .. :try_end_38} :catchall_38
:catchall_38
move-exception p0
if-eqz v1, :cond_3e
.line 154
invoke-virtual {v1}, Ljava/nio/channels/FileChannel;->close()V
.line 156
:cond_3e
throw p0
.end method