.class public Lcom/alipay/sdk/util/DeviceInfo;
.super Ljava/lang/Object;
.source "SourceFile"


# static fields
.field private static final MACADDRESS_DEFAULT:Ljava/lang/String; = "00:00:00:00:00:00"

.field private static mInstance:Lcom/alipay/sdk/util/DeviceInfo;


# instance fields
.field private mIMEI:Ljava/lang/String;

.field private mIMSI:Ljava/lang/String;

.field private mMacAddress:Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .locals 0

    return-void
.end method

.method private constructor <init>(Landroid/content/Context;)V
    .locals 2

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

    :try_start_0
    const-string v0, "phone"

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

    move-result-object v0

    check-cast v0, Landroid/telephony/TelephonyManager;

    .line 38
    invoke-virtual {v0}, Landroid/telephony/TelephonyManager;->getDeviceId()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Lcom/alipay/sdk/util/DeviceInfo;->setIMEI(Ljava/lang/String;)V

    .line 39
    invoke-virtual {v0}, Landroid/telephony/TelephonyManager;->getSubscriberId()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/alipay/sdk/util/DeviceInfo;->setIMSI(Ljava/lang/String;)V

    const-string v0, "wifi"

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

    move-result-object p1

    check-cast p1, Landroid/net/wifi/WifiManager;

    .line 42
    invoke-virtual {p1}, Landroid/net/wifi/WifiManager;->getConnectionInfo()Landroid/net/wifi/WifiInfo;

    move-result-object p1

    .line 43
    invoke-virtual {p1}, Landroid/net/wifi/WifiInfo;->getMacAddress()Ljava/lang/String;

    move-result-object p1

    iput-object p1, p0, Lcom/alipay/sdk/util/DeviceInfo;->mMacAddress:Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 47
    iget-object p1, p0, Lcom/alipay/sdk/util/DeviceInfo;->mMacAddress:Ljava/lang/String;

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

    move-result p1

    if-eqz p1, :cond_0

    :goto_0
    const-string p1, "00:00:00:00:00:00"

    .line 48
    iput-object p1, p0, Lcom/alipay/sdk/util/DeviceInfo;->mMacAddress:Ljava/lang/String;

    return-void

    :catchall_0
    move-exception p1

    goto :goto_1

    :catch_0
    move-exception p1

    .line 45
    :try_start_1
    invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 47
    iget-object p1, p0, Lcom/alipay/sdk/util/DeviceInfo;->mMacAddress:Ljava/lang/String;

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

    move-result p1

    if-eqz p1, :cond_0

    goto :goto_0

    :cond_0
    return-void

    :goto_1
    iget-object v0, p0, Lcom/alipay/sdk/util/DeviceInfo;->mMacAddress:Ljava/lang/String;

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

    move-result v0

    if-eqz v0, :cond_1

    const-string v0, "00:00:00:00:00:00"

    .line 48
    iput-object v0, p0, Lcom/alipay/sdk/util/DeviceInfo;->mMacAddress:Ljava/lang/String;

    :cond_1
    throw p1
.end method

.method public static getDesKey(Landroid/content/Context;)Ljava/lang/String;
    .locals 2

    .line 144
    invoke-static {p0}, Lcom/alipay/sdk/util/DeviceInfo;->getInstance(Landroid/content/Context;)Lcom/alipay/sdk/util/DeviceInfo;

    move-result-object p0

    invoke-virtual {p0}, Lcom/alipay/sdk/util/DeviceInfo;->getClientId()Ljava/lang/String;

    move-result-object p0

    const/4 v0, 0x0

    const/16 v1, 0x8

    .line 145
    invoke-virtual {p0, v0, v1}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object p0

    return-object p0
.end method

.method public static getInstance(Landroid/content/Context;)Lcom/alipay/sdk/util/DeviceInfo;
    .locals 1

    .line 26
    sget-object v0, Lcom/alipay/sdk/util/DeviceInfo;->mInstance:Lcom/alipay/sdk/util/DeviceInfo;

    if-nez v0, :cond_0

    .line 27
    new-instance v0, Lcom/alipay/sdk/util/DeviceInfo;

    invoke-direct {v0, p0}, Lcom/alipay/sdk/util/DeviceInfo;-><init>(Landroid/content/Context;)V

    sput-object v0, Lcom/alipay/sdk/util/DeviceInfo;->mInstance:Lcom/alipay/sdk/util/DeviceInfo;

    .line 30
    :cond_0
    sget-object p0, Lcom/alipay/sdk/util/DeviceInfo;->mInstance:Lcom/alipay/sdk/util/DeviceInfo;

    return-object p0
.end method

.method public static getLocal(Landroid/content/Context;)Ljava/lang/String;
    .locals 0

    if-nez p0, :cond_0

    const-string p0, ""

    return-object p0

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

    move-result-object p0

    .line 157
    invoke-virtual {p0}, Landroid/content/res/Resources;->getConfiguration()Landroid/content/res/Configuration;

    move-result-object p0

    .line 158
    iget-object p0, p0, Landroid/content/res/Configuration;->locale:Ljava/util/Locale;

    .line 159
    invoke-virtual {p0}, Ljava/util/Locale;->toString()Ljava/lang/String;

    move-result-object p0
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    return-object p0

    :catch_0
    const-string p0, ""

    return-object p0
.end method

.method public static getNetConnectionType(Landroid/content/Context;)Lcom/alipay/sdk/util/NetConnectionType;
    .locals 1

    const-string v0, "connectivity"

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

    move-result-object p0

    check-cast p0, Landroid/net/ConnectivityManager;

    .line 128
    :try_start_0
    invoke-virtual {p0}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;

    move-result-object p0

    if-eqz p0, :cond_0

    .line 130
    invoke-virtual {p0}, Landroid/net/NetworkInfo;->getType()I

    move-result v0

    if-nez v0, :cond_0

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

    move-result p0

    invoke-static {p0}, Lcom/alipay/sdk/util/NetConnectionType;->getTypeByCode(I)Lcom/alipay/sdk/util/NetConnectionType;

    move-result-object p0

    return-object p0

    :cond_0
    if-eqz p0, :cond_1

    .line 133
    invoke-virtual {p0}, Landroid/net/NetworkInfo;->getType()I

    move-result p0

    const/4 v0, 0x1

    if-ne p0, v0, :cond_1

    .line 134
    sget-object p0, Lcom/alipay/sdk/util/NetConnectionType;->WIFI:Lcom/alipay/sdk/util/NetConnectionType;

    return-object p0

    .line 136
    :cond_1
    sget-object p0, Lcom/alipay/sdk/util/NetConnectionType;->NONE:Lcom/alipay/sdk/util/NetConnectionType;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    return-object p0

    .line 139
    :catch_0
    sget-object p0, Lcom/alipay/sdk/util/NetConnectionType;->NONE:Lcom/alipay/sdk/util/NetConnectionType;

    return-object p0
.end method


# virtual methods
.method public getClientId()Ljava/lang/String;
    .locals 3

    .line 101
    invoke-virtual {p0}, Lcom/alipay/sdk/util/DeviceInfo;->getIMEI()Ljava/lang/String;

    move-result-object v0

    .line 102
    new-instance v1, Ljava/lang/StringBuilder;

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

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

    const-string v0, "|"

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

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

    move-result-object v0

    .line 105
    invoke-virtual {p0}, Lcom/alipay/sdk/util/DeviceInfo;->getIMSI()Ljava/lang/String;

    move-result-object v1

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

    move-result v2

    if-eqz v2, :cond_0

    .line 107
    new-instance v1, Ljava/lang/StringBuilder;

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

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

    const-string v0, "000000000000000"

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

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

    move-result-object v0

    goto :goto_0

    .line 109
    :cond_0
    new-instance v2, Ljava/lang/StringBuilder;

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

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

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

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

    move-result-object v0

    :goto_0
    return-object v0
.end method

.method public getIMEI()Ljava/lang/String;
    .locals 1

    .line 63
    iget-object v0, p0, Lcom/alipay/sdk/util/DeviceInfo;->mIMEI:Ljava/lang/String;

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

    move-result v0

    if-eqz v0, :cond_0

    const-string v0, "000000000000000"

    .line 64
    iput-object v0, p0, Lcom/alipay/sdk/util/DeviceInfo;->mIMEI:Ljava/lang/String;

    .line 67
    :cond_0
    iget-object v0, p0, Lcom/alipay/sdk/util/DeviceInfo;->mIMEI:Ljava/lang/String;

    return-object v0
.end method

.method public getIMSI()Ljava/lang/String;
    .locals 1

    .line 55
    iget-object v0, p0, Lcom/alipay/sdk/util/DeviceInfo;->mIMSI:Ljava/lang/String;

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

    move-result v0

    if-eqz v0, :cond_0

    const-string v0, "000000000000000"

    .line 56
    iput-object v0, p0, Lcom/alipay/sdk/util/DeviceInfo;->mIMSI:Ljava/lang/String;

    .line 59
    :cond_0
    iget-object v0, p0, Lcom/alipay/sdk/util/DeviceInfo;->mIMSI:Ljava/lang/String;

    return-object v0
.end method

.method public getMacAddress()Ljava/lang/String;
    .locals 1

    .line 115
    iget-object v0, p0, Lcom/alipay/sdk/util/DeviceInfo;->mMacAddress:Ljava/lang/String;

    return-object v0
.end method

.method public setIMEI(Ljava/lang/String;)V
    .locals 5

    if-eqz p1, :cond_3

    .line 81
    invoke-virtual {p1}, Ljava/lang/String;->getBytes()[B

    move-result-object p1

    const/4 v0, 0x0

    const/4 v1, 0x0

    .line 82
    :goto_0
    array-length v2, p1

    if-ge v1, v2, :cond_2

    .line 83
    aget-byte v2, p1, v1

    const/16 v3, 0x30

    if-lt v2, v3, :cond_0

    aget-byte v2, p1, v1

    const/16 v4, 0x39

    if-le v2, v4, :cond_1

    .line 86
    :cond_0
    aput-byte v3, p1, v1

    :cond_1
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 88
    :cond_2
    new-instance v1, Ljava/lang/String;

    invoke-direct {v1, p1}, Ljava/lang/String;-><init>([B)V

    .line 89
    new-instance p1, Ljava/lang/StringBuilder;

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

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

    const-string v1, "000000000000000"

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

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

    move-result-object p1

    const/16 v1, 0xf

    .line 90
    invoke-virtual {p1, v0, v1}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object p1

    .line 93
    :cond_3
    iput-object p1, p0, Lcom/alipay/sdk/util/DeviceInfo;->mIMEI:Ljava/lang/String;

    return-void
.end method

.method public setIMSI(Ljava/lang/String;)V
    .locals 2

    if-eqz p1, :cond_0

    .line 72
    new-instance v0, Ljava/lang/StringBuilder;

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

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

    const-string p1, "000000000000000"

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

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

    move-result-object p1

    const/4 v0, 0x0

    const/16 v1, 0xf

    .line 73
    invoke-virtual {p1, v0, v1}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object p1

    .line 76
    :cond_0
    iput-object p1, p0, Lcom/alipay/sdk/util/DeviceInfo;->mIMSI:Ljava/lang/String;

    return-void
.end method
