315 lines
7.5 KiB
Smali
315 lines
7.5 KiB
Smali
.class public final Landroidx/core/text/ICUCompat;
|
|
.super Ljava/lang/Object;
|
|
.source "ICUCompat.java"
|
|
|
|
|
|
# static fields
|
|
.field private static final TAG:Ljava/lang/String; = "ICUCompat"
|
|
|
|
.field private static sAddLikelySubtagsMethod:Ljava/lang/reflect/Method;
|
|
|
|
.field private static sGetScriptMethod:Ljava/lang/reflect/Method;
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 6
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/4 v1, 0x0
|
|
|
|
const/4 v2, 0x1
|
|
|
|
const/16 v3, 0x15
|
|
|
|
if-lt v0, v3, :cond_0
|
|
|
|
:try_start_0
|
|
const-string v0, "libcore.icu.ICU"
|
|
|
|
invoke-static {v0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v3, "addLikelySubtags"
|
|
|
|
new-array v2, v2, [Ljava/lang/Class;
|
|
|
|
const-class v4, Ljava/util/Locale;
|
|
|
|
aput-object v4, v2, v1
|
|
|
|
invoke-virtual {v0, v3, v2}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Landroidx/core/text/ICUCompat;->sAddLikelySubtagsMethod:Ljava/lang/reflect/Method;
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-void
|
|
|
|
:catch_0
|
|
move-exception v0
|
|
|
|
new-instance v1, Ljava/lang/IllegalStateException;
|
|
|
|
invoke-direct {v1, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/Throwable;)V
|
|
|
|
throw v1
|
|
|
|
:cond_0
|
|
:try_start_1
|
|
const-string v0, "libcore.icu.ICU"
|
|
|
|
invoke-static {v0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
const-string v3, "getScript"
|
|
|
|
new-array v4, v2, [Ljava/lang/Class;
|
|
|
|
const-class v5, Ljava/lang/String;
|
|
|
|
aput-object v5, v4, v1
|
|
|
|
invoke-virtual {v0, v3, v4}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
|
|
|
|
move-result-object v3
|
|
|
|
sput-object v3, Landroidx/core/text/ICUCompat;->sGetScriptMethod:Ljava/lang/reflect/Method;
|
|
|
|
const-string v3, "addLikelySubtags"
|
|
|
|
new-array v2, v2, [Ljava/lang/Class;
|
|
|
|
const-class v4, Ljava/lang/String;
|
|
|
|
aput-object v4, v2, v1
|
|
|
|
invoke-virtual {v0, v3, v2}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Landroidx/core/text/ICUCompat;->sAddLikelySubtagsMethod:Ljava/lang/reflect/Method;
|
|
:try_end_1
|
|
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1
|
|
|
|
:cond_1
|
|
return-void
|
|
|
|
:catch_1
|
|
move-exception v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
sput-object v1, Landroidx/core/text/ICUCompat;->sGetScriptMethod:Ljava/lang/reflect/Method;
|
|
|
|
sput-object v1, Landroidx/core/text/ICUCompat;->sAddLikelySubtagsMethod:Ljava/lang/reflect/Method;
|
|
|
|
const-string v1, "ICUCompat"
|
|
|
|
invoke-static {v1, v0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/Throwable;)I
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private static addLikelySubtags(Ljava/util/Locale;)Ljava/lang/String;
|
|
.locals 3
|
|
|
|
invoke-virtual {p0}, Ljava/util/Locale;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
:try_start_0
|
|
sget-object v0, Landroidx/core/text/ICUCompat;->sAddLikelySubtagsMethod:Ljava/lang/reflect/Method;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
new-array v0, v0, [Ljava/lang/Object;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
aput-object p0, v0, v1
|
|
|
|
sget-object v1, Landroidx/core/text/ICUCompat;->sAddLikelySubtagsMethod:Ljava/lang/reflect/Method;
|
|
|
|
const/4 v2, 0x0
|
|
|
|
invoke-virtual {v1, v2, v0}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Ljava/lang/String;
|
|
:try_end_0
|
|
.catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_1
|
|
.catch Ljava/lang/reflect/InvocationTargetException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-object v0
|
|
|
|
:catch_0
|
|
move-exception v0
|
|
|
|
const-string v1, "ICUCompat"
|
|
|
|
invoke-static {v1, v0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/Throwable;)I
|
|
|
|
goto :goto_0
|
|
|
|
:catch_1
|
|
move-exception v0
|
|
|
|
const-string v1, "ICUCompat"
|
|
|
|
invoke-static {v1, v0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/Throwable;)I
|
|
|
|
:cond_0
|
|
:goto_0
|
|
return-object p0
|
|
.end method
|
|
|
|
.method private static getScript(Ljava/lang/String;)Ljava/lang/String;
|
|
.locals 3
|
|
|
|
const/4 v0, 0x0
|
|
|
|
:try_start_0
|
|
sget-object v1, Landroidx/core/text/ICUCompat;->sGetScriptMethod:Ljava/lang/reflect/Method;
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
new-array v1, v1, [Ljava/lang/Object;
|
|
|
|
const/4 v2, 0x0
|
|
|
|
aput-object p0, v1, v2
|
|
|
|
sget-object p0, Landroidx/core/text/ICUCompat;->sGetScriptMethod:Ljava/lang/reflect/Method;
|
|
|
|
invoke-virtual {p0, v0, v1}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
check-cast p0, Ljava/lang/String;
|
|
:try_end_0
|
|
.catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_1
|
|
.catch Ljava/lang/reflect/InvocationTargetException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-object p0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
const-string v1, "ICUCompat"
|
|
|
|
invoke-static {v1, p0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/Throwable;)I
|
|
|
|
goto :goto_0
|
|
|
|
:catch_1
|
|
move-exception p0
|
|
|
|
const-string v1, "ICUCompat"
|
|
|
|
invoke-static {v1, p0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/Throwable;)I
|
|
|
|
:cond_0
|
|
:goto_0
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static maximizeAndGetScript(Ljava/util/Locale;)Ljava/lang/String;
|
|
.locals 3
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/4 v1, 0x0
|
|
|
|
const/16 v2, 0x15
|
|
|
|
if-lt v0, v2, :cond_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
:try_start_0
|
|
new-array v0, v0, [Ljava/lang/Object;
|
|
|
|
const/4 v2, 0x0
|
|
|
|
aput-object p0, v0, v2
|
|
|
|
sget-object v2, Landroidx/core/text/ICUCompat;->sAddLikelySubtagsMethod:Ljava/lang/reflect/Method;
|
|
|
|
invoke-virtual {v2, v1, v0}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Ljava/util/Locale;
|
|
|
|
invoke-virtual {v0}, Ljava/util/Locale;->getScript()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
:try_end_0
|
|
.catch Ljava/lang/reflect/InvocationTargetException; {:try_start_0 .. :try_end_0} :catch_1
|
|
.catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-object p0
|
|
|
|
:catch_0
|
|
move-exception v0
|
|
|
|
const-string v1, "ICUCompat"
|
|
|
|
invoke-static {v1, v0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/Throwable;)I
|
|
|
|
goto :goto_0
|
|
|
|
:catch_1
|
|
move-exception v0
|
|
|
|
const-string v1, "ICUCompat"
|
|
|
|
invoke-static {v1, v0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/Throwable;)I
|
|
|
|
:goto_0
|
|
invoke-virtual {p0}, Ljava/util/Locale;->getScript()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:cond_0
|
|
invoke-static {p0}, Landroidx/core/text/ICUCompat;->addLikelySubtags(Ljava/util/Locale;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
if-eqz p0, :cond_1
|
|
|
|
invoke-static {p0}, Landroidx/core/text/ICUCompat;->getScript(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:cond_1
|
|
return-object v1
|
|
.end method
|