MemoryPressureRouter.smali
.class public Lcom/facebook/react/MemoryPressureRouter;
.super Ljava/lang/Object;
.source "SourceFile"
# interfaces
.implements Landroid/content/ComponentCallbacks2;
# instance fields
.field private final mListeners:Ljava/util/Set;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Set<",
"Lcom/facebook/react/bridge/MemoryPressureListener;",
">;"
}
.end annotation
.end field
# direct methods
.method public constructor <init>(Landroid/content/Context;)V
.registers 3
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 2
new-instance v0, Ljava/util/LinkedHashSet;
invoke-direct {v0}, Ljava/util/LinkedHashSet;-><init>()V
.line 3
invoke-static {v0}, Ljava/util/Collections;->synchronizedSet(Ljava/util/Set;)Ljava/util/Set;
move-result-object v0
iput-object v0, p0, Lcom/facebook/react/MemoryPressureRouter;->mListeners:Ljava/util/Set;
.line 4
invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
move-result-object p1
invoke-virtual {p1, p0}, Landroid/content/Context;->registerComponentCallbacks(Landroid/content/ComponentCallbacks;)V
return-void
.end method
.method public static INVOKEINTERFACE_com_facebook_react_MemoryPressureRouter_com_shopee_app_asm_anr_ReactNativeTrimMemoryProxy_handleMemoryPressure(Lcom/facebook/react/bridge/MemoryPressureListener;I)V
.registers 7
const-string v0, "rn_handle_memory_in_bg_thread_flag"
.line 1
invoke-static {v0}, Landroidx/appcompat/widget/k0;->j(Ljava/lang/String;)Z
move-result v0
if-eqz v0, :cond_5d
.line 2
instance-of v0, p0, Lcom/facebook/react/bridge/CatalystInstanceImpl;
if-eqz v0, :cond_59
.line 3
check-cast p0, Lcom/facebook/react/bridge/CatalystInstanceImpl;
.line 4
new-instance v0, Lcom/shopee/app/asm/anr/b;
invoke-direct {v0, p0, p1}, Lcom/shopee/app/asm/anr/b;-><init>(Lcom/facebook/react/bridge/CatalystInstanceImpl;I)V
.line 5
new-instance p0, Lcom/shopee/threadpool/i;
invoke-direct {p0}, Lcom/shopee/threadpool/i;-><init>()V
.line 6
sget-object p1, Lcom/shopee/threadpool/j;->Cache:Lcom/shopee/threadpool/j;
.line 7
iput-object p1, p0, Lcom/shopee/threadpool/i;->d:Lcom/shopee/threadpool/j;
.line 8
new-instance p1, Lcom/shopee/threadpool/i;
invoke-direct {p1}, Lcom/shopee/threadpool/i;-><init>()V
.line 9
sget-object v1, Lcom/shopee/threadpool/j;->Single:Lcom/shopee/threadpool/j;
.line 10
iput-object v1, p1, Lcom/shopee/threadpool/i;->d:Lcom/shopee/threadpool/j;
.line 11
new-instance v1, Lcom/shopee/threadpool/i;
invoke-direct {v1}, Lcom/shopee/threadpool/i;-><init>()V
.line 12
sget-object v2, Lcom/shopee/threadpool/j;->CPU:Lcom/shopee/threadpool/j;
.line 13
iput-object v2, v1, Lcom/shopee/threadpool/i;->d:Lcom/shopee/threadpool/j;
.line 14
new-instance v2, Lcom/shopee/threadpool/i;
invoke-direct {v2}, Lcom/shopee/threadpool/i;-><init>()V
.line 15
sget-object v3, Lcom/shopee/threadpool/j;->IO:Lcom/shopee/threadpool/j;
.line 16
iput-object v3, v2, Lcom/shopee/threadpool/i;->d:Lcom/shopee/threadpool/j;
.line 17
sget-object v3, Lcom/shopee/threadpool/j;->Cache:Lcom/shopee/threadpool/j;
.line 18
sget-object v4, Lcom/shopee/app/util/l3;->a:[I
invoke-virtual {v3}, Ljava/lang/Enum;->ordinal()I
move-result v3
aget v3, v4, v3
const/4 v4, 0x1
if-eq v3, v4, :cond_53
const/4 v4, 0x2
if-eq v3, v4, :cond_52
const/4 p1, 0x3
if-eq v3, p1, :cond_50
const/4 p1, 0x4
if-eq v3, p1, :cond_4e
goto :goto_53
:cond_4e
move-object p0, v2
goto :goto_53
:cond_50
move-object p0, v1
goto :goto_53
:cond_52
move-object p0, p1
.line 19
:cond_53
:goto_53
iput-object v0, p0, Lcom/shopee/threadpool/i;->f:Lcom/shopee/threadpool/e;
.line 20
invoke-virtual {p0}, Lcom/shopee/threadpool/i;->a()V
goto :goto_60
.line 21
:cond_59
invoke-interface {p0, p1}, Lcom/facebook/react/bridge/MemoryPressureListener;->handleMemoryPressure(I)V
goto :goto_60
.line 22
:cond_5d
invoke-interface {p0, p1}, Lcom/facebook/react/bridge/MemoryPressureListener;->handleMemoryPressure(I)V
:goto_60
return-void
.end method
.method private dispatchMemoryPressure(I)V
.registers 6
.line 1
iget-object v0, p0, Lcom/facebook/react/MemoryPressureRouter;->mListeners:Ljava/util/Set;
.line 2
invoke-interface {v0}, Ljava/util/Set;->size()I
move-result v1
new-array v1, v1, [Lcom/facebook/react/bridge/MemoryPressureListener;
invoke-interface {v0, v1}, Ljava/util/Set;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
move-result-object v0
check-cast v0, [Lcom/facebook/react/bridge/MemoryPressureListener;
.line 3
array-length v1, v0
const/4 v2, 0x0
:goto_10
if-ge v2, v1, :cond_1a
aget-object v3, v0, v2
.line 4
invoke-static {v3, p1}, Lcom/facebook/react/MemoryPressureRouter;->INVOKEINTERFACE_com_facebook_react_MemoryPressureRouter_com_shopee_app_asm_anr_ReactNativeTrimMemoryProxy_handleMemoryPressure(Lcom/facebook/react/bridge/MemoryPressureListener;I)V
add-int/lit8 v2, v2, 0x1
goto :goto_10
:cond_1a
return-void
.end method
# virtual methods
.method public addMemoryPressureListener(Lcom/facebook/react/bridge/MemoryPressureListener;)V
.registers 3
iget-object v0, p0, Lcom/facebook/react/MemoryPressureRouter;->mListeners:Ljava/util/Set;
invoke-interface {v0, p1}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
return-void
.end method
.method public destroy(Landroid/content/Context;)V
.registers 2
invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
move-result-object p1
invoke-virtual {p1, p0}, Landroid/content/Context;->unregisterComponentCallbacks(Landroid/content/ComponentCallbacks;)V
return-void
.end method
.method public onConfigurationChanged(Landroid/content/res/Configuration;)V
.registers 2
return-void
.end method
.method public onLowMemory()V
.registers 1
return-void
.end method
.method public onTrimMemory(I)V
.registers 3
.line 1
invoke-direct {p0, p1}, Lcom/facebook/react/MemoryPressureRouter;->dispatchMemoryPressure(I)V
.line 2
sget-boolean v0, Lcom/facebook/react/util/Constants;->ENABLE_REUSED_TEXTVIEW_MANAGER:Z
if-eqz v0, :cond_e
.line 3
invoke-static {}, Lcom/facebook/react/views/text/ReactTextViewReusedManager;->getInstance()Lcom/facebook/react/views/text/ReactTextViewReusedManager;
move-result-object v0
invoke-virtual {v0, p1}, Lcom/facebook/react/views/text/ReactTextViewReusedManager;->handleMemoryPressure(I)V
:cond_e
return-void
.end method
.method public removeMemoryPressureListener(Lcom/facebook/react/bridge/MemoryPressureListener;)V
.registers 3
iget-object v0, p0, Lcom/facebook/react/MemoryPressureRouter;->mListeners:Ljava/util/Set;
invoke-interface {v0, p1}, Ljava/util/Set;->remove(Ljava/lang/Object;)Z
return-void
.end method