.class final Landroidx/lifecycle/ClassesInfoCache; .super Ljava/lang/Object; .source "ClassesInfoCache.java" # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Landroidx/lifecycle/ClassesInfoCache$CallbackInfo;, Landroidx/lifecycle/ClassesInfoCache$MethodReference; } .end annotation .annotation runtime Ljava/lang/Deprecated; .end annotation # static fields .field private static final CALL_TYPE_NO_ARG:I = 0x0 .field private static final CALL_TYPE_PROVIDER:I = 0x1 .field private static final CALL_TYPE_PROVIDER_WITH_EVENT:I = 0x2 .field static sInstance:Landroidx/lifecycle/ClassesInfoCache; # instance fields .field private final mCallbackMap:Ljava/util/Map; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/Map<", "Ljava/lang/Class<", "*>;", "Landroidx/lifecycle/ClassesInfoCache$CallbackInfo;", ">;" } .end annotation .end field .field private final mHasLifecycleMethods:Ljava/util/Map; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/Map<", "Ljava/lang/Class<", "*>;", "Ljava/lang/Boolean;", ">;" } .end annotation .end field # direct methods .method static constructor ()V .locals 1 .line 39 new-instance v0, Landroidx/lifecycle/ClassesInfoCache; invoke-direct {v0}, Landroidx/lifecycle/ClassesInfoCache;->()V sput-object v0, Landroidx/lifecycle/ClassesInfoCache;->sInstance:Landroidx/lifecycle/ClassesInfoCache; return-void .end method .method constructor ()V .locals 1 .line 37 invoke-direct {p0}, Ljava/lang/Object;->()V .line 45 new-instance v0, Ljava/util/HashMap; invoke-direct {v0}, Ljava/util/HashMap;->()V iput-object v0, p0, Landroidx/lifecycle/ClassesInfoCache;->mCallbackMap:Ljava/util/Map; .line 46 new-instance v0, Ljava/util/HashMap; invoke-direct {v0}, Ljava/util/HashMap;->()V iput-object v0, p0, Landroidx/lifecycle/ClassesInfoCache;->mHasLifecycleMethods:Ljava/util/Map; return-void .end method .method private createInfo(Ljava/lang/Class;[Ljava/lang/reflect/Method;)Landroidx/lifecycle/ClassesInfoCache$CallbackInfo; .locals 11 .annotation system Ldalvik/annotation/Signature; value = { "(", "Ljava/lang/Class<", "*>;[", "Ljava/lang/reflect/Method;", ")", "Landroidx/lifecycle/ClassesInfoCache$CallbackInfo;" } .end annotation .line 109 invoke-virtual {p1}, Ljava/lang/Class;->getSuperclass()Ljava/lang/Class; move-result-object v0 .line 110 new-instance v1, Ljava/util/HashMap; invoke-direct {v1}, Ljava/util/HashMap;->()V if-eqz v0, :cond_0 .line 112 invoke-virtual {p0, v0}, Landroidx/lifecycle/ClassesInfoCache;->getInfo(Ljava/lang/Class;)Landroidx/lifecycle/ClassesInfoCache$CallbackInfo; move-result-object v0 if-eqz v0, :cond_0 .line 114 iget-object v0, v0, Landroidx/lifecycle/ClassesInfoCache$CallbackInfo;->mHandlerToEvent:Ljava/util/Map; invoke-interface {v1, v0}, Ljava/util/Map;->putAll(Ljava/util/Map;)V .line 118 :cond_0 invoke-virtual {p1}, Ljava/lang/Class;->getInterfaces()[Ljava/lang/Class; move-result-object v0 .line 119 array-length v2, v0 const/4 v3, 0x0 move v4, v3 :goto_0 if-ge v4, v2, :cond_2 aget-object v5, v0, v4 .line 120 invoke-virtual {p0, v5}, Landroidx/lifecycle/ClassesInfoCache;->getInfo(Ljava/lang/Class;)Landroidx/lifecycle/ClassesInfoCache$CallbackInfo; move-result-object v5 iget-object v5, v5, Landroidx/lifecycle/ClassesInfoCache$CallbackInfo;->mHandlerToEvent:Ljava/util/Map; .line 121 invoke-interface {v5}, Ljava/util/Map;->entrySet()Ljava/util/Set; move-result-object v5 .line 120 invoke-interface {v5}, Ljava/util/Set;->iterator()Ljava/util/Iterator; move-result-object v5 :goto_1 invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z move-result v6 if-eqz v6, :cond_1 invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v6 check-cast v6, Ljava/util/Map$Entry; .line 122 invoke-interface {v6}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object; move-result-object v7 check-cast v7, Landroidx/lifecycle/ClassesInfoCache$MethodReference; invoke-interface {v6}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object; move-result-object v6 check-cast v6, Landroidx/lifecycle/Lifecycle$Event; invoke-direct {p0, v1, v7, v6, p1}, Landroidx/lifecycle/ClassesInfoCache;->verifyAndPutHandler(Ljava/util/Map;Landroidx/lifecycle/ClassesInfoCache$MethodReference;Landroidx/lifecycle/Lifecycle$Event;Ljava/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 .line 126 :cond_3 invoke-direct {p0, p1}, Landroidx/lifecycle/ClassesInfoCache;->getDeclaredMethods(Ljava/lang/Class;)[Ljava/lang/reflect/Method; move-result-object p2 .line 128 :goto_2 array-length v0, p2 move v2, v3 move v4, v2 :goto_3 if-ge v2, v0, :cond_b aget-object v5, p2, v2 .line 129 const-class v6, Landroidx/lifecycle/OnLifecycleEvent; invoke-virtual {v5, v6}, Ljava/lang/reflect/Method;->getAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation; move-result-object v6 check-cast v6, Landroidx/lifecycle/OnLifecycleEvent; if-nez v6, :cond_4 goto :goto_6 .line 134 :cond_4 invoke-virtual {v5}, Ljava/lang/reflect/Method;->getParameterTypes()[Ljava/lang/Class; move-result-object v4 .line 136 array-length v7, v4 const/4 v8, 0x1 if-lez v7, :cond_6 .line 138 const-class v7, Landroidx/lifecycle/LifecycleOwner; aget-object v9, v4, v3 invoke-virtual {v7, v9}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z move-result v7 if-eqz v7, :cond_5 move v7, v8 goto :goto_4 .line 139 :cond_5 new-instance p0, Ljava/lang/IllegalArgumentException; const-string p1, "invalid parameter type. Must be one and instanceof LifecycleOwner" invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;->(Ljava/lang/String;)V throw p0 :cond_6 move v7, v3 .line 143 :goto_4 invoke-interface {v6}, Landroidx/lifecycle/OnLifecycleEvent;->value()Landroidx/lifecycle/Lifecycle$Event; move-result-object v6 .line 145 array-length v9, v4 const/4 v10, 0x2 if-le v9, v8, :cond_9 .line 147 const-class v7, Landroidx/lifecycle/Lifecycle$Event; aget-object v9, v4, v8 invoke-virtual {v7, v9}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z move-result v7 if-eqz v7, :cond_8 .line 151 sget-object v7, Landroidx/lifecycle/Lifecycle$Event;->ON_ANY:Landroidx/lifecycle/Lifecycle$Event; if-ne v6, v7, :cond_7 move v7, v10 goto :goto_5 .line 152 :cond_7 new-instance p0, Ljava/lang/IllegalArgumentException; const-string p1, "Second arg is supported only for ON_ANY value" invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;->(Ljava/lang/String;)V throw p0 .line 148 :cond_8 new-instance p0, Ljava/lang/IllegalArgumentException; const-string p1, "invalid parameter type. second arg must be an event" invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;->(Ljava/lang/String;)V throw p0 .line 156 :cond_9 :goto_5 array-length v4, v4 if-gt v4, v10, :cond_a .line 159 new-instance v4, Landroidx/lifecycle/ClassesInfoCache$MethodReference; invoke-direct {v4, v7, v5}, Landroidx/lifecycle/ClassesInfoCache$MethodReference;->(ILjava/lang/reflect/Method;)V .line 160 invoke-direct {p0, v1, v4, v6, p1}, Landroidx/lifecycle/ClassesInfoCache;->verifyAndPutHandler(Ljava/util/Map;Landroidx/lifecycle/ClassesInfoCache$MethodReference;Landroidx/lifecycle/Lifecycle$Event;Ljava/lang/Class;)V move v4, v8 :goto_6 add-int/lit8 v2, v2, 0x1 goto :goto_3 .line 157 :cond_a new-instance p0, Ljava/lang/IllegalArgumentException; const-string p1, "cannot have more than 2 params" invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;->(Ljava/lang/String;)V throw p0 .line 162 :cond_b new-instance p2, Landroidx/lifecycle/ClassesInfoCache$CallbackInfo; invoke-direct {p2, v1}, Landroidx/lifecycle/ClassesInfoCache$CallbackInfo;->(Ljava/util/Map;)V iget-object v0, p0, Landroidx/lifecycle/ClassesInfoCache;->mCallbackMap:Ljava/util/Map; .line 163 invoke-interface {v0, p1, p2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; iget-object p0, p0, Landroidx/lifecycle/ClassesInfoCache;->mHasLifecycleMethods:Ljava/util/Map; .line 164 invoke-static {v4}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean; move-result-object v0 invoke-interface {p0, p1, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; return-object p2 .end method .method private getDeclaredMethods(Ljava/lang/Class;)[Ljava/lang/reflect/Method; .locals 1 .annotation system Ldalvik/annotation/Signature; value = { "(", "Ljava/lang/Class<", "*>;)[", "Ljava/lang/reflect/Method;" } .end annotation .line 74 :try_start_0 invoke-virtual {p1}, Ljava/lang/Class;->getDeclaredMethods()[Ljava/lang/reflect/Method; move-result-object p0 :try_end_0 .catch Ljava/lang/NoClassDefFoundError; {:try_start_0 .. :try_end_0} :catch_0 return-object p0 :catch_0 move-exception p0 .line 76 new-instance p1, Ljava/lang/IllegalArgumentException; const-string v0, "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 {p1, v0, p0}, Ljava/lang/IllegalArgumentException;->(Ljava/lang/String;Ljava/lang/Throwable;)V throw p1 .end method .method private verifyAndPutHandler(Ljava/util/Map;Landroidx/lifecycle/ClassesInfoCache$MethodReference;Landroidx/lifecycle/Lifecycle$Event;Ljava/lang/Class;)V .locals 2 .annotation system Ldalvik/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 .line 95 invoke-interface {p1, p2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object p0 check-cast p0, Landroidx/lifecycle/Lifecycle$Event; if-eqz p0, :cond_1 if-ne p3, p0, :cond_0 goto :goto_0 .line 97 :cond_0 iget-object p1, p2, Landroidx/lifecycle/ClassesInfoCache$MethodReference;->mMethod:Ljava/lang/reflect/Method; .line 98 new-instance p2, Ljava/lang/IllegalArgumentException; new-instance v0, Ljava/lang/StringBuilder; const-string v1, "Method " invoke-direct {v0, v1}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V .line 99 invoke-virtual {p1}, Ljava/lang/reflect/Method;->getName()Ljava/lang/String; move-result-object p1 invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object p1 const-string v0, " in " invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object p1 invoke-virtual {p4}, Ljava/lang/Class;->getName()Ljava/lang/String; move-result-object p4 invoke-virtual {p1, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object p1 const-string p4, " already declared with different @OnLifecycleEvent value: previous value " invoke-virtual {p1, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object p1 invoke-virtual {p1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object p0 const-string p1, ", new value " invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object p0 invoke-virtual {p0, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object p0 invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object p0 invoke-direct {p2, p0}, Ljava/lang/IllegalArgumentException;->(Ljava/lang/String;)V throw p2 :cond_1 :goto_0 if-nez p0, :cond_2 .line 104 invoke-interface {p1, p2, p3}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; :cond_2 return-void .end method # virtual methods .method getInfo(Ljava/lang/Class;)Landroidx/lifecycle/ClassesInfoCache$CallbackInfo; .locals 1 .annotation system Ldalvik/annotation/Signature; value = { "(", "Ljava/lang/Class<", "*>;)", "Landroidx/lifecycle/ClassesInfoCache$CallbackInfo;" } .end annotation iget-object v0, p0, Landroidx/lifecycle/ClassesInfoCache;->mCallbackMap:Ljava/util/Map; .line 85 invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v0 check-cast v0, Landroidx/lifecycle/ClassesInfoCache$CallbackInfo; if-eqz v0, :cond_0 return-object v0 :cond_0 const/4 v0, 0x0 .line 89 invoke-direct {p0, p1, v0}, Landroidx/lifecycle/ClassesInfoCache;->createInfo(Ljava/lang/Class;[Ljava/lang/reflect/Method;)Landroidx/lifecycle/ClassesInfoCache$CallbackInfo; move-result-object p0 return-object p0 .end method .method hasLifecycleMethods(Ljava/lang/Class;)Z .locals 6 .annotation system Ldalvik/annotation/Signature; value = { "(", "Ljava/lang/Class<", "*>;)Z" } .end annotation iget-object v0, p0, Landroidx/lifecycle/ClassesInfoCache;->mHasLifecycleMethods:Ljava/util/Map; .line 49 invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v0 check-cast v0, Ljava/lang/Boolean; if-eqz v0, :cond_0 .line 51 invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z move-result p0 return p0 .line 54 :cond_0 invoke-direct {p0, p1}, Landroidx/lifecycle/ClassesInfoCache;->getDeclaredMethods(Ljava/lang/Class;)[Ljava/lang/reflect/Method; move-result-object v0 .line 55 array-length v1, v0 const/4 v2, 0x0 move v3, v2 :goto_0 if-ge v3, v1, :cond_2 aget-object v4, v0, v3 .line 56 const-class v5, Landroidx/lifecycle/OnLifecycleEvent; invoke-virtual {v4, v5}, Ljava/lang/reflect/Method;->getAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation; move-result-object v4 check-cast v4, Landroidx/lifecycle/OnLifecycleEvent; if-eqz v4, :cond_1 .line 64 invoke-direct {p0, p1, v0}, Landroidx/lifecycle/ClassesInfoCache;->createInfo(Ljava/lang/Class;[Ljava/lang/reflect/Method;)Landroidx/lifecycle/ClassesInfoCache$CallbackInfo; const/4 p0, 0x1 return p0 :cond_1 add-int/lit8 v3, v3, 0x1 goto :goto_0 :cond_2 iget-object p0, p0, Landroidx/lifecycle/ClassesInfoCache;->mHasLifecycleMethods:Ljava/util/Map; .line 68 invoke-static {v2}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean; move-result-object v0 invoke-interface {p0, p1, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; return v2 .end method