x.smali

.class public final Lcom/singbox/util/x;
.super Ljava/lang/Object;
.source "SourceFile"


# static fields
.field public static final a:Lcom/singbox/util/x;

.field private static final b:[Ljava/lang/String;

.field private static c:I

.field private static d:F

.field private static e:Z

.field private static f:Z

.field private static g:Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .registers 6

    .line 22
    new-instance v0, Lcom/singbox/util/x;

    invoke-direct {v0}, Lcom/singbox/util/x;-><init>()V

    sput-object v0, Lcom/singbox/util/x;->a:Lcom/singbox/util/x;

    const-string v0, "m9"

    const-string v1, "M9"

    const-string v2, "mx"

    const-string v3, "MX"

    .line 27
    filled-new-array {v0, v1, v2, v3}, [Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/singbox/util/x;->b:[Ljava/lang/String;

    const/4 v0, -0x1

    .line 28
    sput v0, Lcom/singbox/util/x;->c:I

    const/high16 v0, -0x40800000    # -1.0f

    .line 29
    sput v0, Lcom/singbox/util/x;->d:F

    .line 42
    new-instance v0, Ljava/util/Properties;

    invoke-direct {v0}, Ljava/util/Properties;-><init>()V

    .line 43
    sget v1, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v2, 0x1a

    if-ge v1, v2, :cond_54

    const/4 v1, 0x0

    .line 46
    :try_start_28
    new-instance v2, Ljava/io/FileInputStream;

    new-instance v3, Ljava/io/File;

    invoke-static {}, Landroid/os/Environment;->getRootDirectory()Ljava/io/File;

    move-result-object v4

    const-string v5, "build.prop"

    invoke-direct {v3, v4, v5}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V

    invoke-direct {v2, v3}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
    :try_end_38
    .catch Ljava/lang/Exception; {:try_start_28 .. :try_end_38} :catch_4e
    .catchall {:try_start_28 .. :try_end_38} :catchall_47

    .line 47
    :try_start_38
    move-object v1, v2

    check-cast v1, Ljava/io/InputStream;

    invoke-virtual {v0, v1}, Ljava/util/Properties;->load(Ljava/io/InputStream;)V
    :try_end_3e
    .catch Ljava/lang/Exception; {:try_start_38 .. :try_end_3e} :catch_45
    .catchall {:try_start_38 .. :try_end_3e} :catchall_42

    .line 52
    :try_start_3e
    invoke-virtual {v2}, Ljava/io/FileInputStream;->close()V
    :try_end_41
    .catch Ljava/io/IOException; {:try_start_3e .. :try_end_41} :catch_54

    goto :goto_54

    :catchall_42
    move-exception v0

    move-object v1, v2

    goto :goto_48

    :catch_45
    move-object v1, v2

    goto :goto_4f

    :catchall_47
    move-exception v0

    :goto_48
    if-eqz v1, :cond_4d

    :try_start_4a
    invoke-virtual {v1}, Ljava/io/FileInputStream;->close()V
    :try_end_4d
    .catch Ljava/io/IOException; {:try_start_4a .. :try_end_4d} :catch_4d

    .line 55
    :catch_4d
    :cond_4d
    throw v0

    :catch_4e
    nop

    :goto_4f
    if-eqz v1, :cond_54

    .line 52
    :try_start_51
    invoke-virtual {v1}, Ljava/io/FileInputStream;->close()V
    :try_end_54
    .catch Ljava/io/IOException; {:try_start_51 .. :try_end_54} :catch_54

    :catch_54
    :cond_54
    :goto_54
    :try_start_54
    const-string v1, "android.os.SystemProperties"

    .line 60
    invoke-static {v1}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v1

    const-string v2, "get"

    const/4 v3, 0x1

    new-array v3, v3, [Ljava/lang/Class;

    const/4 v4, 0x0

    .line 61
    const-class v5, Ljava/lang/String;

    aput-object v5, v3, v4

    invoke-virtual {v1, v2, v3}, Ljava/lang/Class;->getDeclaredMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;

    move-result-object v1

    const-string v2, "clzSystemProperties.getD\u2026get\", String::class.java)"

    invoke-static {v1, v2}, Lkotlin/f/b/o;->a(Ljava/lang/Object;Ljava/lang/String;)V

    const-string v2, "ro.build.display.id"

    .line 62
    invoke-static {v0, v1, v2}, Lcom/singbox/util/x;->a(Ljava/util/Properties;Ljava/lang/reflect/Method;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/singbox/util/x;->g:Ljava/lang/String;
    :try_end_75
    .catch Ljava/lang/Exception; {:try_start_54 .. :try_end_75} :catch_75

    :catch_75
    return-void
.end method

.method private constructor <init>()V
    .registers 1

    .line 22
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static a(Landroid/content/Context;)I
    .registers 11

    const-string v0, "context"

    invoke-static {p0, v0}, Lkotlin/f/b/o;->b(Ljava/lang/Object;Ljava/lang/String;)V

    .line 71
    sget v0, Lcom/singbox/util/x;->c:I

    const/4 v1, -0x1

    if-ne v0, v1, :cond_da

    const/4 v0, 0x0

    const/4 v1, 0x1

    const/4 v2, 0x0

    :try_start_d
    const-string v3, "com.android.internal.R$dimen"

    .line 1098
    invoke-static {v3}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v3

    const-string v4, "Class.forName(\"com.android.internal.R\\$dimen\")"

    invoke-static {v3, v4}, Lkotlin/f/b/o;->a(Ljava/lang/Object;Ljava/lang/String;)V

    .line 1099
    invoke-virtual {v3}, Ljava/lang/Class;->newInstance()Ljava/lang/Object;

    move-result-object v4
    :try_end_1c
    .catchall {:try_start_d .. :try_end_1c} :catchall_73

    .line 2039
    :try_start_1c
    sget-object v5, Lcom/singbox/util/x;->b:[Ljava/lang/String;

    .line 2188
    sget-object v6, Landroid/os/Build;->BOARD:Ljava/lang/String;

    if-nez v6, :cond_23

    goto :goto_34

    .line 2189
    :cond_23
    array-length v7, v5

    const/4 v8, 0x0

    :goto_25
    if-ge v8, v7, :cond_34

    aget-object v9, v5, v8

    .line 2190
    invoke-static {v6, v9}, Lkotlin/f/b/o;->a(Ljava/lang/Object;Ljava/lang/Object;)Z

    move-result v9

    if-eqz v9, :cond_31

    const/4 v5, 0x1

    goto :goto_35

    :cond_31
    add-int/lit8 v8, v8, 0x1

    goto :goto_25

    :cond_34
    :goto_34
    const/4 v5, 0x0

    :goto_35
    if-nez v5, :cond_5c

    .line 3036
    sget-object v5, Lcom/singbox/util/x;->g:Ljava/lang/String;

    check-cast v5, Ljava/lang/CharSequence;

    invoke-static {v5}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v5

    if-nez v5, :cond_56

    sget-object v5, Lcom/singbox/util/x;->g:Ljava/lang/String;

    if-nez v5, :cond_48

    invoke-static {}, Lkotlin/f/b/o;->a()V

    :cond_48
    check-cast v5, Ljava/lang/CharSequence;

    const-string v6, "flyme"

    check-cast v6, Ljava/lang/CharSequence;

    .line 3045
    invoke-static {v5, v6, v2}, Lkotlin/m/p;->a(Ljava/lang/CharSequence;Ljava/lang/CharSequence;Z)Z

    move-result v5
    :try_end_52
    .catchall {:try_start_1c .. :try_end_52} :catchall_70

    if-eqz v5, :cond_56

    const/4 v5, 0x1

    goto :goto_57

    :cond_56
    const/4 v5, 0x0

    :goto_57
    if-eqz v5, :cond_5a

    goto :goto_5c

    :cond_5a
    const/4 v5, 0x0

    goto :goto_5d

    :cond_5c
    :goto_5c
    const/4 v5, 0x1

    :goto_5d
    if-eqz v5, :cond_67

    :try_start_5f
    const-string v5, "status_bar_height_large"

    .line 1102
    invoke-virtual {v3, v5}, Ljava/lang/Class;->getField(Ljava/lang/String;)Ljava/lang/reflect/Field;

    move-result-object v0
    :try_end_65
    .catchall {:try_start_5f .. :try_end_65} :catchall_66

    goto :goto_67

    :catchall_66
    nop

    :cond_67
    :goto_67
    if-nez v0, :cond_76

    :try_start_69
    const-string v5, "status_bar_height"

    .line 1108
    invoke-virtual {v3, v5}, Ljava/lang/Class;->getField(Ljava/lang/String;)Ljava/lang/reflect/Field;

    move-result-object v0
    :try_end_6f
    .catchall {:try_start_69 .. :try_end_6f} :catchall_70

    goto :goto_76

    :catchall_70
    move-object v3, v0

    move-object v0, v4

    goto :goto_74

    :catchall_73
    move-object v3, v0

    :goto_74
    move-object v4, v0

    move-object v0, v3

    :cond_76
    :goto_76
    if-eqz v0, :cond_92

    if-eqz v4, :cond_92

    .line 1115
    :try_start_7a
    invoke-virtual {v0, v4}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v0

    .line 1116
    invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v3

    invoke-virtual {v3, v0}, Landroid/content/res/Resources;->getDimensionPixelSize(I)I

    move-result v0

    sput v0, Lcom/singbox/util/x;->c:I
    :try_end_90
    .catchall {:try_start_7a .. :try_end_90} :catchall_91

    goto :goto_92

    :catchall_91
    nop

    .line 3214
    :cond_92
    :goto_92
    sget-boolean v0, Lcom/singbox/util/x;->e:Z

    if-eqz v0, :cond_99

    .line 3215
    sget-boolean v0, Lcom/singbox/util/x;->f:Z

    goto :goto_b4

    .line 3217
    :cond_99
    invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    const-string v3, "context.resources"

    invoke-static {v0, v3}, Lkotlin/f/b/o;->a(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {v0}, Landroid/content/res/Resources;->getConfiguration()Landroid/content/res/Configuration;

    move-result-object v0

    iget v0, v0, Landroid/content/res/Configuration;->screenLayout:I

    and-int/lit8 v0, v0, 0xf

    const/4 v3, 0x3

    if-lt v0, v3, :cond_af

    const/4 v0, 0x1

    goto :goto_b0

    :cond_af
    const/4 v0, 0x0

    :goto_b0
    sput-boolean v0, Lcom/singbox/util/x;->f:Z

    .line 3219
    sput-boolean v1, Lcom/singbox/util/x;->e:Z

    :goto_b4
    if-eqz v0, :cond_bf

    .line 1121
    sget v0, Lcom/singbox/util/x;->c:I

    .line 1122
    invoke-static {p0}, Lcom/singbox/util/x;->e(Landroid/content/Context;)I

    move-result v1

    if-le v0, v1, :cond_bf

    goto :goto_d8

    .line 1125
    :cond_bf
    sget v0, Lcom/singbox/util/x;->c:I

    if-gtz v0, :cond_da

    .line 1126
    sget v0, Lcom/singbox/util/x;->d:F

    const/high16 v1, -0x40800000    # -1.0f

    cmpg-float v1, v0, v1

    if-nez v1, :cond_d0

    .line 1127
    invoke-static {p0}, Lcom/singbox/util/x;->e(Landroid/content/Context;)I

    move-result v2

    goto :goto_d8

    :cond_d0
    const/high16 p0, 0x41c80000    # 25.0f

    mul-float v0, v0, p0

    const/high16 p0, 0x3f000000    # 0.5f

    add-float/2addr v0, p0

    float-to-int v2, v0

    .line 1126
    :goto_d8
    sput v2, Lcom/singbox/util/x;->c:I

    .line 74
    :cond_da
    sget p0, Lcom/singbox/util/x;->c:I

    return p0
.end method

.method private static a(Ljava/util/Properties;Ljava/lang/reflect/Method;Ljava/lang/String;)Ljava/lang/String;
    .registers 6

    .line 198
    invoke-virtual {p0, p2}, Ljava/util/Properties;->getProperty(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p0

    if-nez p0, :cond_1f

    const/4 v0, 0x0

    const/4 v1, 0x1

    :try_start_8
    new-array v1, v1, [Ljava/lang/Object;

    const/4 v2, 0x0

    aput-object p2, v1, v2

    .line 201
    invoke-virtual {p1, v0, v1}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object p1

    if-eqz p1, :cond_17

    check-cast p1, Ljava/lang/String;

    move-object p0, p1

    goto :goto_31

    :cond_17
    new-instance p1, Lkotlin/TypeCastException;

    const-string p2, "null cannot be cast to non-null type kotlin.String"

    invoke-direct {p1, p2}, Lkotlin/TypeCastException;-><init>(Ljava/lang/String;)V

    throw p1
    :try_end_1f
    .catch Ljava/lang/Exception; {:try_start_8 .. :try_end_1f} :catch_31

    .line 205
    :cond_1f
    invoke-static {}, Ljava/util/Locale;->getDefault()Ljava/util/Locale;

    move-result-object p1

    const-string p2, "Locale.getDefault()"

    invoke-static {p1, p2}, Lkotlin/f/b/o;->a(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {p0, p1}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;

    move-result-object p0

    const-string p1, "(this as java.lang.String).toLowerCase(locale)"

    invoke-static {p0, p1}, Lkotlin/f/b/o;->a(Ljava/lang/Object;Ljava/lang/String;)V

    :catch_31
    :goto_31
    return-object p0
.end method

.method public static b(Landroid/content/Context;)I
    .registers 2

    const-string v0, "context"

    invoke-static {p0, v0}, Lkotlin/f/b/o;->b(Ljava/lang/Object;Ljava/lang/String;)V

    const-string v0, "window"

    .line 78
    invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object p0

    if-eqz p0, :cond_1d

    check-cast p0, Landroid/view/WindowManager;

    .line 79
    invoke-interface {p0}, Landroid/view/WindowManager;->getDefaultDisplay()Landroid/view/Display;

    move-result-object p0

    const-string v0, "display"

    .line 80
    invoke-static {p0, v0}, Lkotlin/f/b/o;->a(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {p0}, Landroid/view/Display;->getWidth()I

    move-result p0

    return p0

    .line 78
    :cond_1d
    new-instance p0, Lkotlin/TypeCastException;

    const-string v0, "null cannot be cast to non-null type android.view.WindowManager"

    invoke-direct {p0, v0}, Lkotlin/TypeCastException;-><init>(Ljava/lang/String;)V

    throw p0
.end method

.method public static c(Landroid/content/Context;)I
    .registers 5

    const-string v0, "window"

    .line 154
    invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    if-eqz v0, :cond_51

    check-cast v0, Landroid/view/WindowManager;

    .line 155
    invoke-interface {v0}, Landroid/view/WindowManager;->getDefaultDisplay()Landroid/view/Display;

    move-result-object v0

    .line 156
    new-instance v1, Landroid/graphics/Point;

    invoke-direct {v1}, Landroid/graphics/Point;-><init>()V

    .line 158
    :try_start_13
    invoke-virtual {v0, v1}, Landroid/view/Display;->getSize(Landroid/graphics/Point;)V
    :try_end_16
    .catch Ljava/lang/RuntimeException; {:try_start_13 .. :try_end_16} :catch_31

    .line 173
    sget p0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v2, 0x11

    if-lt p0, v2, :cond_2e

    .line 174
    new-instance p0, Landroid/graphics/Point;

    invoke-direct {p0}, Landroid/graphics/Point;-><init>()V

    .line 175
    invoke-virtual {v0, p0}, Landroid/view/Display;->getRealSize(Landroid/graphics/Point;)V

    .line 176
    iget p0, p0, Landroid/graphics/Point;->y:I

    iget v0, v1, Landroid/graphics/Point;->y:I

    invoke-static {p0, v0}, Ljava/lang/Math;->max(II)I

    move-result p0

    iput p0, v1, Landroid/graphics/Point;->y:I

    .line 178
    :cond_2e
    iget p0, v1, Landroid/graphics/Point;->y:I

    return p0

    :catch_31
    move-exception v0

    .line 160
    invoke-virtual {v0}, Ljava/lang/RuntimeException;->getCause()Ljava/lang/Throwable;

    move-result-object v1

    .line 162
    sget v2, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v3, 0x18

    if-lt v2, v3, :cond_45

    .line 163
    instance-of v1, v1, Landroid/os/DeadSystemException;

    if-eqz v1, :cond_4e

    .line 164
    invoke-static {p0}, Lcom/singbox/util/x;->d(Landroid/content/Context;)I

    move-result p0

    return p0

    .line 167
    :cond_45
    instance-of v1, v1, Landroid/os/DeadObjectException;

    if-eqz v1, :cond_4e

    .line 168
    invoke-static {p0}, Lcom/singbox/util/x;->d(Landroid/content/Context;)I

    move-result p0

    return p0

    .line 171
    :cond_4e
    check-cast v0, Ljava/lang/Throwable;

    throw v0

    .line 154
    :cond_51
    new-instance p0, Lkotlin/TypeCastException;

    const-string v0, "null cannot be cast to non-null type android.view.WindowManager"

    invoke-direct {p0, v0}, Lkotlin/TypeCastException;-><init>(Ljava/lang/String;)V

    throw p0
.end method

.method public static d(Landroid/content/Context;)I
    .registers 2

    const-string v0, "context"

    invoke-static {p0, v0}, Lkotlin/f/b/o;->b(Ljava/lang/Object;Ljava/lang/String;)V

    const-string v0, "window"

    .line 182
    invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object p0

    if-eqz p0, :cond_1d

    check-cast p0, Landroid/view/WindowManager;

    .line 183
    invoke-interface {p0}, Landroid/view/WindowManager;->getDefaultDisplay()Landroid/view/Display;

    move-result-object p0

    const-string v0, "display"

    .line 184
    invoke-static {p0, v0}, Lkotlin/f/b/o;->a(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {p0}, Landroid/view/Display;->getHeight()I

    move-result p0

    return p0

    .line 182
    :cond_1d
    new-instance p0, Lkotlin/TypeCastException;

    const-string v0, "null cannot be cast to non-null type android.view.WindowManager"

    invoke-direct {p0, v0}, Lkotlin/TypeCastException;-><init>(Ljava/lang/String;)V

    throw p0
.end method

.method private static e(Landroid/content/Context;)I
    .registers 5

    const-string v0, "context"

    invoke-static {p0, v0}, Lkotlin/f/b/o;->b(Ljava/lang/Object;Ljava/lang/String;)V

    .line 136
    invoke-static {p0}, Lcom/singbox/util/x;->f(Landroid/content/Context;)F

    move-result p0

    const/high16 v0, 0x41c80000    # 25.0f

    mul-float p0, p0, v0

    float-to-double v0, p0

    const-wide/high16 v2, 0x3fe0000000000000L    # 0.5

    invoke-static {v0, v1}, Ljava/lang/Double;->isNaN(D)Z

    add-double/2addr v0, v2

    double-to-int p0, v0

    return p0
.end method

.method private static f(Landroid/content/Context;)F
    .registers 2

    .line 140
    invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object p0

    const-string v0, "context.resources"

    invoke-static {p0, v0}, Lkotlin/f/b/o;->a(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {p0}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object p0

    iget p0, p0, Landroid/util/DisplayMetrics;->density:F

    return p0
.end method