CommendUtils.smali

.class public Lcom/cleanmaster/hpsharelib/base/CommendUtils;
.super Ljava/lang/Object;
.source "CommendUtils.java"


# static fields
.field private static final APPCHANNELID:Ljava/lang/String; = "appChannelId"

.field private static channelId:I


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

    .prologue
    .line 54
    const/4 v0, 0x0

    sput v0, Lcom/cleanmaster/hpsharelib/base/CommendUtils;->channelId:I

    return-void
.end method

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

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

    return-void
.end method

.method public static M(J)I
    .registers 4

    .prologue
    .line 132
    long-to-float v0, p0

    const/high16 v1, 0x49800000    # 1048576.0f

    div-float/2addr v0, v1

    invoke-static {v0}, Ljava/lang/Math;->round(F)I

    move-result v0

    return v0
.end method

.method public static SP2(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    .registers 4

    .prologue
    .line 104
    invoke-static {p0}, Landroid/os/SystemProperties;->get(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 105
    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_c

    .line 106
    sget-object v0, Landroid/os/Build;->MODEL:Ljava/lang/String;

    .line 108
    :cond_c
    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    if-nez v1, :cond_13

    :goto_12
    return-object v0

    :cond_13
    move-object v0, p1

    goto :goto_12
.end method

.method public static checkIsFinishing(Landroid/content/Context;)Z
    .registers 2

    .prologue
    .line 37
    if-eqz p0, :cond_10

    instance-of v0, p0, Landroid/app/Activity;

    if-eqz v0, :cond_10

    .line 38
    check-cast p0, Landroid/app/Activity;

    invoke-virtual {p0}, Landroid/app/Activity;->isFinishing()Z

    move-result v0

    if-eqz v0, :cond_10

    .line 39
    const/4 v0, 0x1

    .line 42
    :goto_f
    return v0

    :cond_10
    const/4 v0, 0x0

    goto :goto_f
.end method

.method public static getAndroidID(Landroid/content/Context;)Ljava/lang/String;
    .registers 3

    .prologue
    .line 96
    :try_start_0
    invoke-virtual {p0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    .line 97
    const-string v1, "android_id"

    invoke-static {v0, v1}, Landroid/provider/Settings$System;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;
    :try_end_9
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_9} :catch_b

    move-result-object v0

    .line 99
    :goto_a
    return-object v0

    .line 98
    :catch_b
    move-exception v0

    .line 99
    const-string v0, ""

    goto :goto_a
.end method

.method public static declared-synchronized getChannelId()I
    .registers 4

    .prologue
    .line 65
    const-class v1, Lcom/cleanmaster/hpsharelib/base/CommendUtils;

    monitor-enter v1

    :try_start_3
    sget v0, Lcom/cleanmaster/hpsharelib/base/CommendUtils;->channelId:I
    :try_end_5
    .catchall {:try_start_3 .. :try_end_5} :catchall_38

    .line 66
    if-eqz v0, :cond_18

    const v2, 0x30d41

    if-eq v2, v0, :cond_18

    const v2, 0x30d4d

    if-eq v2, v0, :cond_18

    const v2, 0x186a9

    if-eq v2, v0, :cond_18

    .line 91
    :cond_16
    :goto_16
    monitor-exit v1

    return v0

    .line 73
    :cond_18
    :try_start_18
    invoke-static {}, Lcom/cleanmaster/hpsharelib/configmanager/ServiceConfigManager;->getInstance()Lcom/cleanmaster/hpsharelib/configmanager/ServiceConfigManager;

    move-result-object v0

    const-string v2, "appChannelId"

    const/4 v3, 0x0

    invoke-virtual {v0, v2, v3}, Lcom/cleanmaster/hpsharelib/configmanager/ServiceConfigManager;->getIntValue(Ljava/lang/String;I)I

    move-result v0

    .line 74
    if-eqz v0, :cond_3b

    const v2, 0x186a0

    if-eq v2, v0, :cond_3b

    const v2, 0x30d40

    if-eq v2, v0, :cond_3b

    const/4 v2, 0x1

    if-lt v0, v2, :cond_35

    const/4 v2, 0x5

    if-le v0, v2, :cond_3b

    .line 78
    :cond_35
    sput v0, Lcom/cleanmaster/hpsharelib/base/CommendUtils;->channelId:I
    :try_end_37
    .catchall {:try_start_18 .. :try_end_37} :catchall_38

    goto :goto_16

    .line 65
    :catchall_38
    move-exception v0

    monitor-exit v1

    throw v0

    .line 82
    :cond_3b
    :try_start_3b
    const-string v2, "cn"

    invoke-static {v2}, Lcom/cleanmaster/hpsharelib/base/CommendUtils;->readAssetsFileLineString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    .line 83
    invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v3

    if-nez v3, :cond_16

    .line 87
    invoke-static {v2}, Ljava/lang/Integer;->valueOf(Ljava/lang/String;)Ljava/lang/Integer;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    sput v0, Lcom/cleanmaster/hpsharelib/base/CommendUtils;->channelId:I

    .line 88
    sget v0, Lcom/cleanmaster/hpsharelib/base/CommendUtils;->channelId:I

    .line 89
    invoke-static {}, Lcom/cleanmaster/hpsharelib/configmanager/ServiceConfigManager;->getInstance()Lcom/cleanmaster/hpsharelib/configmanager/ServiceConfigManager;

    move-result-object v2

    const-string v3, "appChannelId"

    invoke-virtual {v2, v3, v0}, Lcom/cleanmaster/hpsharelib/configmanager/ServiceConfigManager;->setIntValue(Ljava/lang/String;I)V
    :try_end_5c
    .catchall {:try_start_3b .. :try_end_5c} :catchall_38

    goto :goto_16
.end method

.method public static getLanguageSelected(Landroid/content/Context;)Lcom/cm/plugincluster/cleanmaster/base/util/system/LanguageCountry;
    .registers 4

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

    move-result-object v0

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

    move-result-object v0

    iget-object v0, v0, Landroid/content/res/Configuration;->locale:Ljava/util/Locale;

    invoke-virtual {v0}, Ljava/util/Locale;->getLanguage()Ljava/lang/String;

    move-result-object v0

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

    move-result-object v1

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

    move-result-object v1

    iget-object v1, v1, Landroid/content/res/Configuration;->locale:Ljava/util/Locale;

    invoke-virtual {v1}, Ljava/util/Locale;->getCountry()Ljava/lang/String;

    move-result-object v1

    .line 123
    new-instance v2, Lcom/cm/plugincluster/cleanmaster/base/util/system/LanguageCountry;

    invoke-direct {v2, v0, v1}, Lcom/cm/plugincluster/cleanmaster/base/util/system/LanguageCountry;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    return-object v2
.end method

.method public static getScreenDensity(Landroid/content/Context;)F
    .registers 2

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

    move-result-object v0

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

    move-result-object v0

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

    return v0
.end method

.method public static isAndroidM()Z
    .registers 2

    .prologue
    .line 30
    sget v0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v1, 0x17

    if-lt v0, v1, :cond_8

    const/4 v0, 0x1

    :goto_7
    return v0

    :cond_8
    const/4 v0, 0x0

    goto :goto_7
.end method

.method public static isUserApp(Landroid/content/pm/ApplicationInfo;)Z
    .registers 3

    .prologue
    const/4 v0, 0x0

    .line 127
    if-nez p0, :cond_4

    .line 128
    :cond_3
    :goto_3
    return v0

    :cond_4
    iget v1, p0, Landroid/content/pm/ApplicationInfo;->flags:I

    and-int/lit8 v1, v1, 0x1

    if-nez v1, :cond_3

    iget v1, p0, Landroid/content/pm/ApplicationInfo;->flags:I

    and-int/lit16 v1, v1, 0x80

    if-nez v1, :cond_3

    const/4 v0, 0x1

    goto :goto_3
.end method

.method public static isXiaomiPreInstalledChannel()Z
    .registers 2

    .prologue
    .line 47
    invoke-static {}, Lcom/cleanmaster/hpsharelib/base/util/HostHelper;->getChannel()I

    move-result v0

    const v1, 0x186a8

    if-eq v0, v1, :cond_12

    invoke-static {}, Lcom/cleanmaster/hpsharelib/base/util/HostHelper;->getChannel()I

    move-result v0

    const v1, 0x77ce2a8a

    if-ne v0, v1, :cond_14

    :cond_12
    const/4 v0, 0x1

    :goto_13
    return v0

    :cond_14
    const/4 v0, 0x0

    goto :goto_13
.end method

.method public static isZH_CN()Z
    .registers 3

    .prologue
    .line 113
    invoke-static {}, Lcom/cleanmaster/hpsharelib/base/util/HostHelper;->getAppContext()Landroid/content/Context;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    .line 114
    invoke-static {v0}, Lcom/cleanmaster/hpsharelib/base/CommendUtils;->getLanguageSelected(Landroid/content/Context;)Lcom/cm/plugincluster/cleanmaster/base/util/system/LanguageCountry;

    move-result-object v0

    .line 116
    if-eqz v0, :cond_28

    sget-object v1, Lcom/cm/plugincluster/cleanmaster/base/util/system/LanguageCountry;->LANGUAGE_OPTION_ZH:Ljava/lang/String;

    invoke-virtual {v0}, Lcom/cm/plugincluster/cleanmaster/base/util/system/LanguageCountry;->getLanguage()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_28

    sget-object v1, Lcom/cm/plugincluster/cleanmaster/base/util/system/LanguageCountry;->COUNTRY_OPTION_CN:Ljava/lang/String;

    .line 117
    invoke-virtual {v0}, Lcom/cm/plugincluster/cleanmaster/base/util/system/LanguageCountry;->getCountry()Ljava/lang/String;

    move-result-object v0

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

    move-result v0

    if-eqz v0, :cond_28

    const/4 v0, 0x1

    .line 116
    :goto_27
    return v0

    .line 117
    :cond_28
    const/4 v0, 0x0

    goto :goto_27
.end method

.method private static readAssetsFileLineString(Ljava/lang/String;)Ljava/lang/String;
    .registers 9

    .prologue
    const/4 v0, 0x0

    .line 136
    invoke-static {}, Lcom/cleanmaster/hpsharelib/base/util/HostHelper;->getAppContext()Landroid/content/Context;

    move-result-object v1

    .line 137
    if-nez v1, :cond_8

    .line 166
    :goto_7
    return-object v0

    .line 141
    :cond_8
    invoke-virtual {v1}, Landroid/content/Context;->getAssets()Landroid/content/res/AssetManager;

    move-result-object v1

    .line 148
    :try_start_c
    invoke-virtual {v1, p0}, Landroid/content/res/AssetManager;->open(Ljava/lang/String;)Ljava/io/InputStream;
    :try_end_f
    .catch Ljava/io/IOException; {:try_start_c .. :try_end_f} :catch_30
    .catchall {:try_start_c .. :try_end_f} :catchall_5d

    move-result-object v3

    .line 149
    if-eqz v3, :cond_83

    .line 150
    :try_start_12
    new-instance v2, Ljava/io/InputStreamReader;

    invoke-direct {v2, v3}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V
    :try_end_17
    .catch Ljava/io/IOException; {:try_start_12 .. :try_end_17} :catch_7a
    .catchall {:try_start_12 .. :try_end_17} :catchall_6d

    .line 151
    :try_start_17
    new-instance v1, Ljava/io/BufferedReader;

    invoke-direct {v1, v2}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
    :try_end_1c
    .catch Ljava/io/IOException; {:try_start_17 .. :try_end_1c} :catch_7e
    .catchall {:try_start_17 .. :try_end_1c} :catchall_73

    .line 152
    :try_start_1c
    invoke-virtual {v1}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v0

    .line 153
    if-eqz v0, :cond_26

    .line 154
    invoke-virtual {v0}, Ljava/lang/String;->trim()Ljava/lang/String;
    :try_end_25
    .catch Ljava/io/IOException; {:try_start_1c .. :try_end_25} :catch_81
    .catchall {:try_start_1c .. :try_end_25} :catchall_78

    move-result-object v0

    .line 161
    :cond_26
    :goto_26
    invoke-static {v1}, Lcom/cleanmaster/hpsharelib/utils/io/IOUtils;->closeSilently(Ljava/io/Closeable;)V

    .line 162
    invoke-static {v2}, Lcom/cleanmaster/hpsharelib/utils/io/IOUtils;->closeSilently(Ljava/io/Closeable;)V

    .line 163
    invoke-static {v3}, Lcom/cleanmaster/hpsharelib/utils/io/IOUtils;->closeSilently(Ljava/io/Closeable;)V

    goto :goto_7

    .line 157
    :catch_30
    move-exception v1

    move-object v1, v0

    move-object v2, v0

    move-object v3, v0

    .line 158
    :goto_34
    :try_start_34
    sget-object v4, Ljava/lang/System;->err:Ljava/io/PrintStream;

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "Commons.readAssetsFileLineString :"

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    const-string/jumbo v6, "\u9519\u8bef"

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
    :try_end_53
    .catchall {:try_start_34 .. :try_end_53} :catchall_78

    .line 161
    invoke-static {v1}, Lcom/cleanmaster/hpsharelib/utils/io/IOUtils;->closeSilently(Ljava/io/Closeable;)V

    .line 162
    invoke-static {v2}, Lcom/cleanmaster/hpsharelib/utils/io/IOUtils;->closeSilently(Ljava/io/Closeable;)V

    .line 163
    invoke-static {v3}, Lcom/cleanmaster/hpsharelib/utils/io/IOUtils;->closeSilently(Ljava/io/Closeable;)V

    goto :goto_7

    .line 161
    :catchall_5d
    move-exception v1

    move-object v2, v0

    move-object v3, v0

    move-object v7, v1

    move-object v1, v0

    move-object v0, v7

    :goto_63
    invoke-static {v1}, Lcom/cleanmaster/hpsharelib/utils/io/IOUtils;->closeSilently(Ljava/io/Closeable;)V

    .line 162
    invoke-static {v2}, Lcom/cleanmaster/hpsharelib/utils/io/IOUtils;->closeSilently(Ljava/io/Closeable;)V

    .line 163
    invoke-static {v3}, Lcom/cleanmaster/hpsharelib/utils/io/IOUtils;->closeSilently(Ljava/io/Closeable;)V

    throw v0

    .line 161
    :catchall_6d
    move-exception v1

    move-object v2, v0

    move-object v7, v0

    move-object v0, v1

    move-object v1, v7

    goto :goto_63

    :catchall_73
    move-exception v1

    move-object v7, v1

    move-object v1, v0

    move-object v0, v7

    goto :goto_63

    :catchall_78
    move-exception v0

    goto :goto_63

    .line 157
    :catch_7a
    move-exception v1

    move-object v1, v0

    move-object v2, v0

    goto :goto_34

    :catch_7e
    move-exception v1

    move-object v1, v0

    goto :goto_34

    :catch_81
    move-exception v4

    goto :goto_34

    :cond_83
    move-object v1, v0

    move-object v2, v0

    goto :goto_26
.end method