2019-12-06 03:29:40 +00:00
.class public L androidx/lifecycle/ClassesInfoCache ;
2019-07-24 11:27:29 +00:00
.super L java/lang/Object ;
.source "ClassesInfoCache.java"
# annotations
.annotation system L dalvik/annotation/MemberClasses ;
value = {
L androidx/lifecycle/ClassesInfoCache$MethodReference ;,
L androidx/lifecycle/ClassesInfoCache$CallbackInfo ;
}
.end annotation
# static fields
2019-12-06 03:29:40 +00:00
.field public static final CALL_TYPE_NO_ARG : I = 0x0
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static final CALL_TYPE_PROVIDER : I = 0x1
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static final CALL_TYPE_PROVIDER_WITH_EVENT : I = 0x2
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static sInstance : L androidx/lifecycle/ClassesInfoCache ;
2019-07-24 11:27:29 +00:00
# instance fields
2019-12-06 03:29:40 +00:00
.field public final mCallbackMap : L java/util/Map ;
2019-07-24 11:27:29 +00:00
.annotation system L dalvik/annotation/Signature ;
value = {
"Ljava/util/Map<" ,
"Ljava/lang/Class;" ,
"Landroidx/lifecycle/ClassesInfoCache$CallbackInfo;" ,
">;"
}
.end annotation
.end field
2019-12-06 03:29:40 +00:00
.field public final mHasLifecycleMethods : L java/util/Map ;
2019-07-24 11:27:29 +00:00
.annotation system L dalvik/annotation/Signature ;
value = {
"Ljava/util/Map<" ,
"Ljava/lang/Class;" ,
"Ljava/lang/Boolean;" ,
">;"
}
.end annotation
.end field
# direct methods
2019-12-06 03:29:40 +00:00
.method public static constructor <clinit> ( ) V
2019-07-24 11:27:29 +00:00
.locals 1
new-instance v0 , L androidx/lifecycle/ClassesInfoCache ;
invoke-direct { v0 } , L androidx/lifecycle/ClassesInfoCache ;-> <init> ( ) V
sput-object v0 , L androidx/lifecycle/ClassesInfoCache ;-> sInstance : L androidx/lifecycle/ClassesInfoCache ;
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public constructor <init> ( ) V
2019-07-24 11:27:29 +00:00
.locals 1
invoke-direct { p0 } , L java/lang/Object ;-> <init> ( ) V
new-instance v0 , L java/util/HashMap ;
invoke-direct { v0 } , L java/util/HashMap ;-> <init> ( ) V
iput-object v0 , p0 , L androidx/lifecycle/ClassesInfoCache ;-> mCallbackMap : L java/util/Map ;
new-instance v0 , L java/util/HashMap ;
invoke-direct { v0 } , L java/util/HashMap ;-> <init> ( ) V
iput-object v0 , p0 , L androidx/lifecycle/ClassesInfoCache ;-> mHasLifecycleMethods : L java/util/Map ;
return-void
.end method
.method private createInfo ( L java/lang/Class ;[ L java/lang/reflect/Method ;) L androidx/lifecycle/ClassesInfoCache$CallbackInfo ;
.locals 11
2019-12-06 03:29:40 +00:00
. param p2 # [Ljava/lang/reflect/Method;
.annotation build L androidx/annotation/Nullable ;
.end annotation
. end param
2019-07-24 11:27:29 +00:00
invoke-virtual { p1 } , L java/lang/Class ;-> getSuperclass ( ) L java/lang/Class ;
move-result-object v0
new-instance v1 , L java/util/HashMap ;
invoke-direct { v1 } , L java/util/HashMap ;-> <init> ( ) V
if-eqz v0 , :cond_0
invoke-virtual { p0 , v0 } , L androidx/lifecycle/ClassesInfoCache ;-> getInfo ( L java/lang/Class ;) L androidx/lifecycle/ClassesInfoCache$CallbackInfo ;
move-result-object v0
if-eqz v0 , :cond_0
iget-object v0 , v0 , L androidx/lifecycle/ClassesInfoCache$CallbackInfo ;-> mHandlerToEvent : L java/util/Map ;
invoke-interface { v1 , v0 } , L java/util/Map ;-> putAll ( L java/util/Map ;) V
:cond_0
invoke-virtual { p1 } , L java/lang/Class ;-> getInterfaces ( ) [ L java/lang/Class ;
move-result-object v0
array-length v2 , v0
const/4 v3 , 0x0
const/4 v4 , 0x0
:goto_0
if-ge v4 , v2 , :cond_2
aget-object v5 , v0 , v4
invoke-virtual { p0 , v5 } , L androidx/lifecycle/ClassesInfoCache ;-> getInfo ( L java/lang/Class ;) L androidx/lifecycle/ClassesInfoCache$CallbackInfo ;
move-result-object v5
iget-object v5 , v5 , L androidx/lifecycle/ClassesInfoCache$CallbackInfo ;-> mHandlerToEvent : L java/util/Map ;
invoke-interface { v5 } , L java/util/Map ;-> entrySet ( ) L java/util/Set ;
move-result-object v5
invoke-interface { v5 } , L java/util/Set ;-> iterator ( ) L java/util/Iterator ;
move-result-object v5
:goto_1
invoke-interface { v5 } , L java/util/Iterator ;-> hasNext ( ) Z
move-result v6
if-eqz v6 , :cond_1
invoke-interface { v5 } , L java/util/Iterator ;-> next ( ) L java/lang/Object ;
move-result-object v6
check-cast v6 , L java/util/Map$Entry ;
invoke-interface { v6 } , L java/util/Map$Entry ;-> getKey ( ) L java/lang/Object ;
move-result-object v7
check-cast v7 , L androidx/lifecycle/ClassesInfoCache$MethodReference ;
invoke-interface { v6 } , L java/util/Map$Entry ;-> getValue ( ) L java/lang/Object ;
move-result-object v6
check-cast v6 , L androidx/lifecycle/Lifecycle$Event ;
invoke-direct { p0 , v1 , v7 , v6 , p1 } , L androidx/lifecycle/ClassesInfoCache ;-> verifyAndPutHandler ( L java/util/Map ;L androidx/lifecycle/ClassesInfoCache$MethodReference ;L androidx/lifecycle/Lifecycle$Event ;L java/lang/Class ;) V
goto :goto_1
:cond_1
add-int/lit8 v4 , v4 , 0x1
goto :goto_0
:cond_2
if-eqz p2 , :cond_3
goto :goto_2
:cond_3
invoke-direct { p0 , p1 } , L androidx/lifecycle/ClassesInfoCache ;-> getDeclaredMethods ( L java/lang/Class ;) [ L java/lang/reflect/Method ;
move-result-object p2
:goto_2
array-length v0 , p2
const/4 v2 , 0x0
const/4 v4 , 0x0
:goto_3
if-ge v2 , v0 , :cond_b
aget-object v5 , p2 , v2
const-class v6 , L androidx/lifecycle/OnLifecycleEvent ;
invoke-virtual { v5 , v6 } , L java/lang/reflect/Method ;-> getAnnotation ( L java/lang/Class ;) L java/lang/annotation/Annotation ;
move-result-object v6
check-cast v6 , L androidx/lifecycle/OnLifecycleEvent ;
const/4 v7 , 0x1
2019-12-06 03:29:40 +00:00
if-nez v6 , :cond_4
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
goto :goto_6
:cond_4
2019-07-24 11:27:29 +00:00
invoke-virtual { v5 } , L java/lang/reflect/Method ;-> getParameterTypes ( ) [ L java/lang/Class ;
move-result-object v4
array-length v8 , v4
2019-12-06 03:29:40 +00:00
if-lez v8 , :cond_6
2019-07-24 11:27:29 +00:00
aget-object v8 , v4 , v3
const-class v9 , L androidx/lifecycle/LifecycleOwner ;
invoke-virtual { v8 , v9 } , L java/lang/Class ;-> isAssignableFrom ( L java/lang/Class ;) Z
move-result v8
2019-12-06 03:29:40 +00:00
if-eqz v8 , :cond_5
2019-07-24 11:27:29 +00:00
const/4 v8 , 0x1
goto :goto_4
2019-12-06 03:29:40 +00:00
:cond_5
2019-07-24 11:27:29 +00:00
new-instance p1 , L java/lang/IllegalArgumentException ;
const-string p2 , "invalid parameter type. Must be one and instanceof LifecycleOwner"
invoke-direct { p1 , p2 } , L java/lang/IllegalArgumentException ;-> <init> ( L java/lang/String ;) V
throw p1
2019-12-06 03:29:40 +00:00
:cond_6
2019-07-24 11:27:29 +00:00
const/4 v8 , 0x0
:goto_4
invoke-interface { v6 } , L androidx/lifecycle/OnLifecycleEvent ;-> value ( ) L androidx/lifecycle/Lifecycle$Event ;
move-result-object v6
array-length v9 , v4
const/4 v10 , 0x2
2019-12-06 03:29:40 +00:00
if-le v9 , v7 , :cond_9
2019-07-24 11:27:29 +00:00
aget-object v8 , v4 , v7
const-class v9 , L androidx/lifecycle/Lifecycle$Event ;
invoke-virtual { v8 , v9 } , L java/lang/Class ;-> isAssignableFrom ( L java/lang/Class ;) Z
move-result v8
2019-12-06 03:29:40 +00:00
if-eqz v8 , :cond_8
2019-07-24 11:27:29 +00:00
sget-object v8 , L androidx/lifecycle/Lifecycle$Event ;-> ON_ANY : L androidx/lifecycle/Lifecycle$Event ;
2019-12-06 03:29:40 +00:00
if-ne v6 , v8 , :cond_7
2019-07-24 11:27:29 +00:00
const/4 v8 , 0x2
goto :goto_5
2019-12-06 03:29:40 +00:00
:cond_7
2019-07-24 11:27:29 +00:00
new-instance p1 , L java/lang/IllegalArgumentException ;
const-string p2 , "Second arg is supported only for ON_ANY value"
invoke-direct { p1 , p2 } , L java/lang/IllegalArgumentException ;-> <init> ( L java/lang/String ;) V
throw p1
2019-12-06 03:29:40 +00:00
:cond_8
2019-07-24 11:27:29 +00:00
new-instance p1 , L java/lang/IllegalArgumentException ;
const-string p2 , "invalid parameter type. second arg must be an event"
invoke-direct { p1 , p2 } , L java/lang/IllegalArgumentException ;-> <init> ( L java/lang/String ;) V
throw p1
2019-12-06 03:29:40 +00:00
:cond_9
2019-07-24 11:27:29 +00:00
:goto_5
array-length v4 , v4
2019-12-06 03:29:40 +00:00
if-gt v4 , v10 , :cond_a
2019-07-24 11:27:29 +00:00
new-instance v4 , L androidx/lifecycle/ClassesInfoCache$MethodReference ;
invoke-direct { v4 , v8 , v5 } , L androidx/lifecycle/ClassesInfoCache$MethodReference ;-> <init> ( I L java/lang/reflect/Method ;) V
invoke-direct { p0 , v1 , v4 , v6 , p1 } , L androidx/lifecycle/ClassesInfoCache ;-> verifyAndPutHandler ( L java/util/Map ;L androidx/lifecycle/ClassesInfoCache$MethodReference ;L androidx/lifecycle/Lifecycle$Event ;L java/lang/Class ;) V
const/4 v4 , 0x1
2019-12-06 03:29:40 +00:00
:goto_6
add-int/lit8 v2 , v2 , 0x1
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
goto :goto_3
:cond_a
2019-07-24 11:27:29 +00:00
new-instance p1 , L java/lang/IllegalArgumentException ;
const-string p2 , "cannot have more than 2 params"
invoke-direct { p1 , p2 } , L java/lang/IllegalArgumentException ;-> <init> ( L java/lang/String ;) V
throw p1
:cond_b
new-instance p2 , L androidx/lifecycle/ClassesInfoCache$CallbackInfo ;
invoke-direct { p2 , v1 } , L androidx/lifecycle/ClassesInfoCache$CallbackInfo ;-> <init> ( L java/util/Map ;) V
iget-object v0 , p0 , L androidx/lifecycle/ClassesInfoCache ;-> mCallbackMap : L java/util/Map ;
invoke-interface { v0 , p1 , p2 } , L java/util/Map ;-> put ( L java/lang/Object ;L java/lang/Object ;) L java/lang/Object ;
iget-object v0 , p0 , L androidx/lifecycle/ClassesInfoCache ;-> mHasLifecycleMethods : L java/util/Map ;
invoke-static { v4 } , L java/lang/Boolean ;-> valueOf ( Z ) L java/lang/Boolean ;
move-result-object v1
invoke-interface { v0 , p1 , v1 } , L java/util/Map ;-> put ( L java/lang/Object ;L java/lang/Object ;) L java/lang/Object ;
return-object p2
.end method
.method private getDeclaredMethods ( L java/lang/Class ;) [ L java/lang/reflect/Method ;
.locals 2
:try_start_0
invoke-virtual { p1 } , L java/lang/Class ;-> getDeclaredMethods ( ) [ L java/lang/reflect/Method ;
move-result-object p1
:try_end_0
.catch L java/lang/NoClassDefFoundError ; { :try_start_0 . . :try_end_0 } :catch_0
return-object p1
:catch_0
move-exception p1
new-instance v0 , L java/lang/IllegalArgumentException ;
const-string v1 , "The observer class has some methods that use newer APIs which are not available in the current OS version. Lifecycles cannot access even other methods so you should make sure that your observer classes only access framework classes that are available in your min API level OR use lifecycle:compiler annotation processor."
invoke-direct { v0 , v1 , p1 } , L java/lang/IllegalArgumentException ;-> <init> ( L java/lang/String ;L java/lang/Throwable ;) V
throw v0
.end method
.method private verifyAndPutHandler ( L java/util/Map ;L androidx/lifecycle/ClassesInfoCache$MethodReference ;L androidx/lifecycle/Lifecycle$Event ;L java/lang/Class ;) V
2019-12-06 03:29:40 +00:00
.locals 2
2019-07-24 11:27:29 +00:00
.annotation system L dalvik/annotation/Signature ;
value = {
"(" ,
"Ljava/util/Map<" ,
"Landroidx/lifecycle/ClassesInfoCache$MethodReference;" ,
"Landroidx/lifecycle/Lifecycle$Event;" ,
">;" ,
"Landroidx/lifecycle/ClassesInfoCache$MethodReference;" ,
"Landroidx/lifecycle/Lifecycle$Event;" ,
"Ljava/lang/Class;" ,
")V"
}
.end annotation
invoke-interface { p1 , p2 } , L java/util/Map ;-> get ( L java/lang/Object ;) L java/lang/Object ;
move-result-object v0
check-cast v0 , L androidx/lifecycle/Lifecycle$Event ;
if-eqz v0 , :cond_1
if-ne p3 , v0 , :cond_0
goto :goto_0
:cond_0
iget-object p1 , p2 , L androidx/lifecycle/ClassesInfoCache$MethodReference ;-> mMethod : L java/lang/reflect/Method ;
new-instance p2 , L java/lang/IllegalArgumentException ;
2019-12-06 03:29:40 +00:00
const-string v1 , "Method "
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
invoke-static { v1 } , L e/e/b/a/a ;-> a ( L java/lang/String ;) L java/lang/StringBuilder ;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
move-result-object v1
2019-07-24 11:27:29 +00:00
invoke-virtual { p1 } , L java/lang/reflect/Method ;-> getName ( ) L java/lang/String ;
move-result-object p1
invoke-virtual { v1 , p1 } , L java/lang/StringBuilder ;-> append ( L java/lang/String ;) L java/lang/StringBuilder ;
const-string p1 , " in "
invoke-virtual { v1 , p1 } , L java/lang/StringBuilder ;-> append ( L java/lang/String ;) L java/lang/StringBuilder ;
invoke-virtual { p4 } , L java/lang/Class ;-> getName ( ) L java/lang/String ;
move-result-object p1
invoke-virtual { v1 , p1 } , L java/lang/StringBuilder ;-> append ( L java/lang/String ;) L java/lang/StringBuilder ;
const-string p1 , " already declared with different @OnLifecycleEvent value: previous value "
invoke-virtual { v1 , p1 } , L java/lang/StringBuilder ;-> append ( L java/lang/String ;) L java/lang/StringBuilder ;
invoke-virtual { v1 , v0 } , L java/lang/StringBuilder ;-> append ( L java/lang/Object ;) L java/lang/StringBuilder ;
const-string p1 , ", new value "
invoke-virtual { v1 , p1 } , L java/lang/StringBuilder ;-> append ( L java/lang/String ;) L java/lang/StringBuilder ;
invoke-virtual { v1 , p3 } , L java/lang/StringBuilder ;-> append ( L java/lang/Object ;) L java/lang/StringBuilder ;
invoke-virtual { v1 } , L java/lang/StringBuilder ;-> toString ( ) L java/lang/String ;
move-result-object p1
invoke-direct { p2 , p1 } , L java/lang/IllegalArgumentException ;-> <init> ( L java/lang/String ;) V
throw p2
:cond_1
:goto_0
if-nez v0 , :cond_2
invoke-interface { p1 , p2 , p3 } , L java/util/Map ;-> put ( L java/lang/Object ;L java/lang/Object ;) L java/lang/Object ;
:cond_2
return-void
.end method
# virtual methods
2019-12-06 03:29:40 +00:00
.method public getInfo ( L java/lang/Class ;) L androidx/lifecycle/ClassesInfoCache$CallbackInfo ;
2019-07-24 11:27:29 +00:00
.locals 1
iget-object v0 , p0 , L androidx/lifecycle/ClassesInfoCache ;-> mCallbackMap : L java/util/Map ;
invoke-interface { v0 , p1 } , L java/util/Map ;-> get ( L java/lang/Object ;) L java/lang/Object ;
move-result-object v0
check-cast v0 , L androidx/lifecycle/ClassesInfoCache$CallbackInfo ;
if-eqz v0 , :cond_0
return-object v0
:cond_0
const/4 v0 , 0x0
invoke-direct { p0 , p1 , v0 } , L androidx/lifecycle/ClassesInfoCache ;-> createInfo ( L java/lang/Class ;[ L java/lang/reflect/Method ;) L androidx/lifecycle/ClassesInfoCache$CallbackInfo ;
move-result-object p1
return-object p1
.end method
2019-12-06 03:29:40 +00:00
.method public hasLifecycleMethods ( L java/lang/Class ;) Z
2019-07-24 11:27:29 +00:00
.locals 6
iget-object v0 , p0 , L androidx/lifecycle/ClassesInfoCache ;-> mHasLifecycleMethods : L java/util/Map ;
invoke-interface { v0 , p1 } , L java/util/Map ;-> get ( L java/lang/Object ;) L java/lang/Object ;
2019-10-07 23:23:22 +00:00
move-result-object v0
2019-07-24 11:27:29 +00:00
2019-10-07 23:23:22 +00:00
check-cast v0 , L java/lang/Boolean ;
if-eqz v0 , :cond_0
2019-07-24 11:27:29 +00:00
2019-10-07 23:23:22 +00:00
invoke-virtual { v0 } , L java/lang/Boolean ;-> booleanValue ( ) Z
2019-07-24 11:27:29 +00:00
move-result p1
return p1
:cond_0
invoke-direct { p0 , p1 } , L androidx/lifecycle/ClassesInfoCache ;-> getDeclaredMethods ( L java/lang/Class ;) [ L java/lang/reflect/Method ;
move-result-object v0
array-length v1 , v0
const/4 v2 , 0x0
const/4 v3 , 0x0
:goto_0
if-ge v3 , v1 , :cond_2
aget-object v4 , v0 , v3
const-class v5 , L androidx/lifecycle/OnLifecycleEvent ;
invoke-virtual { v4 , v5 } , L java/lang/reflect/Method ;-> getAnnotation ( L java/lang/Class ;) L java/lang/annotation/Annotation ;
move-result-object v4
check-cast v4 , L androidx/lifecycle/OnLifecycleEvent ;
if-eqz v4 , :cond_1
invoke-direct { p0 , p1 , v0 } , L androidx/lifecycle/ClassesInfoCache ;-> createInfo ( L java/lang/Class ;[ L java/lang/reflect/Method ;) L androidx/lifecycle/ClassesInfoCache$CallbackInfo ;
const/4 p1 , 0x1
return p1
:cond_1
add-int/lit8 v3 , v3 , 0x1
goto :goto_0
:cond_2
iget-object v0 , p0 , L androidx/lifecycle/ClassesInfoCache ;-> mHasLifecycleMethods : L java/util/Map ;
2019-12-06 03:29:40 +00:00
invoke-static { v2 } , L java/lang/Boolean ;-> valueOf ( Z ) L java/lang/Boolean ;
move-result-object v1
2019-07-24 11:27:29 +00:00
invoke-interface { v0 , p1 , v1 } , L java/util/Map ;-> put ( L java/lang/Object ;L java/lang/Object ;) L java/lang/Object ;
return v2
.end method