2020-05-17 12:40:10 +00:00
.class public final L androidx/savedstate/Recreator ;
.super L java/lang/Object ;
.source "Recreator.java"
# interfaces
.implements L androidx/lifecycle/GenericLifecycleObserver ;
# annotations
.annotation build L android/annotation/SuppressLint ;
value = {
"RestrictedApi"
}
.end annotation
.annotation system L dalvik/annotation/MemberClasses ;
value = {
L androidx/savedstate/Recreator$SavedStateProvider ;
}
.end annotation
# static fields
.field public static final CLASSES_KEY : L java/lang/String ; = "classes_to_restore"
.field public static final COMPONENT_KEY : L java/lang/String ; = "androidx.savedstate.Restarter"
# instance fields
.field public final mOwner : L androidx/savedstate/SavedStateRegistryOwner ;
# direct methods
.method public constructor <init> ( L androidx/savedstate/SavedStateRegistryOwner ;) V
.locals 0
invoke-direct { p0 } , L java/lang/Object ;-> <init> ( ) V
iput-object p1 , p0 , L androidx/savedstate/Recreator ;-> mOwner : L androidx/savedstate/SavedStateRegistryOwner ;
return-void
.end method
.method private reflectiveNew ( L java/lang/String ;) V
.locals 4
:try_start_0
const-class v0 , L androidx/savedstate/Recreator ;
invoke-virtual { v0 } , L java/lang/Class ;-> getClassLoader ( ) L java/lang/ClassLoader ;
move-result-object v0
const/4 v1 , 0x0
invoke-static { p1 , v1 , v0 } , L java/lang/Class ;-> forName ( L java/lang/String ;Z L java/lang/ClassLoader ;) L java/lang/Class ;
move-result-object v0
const-class v2 , L androidx/savedstate/SavedStateRegistry$AutoRecreated ;
invoke-virtual { v0 , v2 } , L java/lang/Class ;-> asSubclass ( L java/lang/Class ;) L java/lang/Class ;
move-result-object v0
:try_end_0
.catch L java/lang/ClassNotFoundException ; { :try_start_0 . . :try_end_0 } :catch_2
:try_start_1
new-array v2 , v1 , [ L java/lang/Class ;
invoke-virtual { v0 , v2 } , L java/lang/Class ;-> getDeclaredConstructor ( [ L java/lang/Class ;) L java/lang/reflect/Constructor ;
move-result-object v0
:try_end_1
.catch L java/lang/NoSuchMethodException ; { :try_start_1 . . :try_end_1 } :catch_1
const/4 v2 , 0x1
invoke-virtual { v0 , v2 } , L java/lang/reflect/Constructor ;-> setAccessible ( Z ) V
:try_start_2
new-array v1 , v1 , [ L java/lang/Object ;
invoke-virtual { v0 , v1 } , L java/lang/reflect/Constructor ;-> newInstance ( [ L java/lang/Object ;) L java/lang/Object ;
move-result-object v0
check-cast v0 , L androidx/savedstate/SavedStateRegistry$AutoRecreated ;
:try_end_2
.catch L java/lang/Exception ; { :try_start_2 . . :try_end_2 } :catch_0
iget-object p1 , p0 , L androidx/savedstate/Recreator ;-> mOwner : L androidx/savedstate/SavedStateRegistryOwner ;
invoke-interface { v0 , p1 } , L androidx/savedstate/SavedStateRegistry$AutoRecreated ;-> onRecreated ( L androidx/savedstate/SavedStateRegistryOwner ;) V
return-void
:catch_0
move-exception v0
new-instance v1 , L java/lang/RuntimeException ;
const-string v2 , "Failed to instantiate "
2020-09-23 03:12:49 +00:00
invoke-static { v2 , p1 } , L f/e/c/a/a ;-> q ( L java/lang/String ;L java/lang/String ;) L java/lang/String ;
2020-05-17 12:40:10 +00:00
move-result-object p1
invoke-direct { v1 , p1 , v0 } , L java/lang/RuntimeException ;-> <init> ( L java/lang/String ;L java/lang/Throwable ;) V
throw v1
:catch_1
move-exception p1
new-instance v1 , L java/lang/IllegalStateException ;
const-string v2 , "Class"
2020-09-30 20:48:36 +00:00
invoke-static { v2 } , L f/e/c/a/a ;-> F ( L java/lang/String ;) L java/lang/StringBuilder ;
2020-05-17 12:40:10 +00:00
move-result-object v2
invoke-virtual { v0 } , L java/lang/Class ;-> getSimpleName ( ) L java/lang/String ;
move-result-object v0
invoke-virtual { v2 , v0 } , L java/lang/StringBuilder ;-> append ( L java/lang/String ;) L java/lang/StringBuilder ;
const-string v0 , " must have default constructor in order to be automatically recreated"
invoke-virtual { v2 , v0 } , L java/lang/StringBuilder ;-> append ( L java/lang/String ;) L java/lang/StringBuilder ;
invoke-virtual { v2 } , L java/lang/StringBuilder ;-> toString ( ) L java/lang/String ;
move-result-object v0
invoke-direct { v1 , v0 , p1 } , L java/lang/IllegalStateException ;-> <init> ( L java/lang/String ;L java/lang/Throwable ;) V
throw v1
:catch_2
move-exception v0
new-instance v1 , L java/lang/RuntimeException ;
const-string v2 , "Class "
const-string v3 , " wasn\'t found"
2020-09-23 03:12:49 +00:00
invoke-static { v2 , p1 , v3 } , L f/e/c/a/a ;-> r ( L java/lang/String ;L java/lang/String ;L java/lang/String ;) L java/lang/String ;
2020-05-17 12:40:10 +00:00
move-result-object p1
invoke-direct { v1 , p1 , v0 } , L java/lang/RuntimeException ;-> <init> ( L java/lang/String ;L java/lang/Throwable ;) V
throw v1
.end method
# virtual methods
.method public onStateChanged ( L androidx/lifecycle/LifecycleOwner ;L androidx/lifecycle/Lifecycle$Event ;) V
.locals 1
sget-object v0 , L androidx/lifecycle/Lifecycle$Event ;-> ON_CREATE : L androidx/lifecycle/Lifecycle$Event ;
if-ne p2 , v0 , :cond_3
invoke-interface { p1 } , L androidx/lifecycle/LifecycleOwner ;-> getLifecycle ( ) L androidx/lifecycle/Lifecycle ;
move-result-object p1
invoke-virtual { p1 , p0 } , L androidx/lifecycle/Lifecycle ;-> removeObserver ( L androidx/lifecycle/LifecycleObserver ;) V
iget-object p1 , p0 , L androidx/savedstate/Recreator ;-> mOwner : L androidx/savedstate/SavedStateRegistryOwner ;
invoke-interface { p1 } , L androidx/savedstate/SavedStateRegistryOwner ;-> getSavedStateRegistry ( ) L androidx/savedstate/SavedStateRegistry ;
move-result-object p1
const-string p2 , "androidx.savedstate.Restarter"
invoke-virtual { p1 , p2 } , L androidx/savedstate/SavedStateRegistry ;-> consumeRestoredStateForKey ( L java/lang/String ;) L android/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 } , L android/os/Bundle ;-> getStringArrayList ( L java/lang/String ;) L java/util/ArrayList ;
move-result-object p1
if-eqz p1 , :cond_2
invoke-virtual { p1 } , L java/util/ArrayList ;-> iterator ( ) L java/util/Iterator ;
move-result-object p1
:goto_0
invoke-interface { p1 } , L java/util/Iterator ;-> hasNext ( ) Z
move-result p2
if-eqz p2 , :cond_1
invoke-interface { p1 } , L java/util/Iterator ;-> next ( ) L java/lang/Object ;
move-result-object p2
check-cast p2 , L java/lang/String ;
invoke-direct { p0 , p2 } , L androidx/savedstate/Recreator ;-> reflectiveNew ( L java/lang/String ;) V
goto :goto_0
:cond_1
return-void
:cond_2
new-instance p1 , L java/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 } , L java/lang/IllegalStateException ;-> <init> ( L java/lang/String ;) V
throw p1
:cond_3
new-instance p1 , L java/lang/AssertionError ;
const-string p2 , "Next event must be ON_CREATE"
invoke-direct { p1 , p2 } , L java/lang/AssertionError ;-> <init> ( L java/lang/Object ;) V
throw p1
.end method