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

519 lines
14 KiB
Smali
Raw Normal View History

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