Utils.smali

.class public Lcom/cleanmaster/filecloud/utils/Utils;
.super Ljava/lang/Object;
.source "Utils.java"


# static fields
.field public static final NETWORK_TYPE_2G:I = 0x2

.field public static final NETWORK_TYPE_3G:I = 0x3

.field public static final NETWORK_TYPE_4G:I = 0x4

.field public static final NETWORK_TYPE_BT:I = 0x63

.field public static final NETWORK_TYPE_NONE:I = 0x9

.field public static final NETWORK_TYPE_OTHER:I = 0x6

.field public static final NETWORK_TYPE_UNKNOWN:I = 0x7

.field public static final NETWORK_TYPE_WIFI:I = 0x1

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


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

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

    return-void
.end method

.method public static getAndroidId()Ljava/lang/String;
    .registers 2

    .prologue
    .line 26
    sget-object v0, Lcom/cleanmaster/filecloud/utils/Utils;->mAndroidId:Ljava/lang/String;

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

    move-result v0

    if-eqz v0, :cond_18

    .line 28
    :try_start_8
    invoke-static {}, Lcom/cleanmaster/filecloud/utils/Utils;->getContext()Landroid/content/Context;

    move-result-object v0

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

    move-result-object v0

    .line 29
    const-string v1, "android_id"

    invoke-static {v0, v1}, Landroid/provider/Settings$System;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/cleanmaster/filecloud/utils/Utils;->mAndroidId:Ljava/lang/String;
    :try_end_18
    .catch Ljava/lang/Exception; {:try_start_8 .. :try_end_18} :catch_1b

    .line 34
    :cond_18
    :goto_18
    sget-object v0, Lcom/cleanmaster/filecloud/utils/Utils;->mAndroidId:Ljava/lang/String;

    return-object v0

    .line 30
    :catch_1b
    move-exception v0

    .line 31
    const-string v0, ""

    sput-object v0, Lcom/cleanmaster/filecloud/utils/Utils;->mAndroidId:Ljava/lang/String;

    goto :goto_18
.end method

.method public static final getContext()Landroid/content/Context;
    .registers 1

    .prologue
    .line 20
    invoke-static {}, Lcom/cleanmaster/junk/util/JunkUtils;->getContext()Landroid/content/Context;

    move-result-object v0

    return-object v0
.end method

.method public static getNetworkType(Landroid/content/Context;)I
    .registers 6

    .prologue
    const/4 v3, 0x3

    const/4 v2, 0x1

    const/4 v1, 0x7

    .line 76
    if-nez p0, :cond_7

    move v0, v1

    .line 138
    :goto_6
    return v0

    .line 81
    :cond_7
    :try_start_7
    const-string v0, "connectivity"

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

    move-result-object v0

    check-cast v0, Landroid/net/ConnectivityManager;

    .line 82
    invoke-virtual {v0}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;

    move-result-object v0

    .line 84
    if-eqz v0, :cond_1b

    invoke-virtual {v0}, Landroid/net/NetworkInfo;->isConnected()Z

    move-result v4

    if-nez v4, :cond_1e

    .line 85
    :cond_1b
    const/16 v0, 0x9

    goto :goto_6

    .line 88
    :cond_1e
    invoke-virtual {v0}, Landroid/net/NetworkInfo;->getType()I

    move-result v4

    if-ne v2, v4, :cond_26

    move v0, v2

    .line 89
    goto :goto_6

    .line 92
    :cond_26
    invoke-virtual {v0}, Landroid/net/NetworkInfo;->getType()I

    move-result v2

    if-ne v1, v2, :cond_2f

    .line 93
    const/16 v0, 0x63

    goto :goto_6

    .line 96
    :cond_2f
    invoke-virtual {v0}, Landroid/net/NetworkInfo;->getType()I

    move-result v2

    if-nez v2, :cond_68

    .line 97
    invoke-virtual {v0}, Landroid/net/NetworkInfo;->getSubtypeName()Ljava/lang/String;

    move-result-object v2

    .line 98
    invoke-virtual {v0}, Landroid/net/NetworkInfo;->getSubtype()I

    move-result v0

    .line 100
    packed-switch v0, :pswitch_data_6a

    .line 126
    const-string v0, "TD-SCDMA"

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

    move-result v0

    if-nez v0, :cond_58

    const-string v0, "WCDMA"

    .line 127
    invoke-virtual {v0, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_58

    const-string v0, "CDMA2000"

    .line 128
    invoke-virtual {v0, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
    :try_end_55
    .catch Ljava/lang/Exception; {:try_start_7 .. :try_end_55} :catch_64

    move-result v0

    if-eqz v0, :cond_62

    :cond_58
    move v0, v3

    .line 130
    goto :goto_6

    :pswitch_5a
    move v0, v1

    .line 102
    goto :goto_6

    .line 109
    :pswitch_5c
    const/4 v0, 0x2

    goto :goto_6

    :pswitch_5e
    move v0, v3

    .line 120
    goto :goto_6

    .line 123
    :pswitch_60
    const/4 v0, 0x4

    goto :goto_6

    .line 132
    :cond_62
    const/4 v0, 0x6

    goto :goto_6

    .line 135
    :catch_64
    move-exception v0

    .line 136
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    :cond_68
    move v0, v1

    .line 138
    goto :goto_6

    .line 100
    :pswitch_data_6a
    .packed-switch 0x0
        :pswitch_5a
        :pswitch_5c
        :pswitch_5c
        :pswitch_5e
        :pswitch_5c
        :pswitch_5e
        :pswitch_5e
        :pswitch_5c
        :pswitch_5e
        :pswitch_5e
        :pswitch_5e
        :pswitch_5c
        :pswitch_5e
        :pswitch_60
        :pswitch_5e
        :pswitch_5e
    .end packed-switch
.end method

.method public static isNetworkAvailable(Landroid/content/Context;)Z
    .registers 6

    .prologue
    const/4 v2, 0x1

    const/4 v1, 0x0

    .line 146
    if-nez p0, :cond_6

    move v0, v1

    .line 177
    :goto_5
    return v0

    .line 150
    :cond_6
    const-string v0, "connectivity"

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

    move-result-object v0

    check-cast v0, Landroid/net/ConnectivityManager;

    .line 151
    if-nez v0, :cond_12

    move v0, v1

    .line 152
    goto :goto_5

    .line 156
    :cond_12
    const/4 v3, 0x0

    :try_start_13
    invoke-virtual {v0, v3}, Landroid/net/ConnectivityManager;->getNetworkInfo(I)Landroid/net/NetworkInfo;

    move-result-object v3

    .line 157
    if-eqz v3, :cond_28

    .line 158
    invoke-virtual {v3}, Landroid/net/NetworkInfo;->getState()Landroid/net/NetworkInfo$State;

    move-result-object v3

    .line 159
    sget-object v4, Landroid/net/NetworkInfo$State;->CONNECTED:Landroid/net/NetworkInfo$State;

    if-eq v3, v4, :cond_25

    sget-object v4, Landroid/net/NetworkInfo$State;->CONNECTING:Landroid/net/NetworkInfo$State;
    :try_end_23
    .catch Ljava/lang/Exception; {:try_start_13 .. :try_end_23} :catch_27

    if-ne v3, v4, :cond_28

    :cond_25
    move v0, v2

    .line 160
    goto :goto_5

    .line 163
    :catch_27
    move-exception v3

    .line 167
    :cond_28
    const/4 v3, 0x1

    :try_start_29
    invoke-virtual {v0, v3}, Landroid/net/ConnectivityManager;->getNetworkInfo(I)Landroid/net/NetworkInfo;

    move-result-object v0

    .line 168
    if-eqz v0, :cond_3e

    .line 169
    invoke-virtual {v0}, Landroid/net/NetworkInfo;->getState()Landroid/net/NetworkInfo$State;

    move-result-object v0

    .line 170
    sget-object v3, Landroid/net/NetworkInfo$State;->CONNECTED:Landroid/net/NetworkInfo$State;

    if-eq v0, v3, :cond_3b

    sget-object v3, Landroid/net/NetworkInfo$State;->CONNECTING:Landroid/net/NetworkInfo$State;
    :try_end_39
    .catch Ljava/lang/Exception; {:try_start_29 .. :try_end_39} :catch_3d

    if-ne v0, v3, :cond_3e

    :cond_3b
    move v0, v2

    .line 171
    goto :goto_5

    .line 174
    :catch_3d
    move-exception v0

    :cond_3e
    move v0, v1

    .line 177
    goto :goto_5
.end method

.method private static isWifiActive(Landroid/content/Context;)Ljava/lang/Boolean;
    .registers 8

    .prologue
    const/4 v2, 0x0

    .line 43
    if-nez p0, :cond_8

    .line 44
    invoke-static {v2}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v0

    .line 63
    :goto_7
    return-object v0

    .line 47
    :cond_8
    invoke-static {v2}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v1

    .line 50
    :try_start_c
    const-string v0, "connectivity"

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

    move-result-object v0

    check-cast v0, Landroid/net/ConnectivityManager;

    .line 51
    invoke-virtual {v0}, Landroid/net/ConnectivityManager;->getAllNetworkInfo()[Landroid/net/NetworkInfo;

    move-result-object v3

    .line 53
    array-length v4, v3

    move v0, v2

    :goto_1a
    if-ge v0, v4, :cond_42

    aget-object v5, v3, v0

    .line 54
    invoke-virtual {v5}, Landroid/net/NetworkInfo;->isConnected()Z

    move-result v6

    if-eqz v6, :cond_36

    invoke-virtual {v5}, Landroid/net/NetworkInfo;->getTypeName()Ljava/lang/String;

    move-result-object v5

    const-string v6, "WIFI"

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

    move-result v5

    if-eqz v5, :cond_36

    .line 55
    const/4 v0, 0x1

    invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
    :try_end_34
    .catch Ljava/lang/Exception; {:try_start_c .. :try_end_34} :catch_39

    move-result-object v0

    goto :goto_7

    .line 53
    :cond_36
    add-int/lit8 v0, v0, 0x1

    goto :goto_1a

    .line 59
    :catch_39
    move-exception v0

    .line 60
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    .line 61
    invoke-static {v2}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v0

    goto :goto_7

    :cond_42
    move-object v0, v1

    goto :goto_7
.end method

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

    .prologue
    .line 142
    invoke-static {p0}, Lcom/cleanmaster/filecloud/utils/Utils;->isWifiActive(Landroid/content/Context;)Ljava/lang/Boolean;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v0

    return v0
.end method