apkfuckery/com.discord/smali/androidx/room/RoomDatabase$MigrationContainer.smali
2020-11-21 22:11:07 +00:00

328 lines
7.4 KiB
Smali

.class public Landroidx/room/RoomDatabase$MigrationContainer;
.super Ljava/lang/Object;
.source "RoomDatabase.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Landroidx/room/RoomDatabase;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x9
name = "MigrationContainer"
.end annotation
# instance fields
.field private mMigrations:Ljava/util/HashMap;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/HashMap<",
"Ljava/lang/Integer;",
"Ljava/util/TreeMap<",
"Ljava/lang/Integer;",
"Landroidx/room/migration/Migration;",
">;>;"
}
.end annotation
.end field
# direct methods
.method public constructor <init>()V
.locals 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Landroidx/room/RoomDatabase$MigrationContainer;->mMigrations:Ljava/util/HashMap;
return-void
.end method
.method private addMigration(Landroidx/room/migration/Migration;)V
.locals 5
iget v0, p1, Landroidx/room/migration/Migration;->startVersion:I
iget v1, p1, Landroidx/room/migration/Migration;->endVersion:I
iget-object v2, p0, Landroidx/room/RoomDatabase$MigrationContainer;->mMigrations:Ljava/util/HashMap;
invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v3
invoke-virtual {v2, v3}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/util/TreeMap;
if-nez v2, :cond_0
new-instance v2, Ljava/util/TreeMap;
invoke-direct {v2}, Ljava/util/TreeMap;-><init>()V
iget-object v3, p0, Landroidx/room/RoomDatabase$MigrationContainer;->mMigrations:Ljava/util/HashMap;
invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v0
invoke-virtual {v3, v0, v2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
:cond_0
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v0
invoke-virtual {v2, v0}, Ljava/util/TreeMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroidx/room/migration/Migration;
if-eqz v0, :cond_1
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "Overriding migration "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
const-string v0, " with "
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
const-string v3, "ROOM"
invoke-static {v3, v0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
:cond_1
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v0
invoke-virtual {v2, v0, p1}, Ljava/util/TreeMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
return-void
.end method
.method private findUpMigrationPath(Ljava/util/List;ZII)Ljava/util/List;
.locals 6
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/List<",
"Landroidx/room/migration/Migration;",
">;ZII)",
"Ljava/util/List<",
"Landroidx/room/migration/Migration;",
">;"
}
.end annotation
:cond_0
if-eqz p2, :cond_1
if-ge p3, p4, :cond_8
goto :goto_0
:cond_1
if-le p3, p4, :cond_8
:goto_0
iget-object v0, p0, Landroidx/room/RoomDatabase$MigrationContainer;->mMigrations:Ljava/util/HashMap;
invoke-static {p3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/util/TreeMap;
const/4 v1, 0x0
if-nez v0, :cond_2
return-object v1
:cond_2
if-eqz p2, :cond_3
invoke-virtual {v0}, Ljava/util/TreeMap;->descendingKeySet()Ljava/util/NavigableSet;
move-result-object v2
goto :goto_1
:cond_3
invoke-virtual {v0}, Ljava/util/TreeMap;->keySet()Ljava/util/Set;
move-result-object v2
:goto_1
invoke-interface {v2}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object v2
:cond_4
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
move-result v3
const/4 v4, 0x1
const/4 v5, 0x0
if-eqz v3, :cond_7
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v3
check-cast v3, Ljava/lang/Integer;
invoke-virtual {v3}, Ljava/lang/Integer;->intValue()I
move-result v3
if-eqz p2, :cond_5
if-gt v3, p4, :cond_6
if-le v3, p3, :cond_6
:goto_2
const/4 v5, 0x1
goto :goto_3
:cond_5
if-lt v3, p4, :cond_6
if-ge v3, p3, :cond_6
goto :goto_2
:cond_6
:goto_3
if-eqz v5, :cond_4
invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object p3
invoke-virtual {v0, p3}, Ljava/util/TreeMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p3
invoke-interface {p1, p3}, Ljava/util/List;->add(Ljava/lang/Object;)Z
move p3, v3
goto :goto_4
:cond_7
const/4 v4, 0x0
:goto_4
if-nez v4, :cond_0
return-object v1
:cond_8
return-object p1
.end method
# virtual methods
.method public varargs addMigrations([Landroidx/room/migration/Migration;)V
.locals 3
.param p1 # [Landroidx/room/migration/Migration;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
array-length v0, p1
const/4 v1, 0x0
:goto_0
if-ge v1, v0, :cond_0
aget-object v2, p1, v1
invoke-direct {p0, v2}, Landroidx/room/RoomDatabase$MigrationContainer;->addMigration(Landroidx/room/migration/Migration;)V
add-int/lit8 v1, v1, 0x1
goto :goto_0
:cond_0
return-void
.end method
.method public findMigrationPath(II)Ljava/util/List;
.locals 2
.annotation build Landroidx/annotation/Nullable;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(II)",
"Ljava/util/List<",
"Landroidx/room/migration/Migration;",
">;"
}
.end annotation
if-ne p1, p2, :cond_0
invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
move-result-object p1
return-object p1
:cond_0
if-le p2, p1, :cond_1
const/4 v0, 0x1
goto :goto_0
:cond_1
const/4 v0, 0x0
:goto_0
new-instance v1, Ljava/util/ArrayList;
invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V
invoke-direct {p0, v1, v0, p1, p2}, Landroidx/room/RoomDatabase$MigrationContainer;->findUpMigrationPath(Ljava/util/List;ZII)Ljava/util/List;
move-result-object p1
return-object p1
.end method