318 lines
7.1 KiB
Smali
318 lines
7.1 KiB
Smali
.class public Landroidx/room/util/DBUtil;
|
|
.super Ljava/lang/Object;
|
|
.source "DBUtil.java"
|
|
|
|
|
|
# direct methods
|
|
.method private constructor <init>()V
|
|
.locals 0
|
|
|
|
.line 173
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static createCancellationSignal()Landroid/os/CancellationSignal;
|
|
.locals 2
|
|
|
|
.line 167
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x10
|
|
|
|
if-lt v0, v1, :cond_0
|
|
|
|
.line 168
|
|
new-instance v0, Landroid/os/CancellationSignal;
|
|
|
|
invoke-direct {v0}, Landroid/os/CancellationSignal;-><init>()V
|
|
|
|
return-object v0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static dropFtsSyncTriggers(Landroidx/sqlite/db/SupportSQLiteDatabase;)V
|
|
.locals 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_0
|
|
:try_start_0
|
|
invoke-interface {v1}, Landroid/database/Cursor;->moveToNext()Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_0
|
|
|
|
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_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
goto :goto_0
|
|
|
|
.line 118
|
|
:cond_0
|
|
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_1
|
|
:goto_1
|
|
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_2
|
|
|
|
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_1
|
|
|
|
.line 123
|
|
new-instance v2, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v3, "DROP TRIGGER IF EXISTS "
|
|
|
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-interface {p0, v1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->execSQL(Ljava/lang/String;)V
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
.line 118
|
|
invoke-interface {v1}, Landroid/database/Cursor;->close()V
|
|
|
|
.line 119
|
|
throw p0
|
|
.end method
|
|
|
|
.method public static query(Landroidx/room/RoomDatabase;Landroidx/sqlite/db/SupportSQLiteQuery;Z)Landroid/database/Cursor;
|
|
.locals 1
|
|
.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;
|
|
.locals 2
|
|
|
|
.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_2
|
|
|
|
.line 84
|
|
instance-of p1, p0, Landroid/database/AbstractWindowedCursor;
|
|
|
|
if-eqz p1, :cond_2
|
|
|
|
.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_0
|
|
|
|
.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_0
|
|
|
|
:cond_0
|
|
move p3, p2
|
|
|
|
.line 93
|
|
:goto_0
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x17
|
|
|
|
if-lt v0, v1, :cond_1
|
|
|
|
if-ge p3, p2, :cond_2
|
|
|
|
.line 94
|
|
:cond_1
|
|
invoke-static {p1}, Landroidx/room/util/CursorUtil;->copyAndClose(Landroid/database/Cursor;)Landroid/database/Cursor;
|
|
|
|
move-result-object p0
|
|
|
|
:cond_2
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readVersion(Ljava/io/File;)I
|
|
.locals 10
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x4
|
|
|
|
const/4 v1, 0x0
|
|
|
|
.line 142
|
|
:try_start_0
|
|
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_1
|
|
|
|
.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_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
.line 154
|
|
invoke-virtual {v1}, Ljava/nio/channels/FileChannel;->close()V
|
|
|
|
:cond_0
|
|
return p0
|
|
|
|
.line 148
|
|
:cond_1
|
|
:try_start_1
|
|
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_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
if-eqz v1, :cond_2
|
|
|
|
.line 154
|
|
invoke-virtual {v1}, Ljava/nio/channels/FileChannel;->close()V
|
|
|
|
.line 156
|
|
:cond_2
|
|
throw p0
|
|
.end method
|