apkfuckery/com.discord/smali/androidx/activity/ImmLeaksCleaner.smali

247 lines
6.2 KiB
Smali
Raw Normal View History

2020-05-17 12:40:10 +00:00
.class public final Landroidx/activity/ImmLeaksCleaner;
.super Ljava/lang/Object;
.source "ImmLeaksCleaner.java"
# interfaces
.implements Landroidx/lifecycle/LifecycleEventObserver;
# annotations
.annotation build Landroidx/annotation/RequiresApi;
value = 0x13
.end annotation
# static fields
.field public static final INIT_FAILED:I = 0x2
.field public static final INIT_SUCCESS:I = 0x1
.field public static final NOT_INITIALIAZED:I
.field public static sHField:Ljava/lang/reflect/Field;
.field public static sNextServedViewField:Ljava/lang/reflect/Field;
.field public static sReflectedFieldsInitialized:I
.field public static sServedViewField:Ljava/lang/reflect/Field;
# instance fields
.field public mActivity:Landroid/app/Activity;
# direct methods
.method public constructor <init>(Landroid/app/Activity;)V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Landroidx/activity/ImmLeaksCleaner;->mActivity:Landroid/app/Activity;
return-void
.end method
.method public static initializeReflectiveFields()V
.locals 3
.annotation build Landroidx/annotation/MainThread;
.end annotation
const/4 v0, 0x2
:try_start_0
sput v0, Landroidx/activity/ImmLeaksCleaner;->sReflectedFieldsInitialized:I
const-class v0, Landroid/view/inputmethod/InputMethodManager;
const-string v1, "mServedView"
invoke-virtual {v0, v1}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
move-result-object v0
sput-object v0, Landroidx/activity/ImmLeaksCleaner;->sServedViewField:Ljava/lang/reflect/Field;
const/4 v1, 0x1
invoke-virtual {v0, v1}, Ljava/lang/reflect/Field;->setAccessible(Z)V
const-class v0, Landroid/view/inputmethod/InputMethodManager;
const-string v2, "mNextServedView"
invoke-virtual {v0, v2}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
move-result-object v0
sput-object v0, Landroidx/activity/ImmLeaksCleaner;->sNextServedViewField:Ljava/lang/reflect/Field;
invoke-virtual {v0, v1}, Ljava/lang/reflect/Field;->setAccessible(Z)V
const-class v0, Landroid/view/inputmethod/InputMethodManager;
const-string v2, "mH"
invoke-virtual {v0, v2}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
move-result-object v0
sput-object v0, Landroidx/activity/ImmLeaksCleaner;->sHField:Ljava/lang/reflect/Field;
invoke-virtual {v0, v1}, Ljava/lang/reflect/Field;->setAccessible(Z)V
sput v1, Landroidx/activity/ImmLeaksCleaner;->sReflectedFieldsInitialized:I
:try_end_0
.catch Ljava/lang/NoSuchFieldException; {:try_start_0 .. :try_end_0} :catch_0
:catch_0
return-void
.end method
# virtual methods
.method public onStateChanged(Landroidx/lifecycle/LifecycleOwner;Landroidx/lifecycle/Lifecycle$Event;)V
.locals 2
.param p1 # Landroidx/lifecycle/LifecycleOwner;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2 # Landroidx/lifecycle/Lifecycle$Event;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
sget-object p1, Landroidx/lifecycle/Lifecycle$Event;->ON_DESTROY:Landroidx/lifecycle/Lifecycle$Event;
if-eq p2, p1, :cond_0
return-void
:cond_0
sget p1, Landroidx/activity/ImmLeaksCleaner;->sReflectedFieldsInitialized:I
if-nez p1, :cond_1
invoke-static {}, Landroidx/activity/ImmLeaksCleaner;->initializeReflectiveFields()V
:cond_1
sget p1, Landroidx/activity/ImmLeaksCleaner;->sReflectedFieldsInitialized:I
const/4 p2, 0x1
if-ne p1, p2, :cond_5
iget-object p1, p0, Landroidx/activity/ImmLeaksCleaner;->mActivity:Landroid/app/Activity;
const-string p2, "input_method"
invoke-virtual {p1, p2}, Landroid/app/Activity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Landroid/view/inputmethod/InputMethodManager;
:try_start_0
sget-object p2, Landroidx/activity/ImmLeaksCleaner;->sHField:Ljava/lang/reflect/Field;
invoke-virtual {p2, p1}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p2
:try_end_0
.catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_3
if-nez p2, :cond_2
return-void
:cond_2
monitor-enter p2
:try_start_1
sget-object v0, Landroidx/activity/ImmLeaksCleaner;->sServedViewField:Ljava/lang/reflect/Field;
invoke-virtual {v0, p1}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/view/View;
:try_end_1
.catch Ljava/lang/IllegalAccessException; {:try_start_1 .. :try_end_1} :catch_2
.catch Ljava/lang/ClassCastException; {:try_start_1 .. :try_end_1} :catch_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
if-nez v0, :cond_3
:try_start_2
monitor-exit p2
return-void
:cond_3
invoke-virtual {v0}, Landroid/view/View;->isAttachedToWindow()Z
move-result v0
if-eqz v0, :cond_4
monitor-exit p2
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_0
return-void
:cond_4
:try_start_3
sget-object v0, Landroidx/activity/ImmLeaksCleaner;->sNextServedViewField:Ljava/lang/reflect/Field;
const/4 v1, 0x0
invoke-virtual {v0, p1, v1}, Ljava/lang/reflect/Field;->set(Ljava/lang/Object;Ljava/lang/Object;)V
:try_end_3
.catch Ljava/lang/IllegalAccessException; {:try_start_3 .. :try_end_3} :catch_0
.catchall {:try_start_3 .. :try_end_3} :catchall_0
:try_start_4
monitor-exit p2
:try_end_4
.catchall {:try_start_4 .. :try_end_4} :catchall_0
invoke-virtual {p1}, Landroid/view/inputmethod/InputMethodManager;->isActive()Z
goto :goto_1
:catch_0
:try_start_5
monitor-exit p2
return-void
:catchall_0
move-exception p1
goto :goto_0
:catch_1
monitor-exit p2
return-void
:catch_2
monitor-exit p2
return-void
:goto_0
monitor-exit p2
:try_end_5
.catchall {:try_start_5 .. :try_end_5} :catchall_0
throw p1
:catch_3
:cond_5
:goto_1
return-void
.end method