Rabbit-R1/android (non root)/smali/smali_classes2/com/airbnb/lottie/PerformanceTracker.smali
2024-05-21 17:08:36 -04:00

362 lines
8.8 KiB
Smali

.class public Lcom/airbnb/lottie/PerformanceTracker;
.super Ljava/lang/Object;
.source "PerformanceTracker.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/airbnb/lottie/PerformanceTracker$FrameListener;
}
.end annotation
# instance fields
.field private enabled:Z
.field private final floatComparator:Ljava/util/Comparator;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Comparator<",
"Landroidx/core/util/Pair<",
"Ljava/lang/String;",
"Ljava/lang/Float;",
">;>;"
}
.end annotation
.end field
.field private final frameListeners:Ljava/util/Set;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Set<",
"Lcom/airbnb/lottie/PerformanceTracker$FrameListener;",
">;"
}
.end annotation
.end field
.field private final layerRenderTimes:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/String;",
"Lcom/airbnb/lottie/utils/MeanCalculator;",
">;"
}
.end annotation
.end field
# direct methods
.method public constructor <init>()V
.locals 1
.line 18
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/airbnb/lottie/PerformanceTracker;->enabled:Z
.line 25
new-instance v0, Landroidx/collection/ArraySet;
invoke-direct {v0}, Landroidx/collection/ArraySet;-><init>()V
iput-object v0, p0, Lcom/airbnb/lottie/PerformanceTracker;->frameListeners:Ljava/util/Set;
.line 26
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Lcom/airbnb/lottie/PerformanceTracker;->layerRenderTimes:Ljava/util/Map;
.line 27
new-instance v0, Lcom/airbnb/lottie/PerformanceTracker$1;
invoke-direct {v0, p0}, Lcom/airbnb/lottie/PerformanceTracker$1;-><init>(Lcom/airbnb/lottie/PerformanceTracker;)V
iput-object v0, p0, Lcom/airbnb/lottie/PerformanceTracker;->floatComparator:Ljava/util/Comparator;
return-void
.end method
# virtual methods
.method public addFrameListener(Lcom/airbnb/lottie/PerformanceTracker$FrameListener;)V
.locals 0
iget-object p0, p0, Lcom/airbnb/lottie/PerformanceTracker;->frameListeners:Ljava/util/Set;
.line 64
invoke-interface {p0, p1}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
return-void
.end method
.method public clearRenderTimes()V
.locals 0
iget-object p0, p0, Lcom/airbnb/lottie/PerformanceTracker;->layerRenderTimes:Ljava/util/Map;
.line 72
invoke-interface {p0}, Ljava/util/Map;->clear()V
return-void
.end method
.method public getSortedRenderTimes()Ljava/util/List;
.locals 5
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/List<",
"Landroidx/core/util/Pair<",
"Ljava/lang/String;",
"Ljava/lang/Float;",
">;>;"
}
.end annotation
iget-boolean v0, p0, Lcom/airbnb/lottie/PerformanceTracker;->enabled:Z
if-nez v0, :cond_0
.line 89
invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
move-result-object p0
return-object p0
.line 91
:cond_0
new-instance v0, Ljava/util/ArrayList;
iget-object v1, p0, Lcom/airbnb/lottie/PerformanceTracker;->layerRenderTimes:Ljava/util/Map;
invoke-interface {v1}, Ljava/util/Map;->size()I
move-result v1
invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(I)V
iget-object v1, p0, Lcom/airbnb/lottie/PerformanceTracker;->layerRenderTimes:Ljava/util/Map;
.line 92
invoke-interface {v1}, Ljava/util/Map;->entrySet()Ljava/util/Set;
move-result-object v1
invoke-interface {v1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object v1
:goto_0
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v2
if-eqz v2, :cond_1
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/util/Map$Entry;
.line 93
new-instance v3, Landroidx/core/util/Pair;
invoke-interface {v2}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
move-result-object v4
check-cast v4, Ljava/lang/String;
invoke-interface {v2}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object v2
check-cast v2, Lcom/airbnb/lottie/utils/MeanCalculator;
invoke-virtual {v2}, Lcom/airbnb/lottie/utils/MeanCalculator;->getMean()F
move-result v2
invoke-static {v2}, Ljava/lang/Float;->valueOf(F)Ljava/lang/Float;
move-result-object v2
invoke-direct {v3, v4, v2}, Landroidx/core/util/Pair;-><init>(Ljava/lang/Object;Ljava/lang/Object;)V
invoke-interface {v0, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z
goto :goto_0
:cond_1
iget-object p0, p0, Lcom/airbnb/lottie/PerformanceTracker;->floatComparator:Ljava/util/Comparator;
.line 95
invoke-static {v0, p0}, Ljava/util/Collections;->sort(Ljava/util/List;Ljava/util/Comparator;)V
return-object v0
.end method
.method public logRenderTimes()V
.locals 4
iget-boolean v0, p0, Lcom/airbnb/lottie/PerformanceTracker;->enabled:Z
if-nez v0, :cond_0
return-void
.line 79
:cond_0
invoke-virtual {p0}, Lcom/airbnb/lottie/PerformanceTracker;->getSortedRenderTimes()Ljava/util/List;
move-result-object p0
const-string v0, "Render times:"
const-string v1, "LOTTIE"
.line 80
invoke-static {v1, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
const/4 v0, 0x0
.line 81
:goto_0
invoke-interface {p0}, Ljava/util/List;->size()I
move-result v2
if-ge v0, v2, :cond_1
.line 82
invoke-interface {p0, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v2
check-cast v2, Landroidx/core/util/Pair;
.line 83
iget-object v3, v2, Landroidx/core/util/Pair;->first:Ljava/lang/Object;
iget-object v2, v2, Landroidx/core/util/Pair;->second:Ljava/lang/Object;
filled-new-array {v3, v2}, [Ljava/lang/Object;
move-result-object v2
const-string v3, "\t\t%30s:%.2f"
invoke-static {v3, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v2
invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
add-int/lit8 v0, v0, 0x1
goto :goto_0
:cond_1
return-void
.end method
.method public recordRenderTime(Ljava/lang/String;F)V
.locals 2
iget-boolean v0, p0, Lcom/airbnb/lottie/PerformanceTracker;->enabled:Z
if-nez v0, :cond_0
return-void
:cond_0
iget-object v0, p0, Lcom/airbnb/lottie/PerformanceTracker;->layerRenderTimes: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, Lcom/airbnb/lottie/utils/MeanCalculator;
if-nez v0, :cond_1
.line 51
new-instance v0, Lcom/airbnb/lottie/utils/MeanCalculator;
invoke-direct {v0}, Lcom/airbnb/lottie/utils/MeanCalculator;-><init>()V
iget-object v1, p0, Lcom/airbnb/lottie/PerformanceTracker;->layerRenderTimes:Ljava/util/Map;
.line 52
invoke-interface {v1, p1, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 54
:cond_1
invoke-virtual {v0, p2}, Lcom/airbnb/lottie/utils/MeanCalculator;->add(F)V
const-string v0, "__container"
.line 56
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result p1
if-eqz p1, :cond_2
iget-object p0, p0, Lcom/airbnb/lottie/PerformanceTracker;->frameListeners:Ljava/util/Set;
.line 57
invoke-interface {p0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object p0
:goto_0
invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
move-result p1
if-eqz p1, :cond_2
invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object p1
check-cast p1, Lcom/airbnb/lottie/PerformanceTracker$FrameListener;
.line 58
invoke-interface {p1, p2}, Lcom/airbnb/lottie/PerformanceTracker$FrameListener;->onFrameRendered(F)V
goto :goto_0
:cond_2
return-void
.end method
.method public removeFrameListener(Lcom/airbnb/lottie/PerformanceTracker$FrameListener;)V
.locals 0
iget-object p0, p0, Lcom/airbnb/lottie/PerformanceTracker;->frameListeners:Ljava/util/Set;
.line 68
invoke-interface {p0, p1}, Ljava/util/Set;->remove(Ljava/lang/Object;)Z
return-void
.end method
.method setEnabled(Z)V
.locals 0
iput-boolean p1, p0, Lcom/airbnb/lottie/PerformanceTracker;->enabled:Z
return-void
.end method