apkfuckery/com.discord/smali/androidx/appcompat/app/ResourcesFlusher.smali

512 lines
14 KiB
Smali
Raw Normal View History

2019-12-06 03:29:40 +00:00
.class public Landroidx/appcompat/app/ResourcesFlusher;
2019-07-24 11:27:29 +00:00
.super Ljava/lang/Object;
.source "ResourcesFlusher.java"
# static fields
2019-12-06 03:29:40 +00:00
.field public static final TAG:Ljava/lang/String; = "ResourcesFlusher"
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static sDrawableCacheField:Ljava/lang/reflect/Field;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static sDrawableCacheFieldFetched:Z
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static sResourcesImplField:Ljava/lang/reflect/Field;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static sResourcesImplFieldFetched:Z
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static sThemedResourceCacheClazz:Ljava/lang/Class;
2019-11-15 02:21:15 +00:00
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/lang/Class<",
"*>;"
}
.end annotation
.end field
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static sThemedResourceCacheClazzFetched:Z
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static sThemedResourceCache_mUnthemedEntriesField:Ljava/lang/reflect/Field;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static sThemedResourceCache_mUnthemedEntriesFieldFetched:Z
2019-07-24 11:27:29 +00:00
# direct methods
2019-12-06 03:29:40 +00:00
.method public constructor <init>()V
2019-07-24 11:27:29 +00:00
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public static flush(Landroid/content/res/Resources;)V
2019-07-24 11:27:29 +00:00
.locals 2
2019-12-06 03:29:40 +00:00
.param p0 # Landroid/content/res/Resources;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
2019-07-24 11:27:29 +00:00
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x1c
if-lt v0, v1, :cond_0
return-void
:cond_0
const/16 v1, 0x18
if-lt v0, v1, :cond_1
invoke-static {p0}, Landroidx/appcompat/app/ResourcesFlusher;->flushNougats(Landroid/content/res/Resources;)V
2019-12-06 03:29:40 +00:00
goto :goto_0
2019-07-24 11:27:29 +00:00
:cond_1
const/16 v1, 0x17
if-lt v0, v1, :cond_2
invoke-static {p0}, Landroidx/appcompat/app/ResourcesFlusher;->flushMarshmallows(Landroid/content/res/Resources;)V
2019-12-06 03:29:40 +00:00
goto :goto_0
2019-07-24 11:27:29 +00:00
:cond_2
invoke-static {p0}, Landroidx/appcompat/app/ResourcesFlusher;->flushLollipops(Landroid/content/res/Resources;)V
2019-12-06 03:29:40 +00:00
:goto_0
2019-07-24 11:27:29 +00:00
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public static flushLollipops(Landroid/content/res/Resources;)V
2019-07-24 11:27:29 +00:00
.locals 4
2019-12-06 03:29:40 +00:00
.param p0 # Landroid/content/res/Resources;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/RequiresApi;
value = 0x15
.end annotation
2019-07-24 11:27:29 +00:00
sget-boolean v0, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheFieldFetched:Z
const-string v1, "ResourcesFlusher"
if-nez v0, :cond_0
const/4 v0, 0x1
:try_start_0
const-class v2, Landroid/content/res/Resources;
const-string v3, "mDrawableCache"
invoke-virtual {v2, v3}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
move-result-object v2
sput-object v2, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheField:Ljava/lang/reflect/Field;
2019-12-06 03:29:40 +00:00
sget-object v2, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheField:Ljava/lang/reflect/Field;
2019-07-24 11:27:29 +00:00
invoke-virtual {v2, v0}, Ljava/lang/reflect/Field;->setAccessible(Z)V
:try_end_0
.catch Ljava/lang/NoSuchFieldException; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception v2
const-string v3, "Could not retrieve Resources#mDrawableCache field"
invoke-static {v1, v3, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:goto_0
sput-boolean v0, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheFieldFetched:Z
:cond_0
sget-object v0, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheField:Ljava/lang/reflect/Field;
if-eqz v0, :cond_1
const/4 v2, 0x0
:try_start_1
invoke-virtual {v0, p0}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p0
check-cast p0, Ljava/util/Map;
:try_end_1
.catch Ljava/lang/IllegalAccessException; {:try_start_1 .. :try_end_1} :catch_1
goto :goto_1
:catch_1
move-exception p0
const-string v0, "Could not retrieve value from Resources#mDrawableCache"
invoke-static {v1, v0, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
move-object p0, v2
:goto_1
if-eqz p0, :cond_1
invoke-interface {p0}, Ljava/util/Map;->clear()V
:cond_1
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public static flushMarshmallows(Landroid/content/res/Resources;)V
2019-07-24 11:27:29 +00:00
.locals 4
2019-12-06 03:29:40 +00:00
.param p0 # Landroid/content/res/Resources;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/RequiresApi;
value = 0x17
.end annotation
2019-07-24 11:27:29 +00:00
sget-boolean v0, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheFieldFetched:Z
const-string v1, "ResourcesFlusher"
if-nez v0, :cond_0
const/4 v0, 0x1
:try_start_0
const-class v2, Landroid/content/res/Resources;
const-string v3, "mDrawableCache"
invoke-virtual {v2, v3}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
move-result-object v2
sput-object v2, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheField:Ljava/lang/reflect/Field;
2019-12-06 03:29:40 +00:00
sget-object v2, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheField:Ljava/lang/reflect/Field;
2019-07-24 11:27:29 +00:00
invoke-virtual {v2, v0}, Ljava/lang/reflect/Field;->setAccessible(Z)V
:try_end_0
.catch Ljava/lang/NoSuchFieldException; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception v2
const-string v3, "Could not retrieve Resources#mDrawableCache field"
invoke-static {v1, v3, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:goto_0
sput-boolean v0, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheFieldFetched:Z
:cond_0
const/4 v0, 0x0
sget-object v2, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheField:Ljava/lang/reflect/Field;
if-eqz v2, :cond_1
:try_start_1
invoke-virtual {v2, p0}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
:try_end_1
.catch Ljava/lang/IllegalAccessException; {:try_start_1 .. :try_end_1} :catch_1
goto :goto_1
:catch_1
move-exception p0
const-string v2, "Could not retrieve value from Resources#mDrawableCache"
invoke-static {v1, v2, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:cond_1
:goto_1
if-nez v0, :cond_2
return-void
:cond_2
invoke-static {v0}, Landroidx/appcompat/app/ResourcesFlusher;->flushThemedResourcesCache(Ljava/lang/Object;)V
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public static flushNougats(Landroid/content/res/Resources;)V
2019-07-24 11:27:29 +00:00
.locals 5
2019-12-06 03:29:40 +00:00
.param p0 # Landroid/content/res/Resources;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/RequiresApi;
value = 0x18
.end annotation
2019-07-24 11:27:29 +00:00
sget-boolean v0, Landroidx/appcompat/app/ResourcesFlusher;->sResourcesImplFieldFetched:Z
const/4 v1, 0x1
const-string v2, "ResourcesFlusher"
if-nez v0, :cond_0
:try_start_0
const-class v0, Landroid/content/res/Resources;
const-string v3, "mResourcesImpl"
invoke-virtual {v0, v3}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
move-result-object v0
sput-object v0, Landroidx/appcompat/app/ResourcesFlusher;->sResourcesImplField:Ljava/lang/reflect/Field;
2019-12-06 03:29:40 +00:00
sget-object v0, Landroidx/appcompat/app/ResourcesFlusher;->sResourcesImplField:Ljava/lang/reflect/Field;
2019-07-24 11:27:29 +00:00
invoke-virtual {v0, v1}, Ljava/lang/reflect/Field;->setAccessible(Z)V
:try_end_0
.catch Ljava/lang/NoSuchFieldException; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception v0
const-string v3, "Could not retrieve Resources#mResourcesImpl field"
invoke-static {v2, v3, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:goto_0
sput-boolean v1, Landroidx/appcompat/app/ResourcesFlusher;->sResourcesImplFieldFetched:Z
:cond_0
sget-object v0, Landroidx/appcompat/app/ResourcesFlusher;->sResourcesImplField:Ljava/lang/reflect/Field;
if-nez v0, :cond_1
return-void
:cond_1
const/4 v3, 0x0
:try_start_1
invoke-virtual {v0, p0}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p0
:try_end_1
.catch Ljava/lang/IllegalAccessException; {:try_start_1 .. :try_end_1} :catch_1
goto :goto_1
:catch_1
move-exception p0
const-string v0, "Could not retrieve value from Resources#mResourcesImpl"
invoke-static {v2, v0, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
move-object p0, v3
:goto_1
if-nez p0, :cond_2
return-void
:cond_2
sget-boolean v0, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheFieldFetched:Z
if-nez v0, :cond_3
:try_start_2
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v0
const-string v4, "mDrawableCache"
invoke-virtual {v0, v4}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
move-result-object v0
sput-object v0, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheField:Ljava/lang/reflect/Field;
2019-12-06 03:29:40 +00:00
sget-object v0, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheField:Ljava/lang/reflect/Field;
2019-07-24 11:27:29 +00:00
invoke-virtual {v0, v1}, Ljava/lang/reflect/Field;->setAccessible(Z)V
:try_end_2
.catch Ljava/lang/NoSuchFieldException; {:try_start_2 .. :try_end_2} :catch_2
goto :goto_2
:catch_2
move-exception v0
const-string v4, "Could not retrieve ResourcesImpl#mDrawableCache field"
invoke-static {v2, v4, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:goto_2
sput-boolean v1, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheFieldFetched:Z
:cond_3
sget-object v0, Landroidx/appcompat/app/ResourcesFlusher;->sDrawableCacheField:Ljava/lang/reflect/Field;
if-eqz v0, :cond_4
:try_start_3
invoke-virtual {v0, p0}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v3
:try_end_3
.catch Ljava/lang/IllegalAccessException; {:try_start_3 .. :try_end_3} :catch_3
goto :goto_3
:catch_3
move-exception p0
const-string v0, "Could not retrieve value from ResourcesImpl#mDrawableCache"
invoke-static {v2, v0, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:cond_4
:goto_3
if-eqz v3, :cond_5
invoke-static {v3}, Landroidx/appcompat/app/ResourcesFlusher;->flushThemedResourcesCache(Ljava/lang/Object;)V
:cond_5
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public static flushThemedResourcesCache(Ljava/lang/Object;)V
2019-07-24 11:27:29 +00:00
.locals 4
2019-12-06 03:29:40 +00:00
.param p0 # Ljava/lang/Object;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/RequiresApi;
value = 0x10
.end annotation
2019-07-24 11:27:29 +00:00
sget-boolean v0, Landroidx/appcompat/app/ResourcesFlusher;->sThemedResourceCacheClazzFetched:Z
const/4 v1, 0x1
const-string v2, "ResourcesFlusher"
if-nez v0, :cond_0
const-string v0, "android.content.res.ThemedResourceCache"
2019-12-06 03:29:40 +00:00
:try_start_0
2019-07-24 11:27:29 +00:00
invoke-static {v0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
move-result-object v0
sput-object v0, Landroidx/appcompat/app/ResourcesFlusher;->sThemedResourceCacheClazz:Ljava/lang/Class;
:try_end_0
.catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception v0
const-string v3, "Could not find ThemedResourceCache class"
invoke-static {v2, v3, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:goto_0
sput-boolean v1, Landroidx/appcompat/app/ResourcesFlusher;->sThemedResourceCacheClazzFetched:Z
:cond_0
sget-object v0, Landroidx/appcompat/app/ResourcesFlusher;->sThemedResourceCacheClazz:Ljava/lang/Class;
if-nez v0, :cond_1
return-void
:cond_1
sget-boolean v3, Landroidx/appcompat/app/ResourcesFlusher;->sThemedResourceCache_mUnthemedEntriesFieldFetched:Z
if-nez v3, :cond_2
:try_start_1
const-string v3, "mUnthemedEntries"
invoke-virtual {v0, v3}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
move-result-object v0
sput-object v0, Landroidx/appcompat/app/ResourcesFlusher;->sThemedResourceCache_mUnthemedEntriesField:Ljava/lang/reflect/Field;
2019-12-06 03:29:40 +00:00
sget-object v0, Landroidx/appcompat/app/ResourcesFlusher;->sThemedResourceCache_mUnthemedEntriesField:Ljava/lang/reflect/Field;
2019-07-24 11:27:29 +00:00
invoke-virtual {v0, v1}, Ljava/lang/reflect/Field;->setAccessible(Z)V
:try_end_1
.catch Ljava/lang/NoSuchFieldException; {:try_start_1 .. :try_end_1} :catch_1
goto :goto_1
:catch_1
move-exception v0
const-string v3, "Could not retrieve ThemedResourceCache#mUnthemedEntries field"
invoke-static {v2, v3, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:goto_1
sput-boolean v1, Landroidx/appcompat/app/ResourcesFlusher;->sThemedResourceCache_mUnthemedEntriesFieldFetched:Z
:cond_2
sget-object v0, Landroidx/appcompat/app/ResourcesFlusher;->sThemedResourceCache_mUnthemedEntriesField:Ljava/lang/reflect/Field;
if-nez v0, :cond_3
return-void
:cond_3
const/4 v1, 0x0
:try_start_2
invoke-virtual {v0, p0}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p0
check-cast p0, Landroid/util/LongSparseArray;
:try_end_2
.catch Ljava/lang/IllegalAccessException; {:try_start_2 .. :try_end_2} :catch_2
goto :goto_2
:catch_2
move-exception p0
const-string v0, "Could not retrieve value from ThemedResourceCache#mUnthemedEntries"
invoke-static {v2, v0, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
move-object p0, v1
:goto_2
if-eqz p0, :cond_4
invoke-virtual {p0}, Landroid/util/LongSparseArray;->clear()V
:cond_4
return-void
.end method