.class public final Landroidx/savedstate/Recreator; .super Ljava/lang/Object; .source "Recreator.kt" # interfaces .implements Landroidx/lifecycle/LifecycleEventObserver; # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Landroidx/savedstate/Recreator$Companion;, Landroidx/savedstate/Recreator$SavedStateProvider; } .end annotation .annotation runtime Lkotlin/Metadata; d1 = { "\u0000.\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0010\u000e\n\u0002\u0008\u0003\u0008\u0000\u0018\u0000 \u000e2\u00020\u0001:\u0002\u000e\u000fB\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u00a2\u0006\u0002\u0010\u0004J\u0018\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\u00082\u0006\u0010\t\u001a\u00020\nH\u0016J\u0010\u0010\u000b\u001a\u00020\u00062\u0006\u0010\u000c\u001a\u00020\rH\u0002R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004\u00a2\u0006\u0002\n\u0000\u00a8\u0006\u0010" } d2 = { "Landroidx/savedstate/Recreator;", "Landroidx/lifecycle/LifecycleEventObserver;", "owner", "Landroidx/savedstate/SavedStateRegistryOwner;", "(Landroidx/savedstate/SavedStateRegistryOwner;)V", "onStateChanged", "", "source", "Landroidx/lifecycle/LifecycleOwner;", "event", "Landroidx/lifecycle/Lifecycle$Event;", "reflectiveNew", "className", "", "Companion", "SavedStateProvider", "savedstate_release" } k = 0x1 mv = { 0x1, 0x8, 0x0 } xi = 0x30 .end annotation # static fields .field public static final CLASSES_KEY:Ljava/lang/String; = "classes_to_restore" .field public static final COMPONENT_KEY:Ljava/lang/String; = "androidx.savedstate.Restarter" .field public static final Companion:Landroidx/savedstate/Recreator$Companion; # instance fields .field private final owner:Landroidx/savedstate/SavedStateRegistryOwner; # direct methods .method static constructor ()V .locals 2 new-instance v0, Landroidx/savedstate/Recreator$Companion; const/4 v1, 0x0 invoke-direct {v0, v1}, Landroidx/savedstate/Recreator$Companion;->(Lkotlin/jvm/internal/DefaultConstructorMarker;)V sput-object v0, Landroidx/savedstate/Recreator;->Companion:Landroidx/savedstate/Recreator$Companion; return-void .end method .method public constructor (Landroidx/savedstate/SavedStateRegistryOwner;)V .locals 1 const-string v0, "owner" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 24 invoke-direct {p0}, Ljava/lang/Object;->()V iput-object p1, p0, Landroidx/savedstate/Recreator;->owner:Landroidx/savedstate/SavedStateRegistryOwner; return-void .end method .method private final reflectiveNew(Ljava/lang/String;)V .locals 4 const-string v0, "Class " :try_start_0 const-class v1, Landroidx/savedstate/Recreator; .line 49 invoke-virtual {v1}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader; move-result-object v1 const/4 v2, 0x0 invoke-static {p1, v2, v1}, Ljava/lang/Class;->forName(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class; move-result-object v1 const-class v3, Landroidx/savedstate/SavedStateRegistry$AutoRecreated; .line 50 invoke-virtual {v1, v3}, Ljava/lang/Class;->asSubclass(Ljava/lang/Class;)Ljava/lang/Class; move-result-object v1 const-string v3, "{\n Class.\u2026class.java)\n }" .line 48 invoke-static {v1, v3}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V :try_end_0 .catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_0} :catch_2 :try_start_1 new-array v3, v2, [Ljava/lang/Class; .line 56 invoke-virtual {v1, v3}, 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 v1, 0x1 .line 63 invoke-virtual {v0, v1}, Ljava/lang/reflect/Constructor;->setAccessible(Z)V :try_start_2 new-array v1, v2, [Ljava/lang/Object; .line 66 invoke-virtual {v0, v1}, Ljava/lang/reflect/Constructor;->newInstance([Ljava/lang/Object;)Ljava/lang/Object; move-result-object v0 const-string v1, "{\n constr\u2026wInstance()\n }" .line 65 invoke-static {v0, v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V check-cast v0, Landroidx/savedstate/SavedStateRegistry$AutoRecreated; :try_end_2 .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0 iget-object p0, p0, Landroidx/savedstate/Recreator;->owner:Landroidx/savedstate/SavedStateRegistryOwner; .line 70 invoke-interface {v0, p0}, Landroidx/savedstate/SavedStateRegistry$AutoRecreated;->onRecreated(Landroidx/savedstate/SavedStateRegistryOwner;)V return-void :catch_0 move-exception p0 .line 68 new-instance v0, Ljava/lang/RuntimeException; new-instance v1, Ljava/lang/StringBuilder; const-string v2, "Failed to instantiate " invoke-direct {v1, v2}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V invoke-virtual {v1, p1}, 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 check-cast p0, Ljava/lang/Throwable; invoke-direct {v0, p1, p0}, Ljava/lang/RuntimeException;->(Ljava/lang/String;Ljava/lang/Throwable;)V throw v0 :catch_1 move-exception p0 .line 58 new-instance p1, Ljava/lang/IllegalStateException; .line 59 new-instance v2, Ljava/lang/StringBuilder; invoke-direct {v2, v0}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V invoke-virtual {v1}, 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; move-result-object v0 const-string v1, " must have default constructor in order to be automatically recreated" invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v0 .line 60 check-cast p0, Ljava/lang/Throwable; .line 58 invoke-direct {p1, v0, p0}, Ljava/lang/IllegalStateException;->(Ljava/lang/String;Ljava/lang/Throwable;)V throw p1 :catch_2 move-exception p0 .line 52 new-instance v1, Ljava/lang/RuntimeException; new-instance v2, Ljava/lang/StringBuilder; invoke-direct {v2, v0}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object p1 const-string v0, " wasn\'t found" invoke-virtual {p1, v0}, 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 check-cast p0, Ljava/lang/Throwable; invoke-direct {v1, p1, p0}, Ljava/lang/RuntimeException;->(Ljava/lang/String;Ljava/lang/Throwable;)V throw v1 .end method # virtual methods .method public onStateChanged(Landroidx/lifecycle/LifecycleOwner;Landroidx/lifecycle/Lifecycle$Event;)V .locals 1 const-string v0, "source" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const-string v0, "event" invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 29 sget-object v0, Landroidx/lifecycle/Lifecycle$Event;->ON_CREATE:Landroidx/lifecycle/Lifecycle$Event; if-ne p2, v0, :cond_3 .line 32 invoke-interface {p1}, Landroidx/lifecycle/LifecycleOwner;->getLifecycle()Landroidx/lifecycle/Lifecycle; move-result-object p1 move-object p2, p0 check-cast p2, Landroidx/lifecycle/LifecycleObserver; invoke-virtual {p1, p2}, Landroidx/lifecycle/Lifecycle;->removeObserver(Landroidx/lifecycle/LifecycleObserver;)V iget-object p1, p0, Landroidx/savedstate/Recreator;->owner:Landroidx/savedstate/SavedStateRegistryOwner; .line 33 invoke-interface {p1}, Landroidx/savedstate/SavedStateRegistryOwner;->getSavedStateRegistry()Landroidx/savedstate/SavedStateRegistry; move-result-object p1 const-string p2, "androidx.savedstate.Restarter" .line 34 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" .line 35 invoke-virtual {p1, p2}, Landroid/os/Bundle;->getStringArrayList(Ljava/lang/String;)Ljava/util/ArrayList; move-result-object p1 if-eqz p1, :cond_2 check-cast p1, Ljava/util/List; .line 41 invoke-interface {p1}, Ljava/util/List;->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; .line 42 invoke-direct {p0, p2}, Landroidx/savedstate/Recreator;->reflectiveNew(Ljava/lang/String;)V goto :goto_0 :cond_1 return-void .line 36 :cond_2 new-instance p0, Ljava/lang/IllegalStateException; const-string p1, "Bundle with restored state for the component \"androidx.savedstate.Restarter\" must contain list of strings by the key \"classes_to_restore\"" invoke-direct {p0, p1}, Ljava/lang/IllegalStateException;->(Ljava/lang/String;)V throw p0 .line 30 :cond_3 new-instance p0, Ljava/lang/AssertionError; const-string p1, "Next event must be ON_CREATE" invoke-direct {p0, p1}, Ljava/lang/AssertionError;->(Ljava/lang/Object;)V throw p0 .end method