apkfuckery/com.discord/smali/androidx/savedstate/Recreator.smali

242 lines
6.7 KiB
Smali
Raw Normal View History

2019-12-06 03:29:40 +00:00
.class public final Landroidx/savedstate/Recreator;
2019-10-07 23:23:22 +00:00
.super Ljava/lang/Object;
.source "Recreator.java"
# interfaces
.implements Landroidx/lifecycle/GenericLifecycleObserver;
# annotations
2019-12-06 03:29:40 +00:00
.annotation build Landroid/annotation/SuppressLint;
value = {
"RestrictedApi"
}
.end annotation
2019-10-07 23:23:22 +00:00
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Landroidx/savedstate/Recreator$SavedStateProvider;
}
.end annotation
# static fields
2019-12-06 03:29:40 +00:00
.field public static final CLASSES_KEY:Ljava/lang/String; = "classes_to_restore"
2019-10-07 23:23:22 +00:00
2019-12-06 03:29:40 +00:00
.field public static final COMPONENT_KEY:Ljava/lang/String; = "androidx.savedstate.Restarter"
2019-10-07 23:23:22 +00:00
# instance fields
2019-12-06 03:29:40 +00:00
.field public final mOwner:Landroidx/savedstate/SavedStateRegistryOwner;
2019-10-07 23:23:22 +00:00
# direct methods
2019-12-06 03:29:40 +00:00
.method public constructor <init>(Landroidx/savedstate/SavedStateRegistryOwner;)V
2019-10-07 23:23:22 +00:00
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Landroidx/savedstate/Recreator;->mOwner:Landroidx/savedstate/SavedStateRegistryOwner;
return-void
.end method
.method private reflectiveNew(Ljava/lang/String;)V
.locals 4
:try_start_0
const-class v0, Landroidx/savedstate/Recreator;
invoke-virtual {v0}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader;
move-result-object v0
const/4 v1, 0x0
invoke-static {p1, v1, v0}, Ljava/lang/Class;->forName(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;
move-result-object v0
const-class v2, Landroidx/savedstate/SavedStateRegistry$AutoRecreated;
invoke-virtual {v0, v2}, Ljava/lang/Class;->asSubclass(Ljava/lang/Class;)Ljava/lang/Class;
move-result-object v0
:try_end_0
.catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_0} :catch_2
:try_start_1
new-array v2, v1, [Ljava/lang/Class;
invoke-virtual {v0, v2}, Ljava/lang/Class;->getDeclaredConstructor([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;
move-result-object v0
:try_end_1
.catch Ljava/lang/NoSuchMethodException; {:try_start_1 .. :try_end_1} :catch_1
const/4 v2, 0x1
invoke-virtual {v0, v2}, Ljava/lang/reflect/Constructor;->setAccessible(Z)V
:try_start_2
new-array v1, v1, [Ljava/lang/Object;
invoke-virtual {v0, v1}, Ljava/lang/reflect/Constructor;->newInstance([Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroidx/savedstate/SavedStateRegistry$AutoRecreated;
:try_end_2
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0
iget-object p1, p0, Landroidx/savedstate/Recreator;->mOwner:Landroidx/savedstate/SavedStateRegistryOwner;
invoke-interface {v0, p1}, Landroidx/savedstate/SavedStateRegistry$AutoRecreated;->onRecreated(Landroidx/savedstate/SavedStateRegistryOwner;)V
return-void
:catch_0
move-exception v0
new-instance v1, Ljava/lang/RuntimeException;
const-string v2, "Failed to instantiate "
2020-05-11 19:22:21 +00:00
invoke-static {v2, p1}, Lf/e/b/a/a;->a(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
2019-10-07 23:23:22 +00:00
move-result-object p1
invoke-direct {v1, p1, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
throw v1
:catch_1
move-exception p1
new-instance v1, Ljava/lang/IllegalStateException;
2019-12-06 03:29:40 +00:00
const-string v2, "Class"
2019-10-07 23:23:22 +00:00
2020-05-11 19:22:21 +00:00
invoke-static {v2}, Lf/e/b/a/a;->a(Ljava/lang/String;)Ljava/lang/StringBuilder;
2019-10-07 23:23:22 +00:00
2019-12-06 03:29:40 +00:00
move-result-object v2
2019-10-07 23:23:22 +00:00
invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
move-result-object v0
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v0, " must have default constructor in order to be automatically recreated"
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-direct {v1, v0, p1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
throw v1
:catch_2
move-exception v0
new-instance v1, Ljava/lang/RuntimeException;
2019-12-06 03:29:40 +00:00
const-string v2, "Class "
2019-10-07 23:23:22 +00:00
2019-12-06 03:29:40 +00:00
const-string v3, " wasn\'t found"
2019-10-07 23:23:22 +00:00
2020-05-11 19:22:21 +00:00
invoke-static {v2, p1, v3}, Lf/e/b/a/a;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
2019-10-07 23:23:22 +00:00
move-result-object p1
invoke-direct {v1, p1, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
throw v1
.end method
# virtual methods
2019-12-06 03:29:40 +00:00
.method public onStateChanged(Landroidx/lifecycle/LifecycleOwner;Landroidx/lifecycle/Lifecycle$Event;)V
2019-10-07 23:23:22 +00:00
.locals 1
sget-object v0, Landroidx/lifecycle/Lifecycle$Event;->ON_CREATE:Landroidx/lifecycle/Lifecycle$Event;
if-ne p2, v0, :cond_3
invoke-interface {p1}, Landroidx/lifecycle/LifecycleOwner;->getLifecycle()Landroidx/lifecycle/Lifecycle;
move-result-object p1
invoke-virtual {p1, p0}, Landroidx/lifecycle/Lifecycle;->removeObserver(Landroidx/lifecycle/LifecycleObserver;)V
iget-object p1, p0, Landroidx/savedstate/Recreator;->mOwner:Landroidx/savedstate/SavedStateRegistryOwner;
invoke-interface {p1}, Landroidx/savedstate/SavedStateRegistryOwner;->getSavedStateRegistry()Landroidx/savedstate/SavedStateRegistry;
move-result-object p1
const-string p2, "androidx.savedstate.Restarter"
invoke-virtual {p1, p2}, Landroidx/savedstate/SavedStateRegistry;->consumeRestoredStateForKey(Ljava/lang/String;)Landroid/os/Bundle;
move-result-object p1
if-nez p1, :cond_0
return-void
:cond_0
const-string p2, "classes_to_restore"
invoke-virtual {p1, p2}, Landroid/os/Bundle;->getStringArrayList(Ljava/lang/String;)Ljava/util/ArrayList;
move-result-object p1
if-eqz p1, :cond_2
invoke-virtual {p1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;
move-result-object p1
:goto_0
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
move-result p2
if-eqz p2, :cond_1
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object p2
check-cast p2, Ljava/lang/String;
invoke-direct {p0, p2}, Landroidx/savedstate/Recreator;->reflectiveNew(Ljava/lang/String;)V
goto :goto_0
:cond_1
return-void
:cond_2
new-instance p1, Ljava/lang/IllegalStateException;
const-string p2, "Bundle with restored state for the component \"androidx.savedstate.Restarter\" must contain list of strings by the key \"classes_to_restore\""
invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p1
:cond_3
new-instance p1, Ljava/lang/AssertionError;
const-string p2, "Next event must be ON_CREATE"
invoke-direct {p1, p2}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
throw p1
.end method