br.smali
.class Lcom/xiaomi/push/br;
.super Ljava/lang/Object;
# direct methods
.method public static a(Landroid/content/Context;)Landroid/net/DhcpInfo;
.registers 6
const/4 v1, 0x0
if-nez p0, :cond_4
:cond_3
:goto_3
return-object v1
:cond_4
const-string v0, "wifi"
invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/net/wifi/WifiManager;
if-eqz v0, :cond_3
invoke-virtual {v0}, Landroid/net/wifi/WifiManager;->isWifiEnabled()Z
move-result v2
if-eqz v2, :cond_3
:try_start_14
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v2
const-string v3, "android.permission.ACCESS_WIFI_STATE"
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v4
invoke-virtual {v2, v3, v4}, Landroid/content/pm/PackageManager;->checkPermission(Ljava/lang/String;Ljava/lang/String;)I
move-result v2
if-nez v2, :cond_2d
invoke-virtual {v0}, Landroid/net/wifi/WifiManager;->getDhcpInfo()Landroid/net/DhcpInfo;
:try_end_27
.catch Ljava/lang/Exception; {:try_start_14 .. :try_end_27} :catch_2a
move-result-object v0
:goto_28
move-object v1, v0
goto :goto_3
:catch_2a
move-exception v0
move-object v0, v1
goto :goto_28
:cond_2d
move-object v0, v1
goto :goto_28
.end method
.method public static a(Landroid/content/Context;I)Ljava/lang/String;
.registers 7
const/4 v1, 0x0
:try_start_1
const-string v0, "wifi"
invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/net/wifi/WifiManager;
if-eqz v0, :cond_11
invoke-virtual {v0}, Landroid/net/wifi/WifiManager;->isWifiEnabled()Z
:try_end_e
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_e} :catch_46
move-result v2
if-nez v2, :cond_12
:cond_11
:goto_11
return-object v1
:cond_12
:try_start_12
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v2
const-string v3, "android.permission.ACCESS_WIFI_STATE"
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v4
invoke-virtual {v2, v3, v4}, Landroid/content/pm/PackageManager;->checkPermission(Ljava/lang/String;Ljava/lang/String;)I
move-result v2
if-nez v2, :cond_48
invoke-virtual {v0}, Landroid/net/wifi/WifiManager;->getConnectionInfo()Landroid/net/wifi/WifiInfo;
:try_end_25
.catch Ljava/lang/Exception; {:try_start_12 .. :try_end_25} :catch_2f
move-result-object v0
:goto_26
if-eqz v0, :cond_11
if-nez p1, :cond_32
:try_start_2a
invoke-virtual {v0}, Landroid/net/wifi/WifiInfo;->getMacAddress()Ljava/lang/String;
move-result-object v1
goto :goto_11
:catch_2f
move-exception v0
move-object v0, v1
goto :goto_26
:cond_32
const/4 v2, 0x1
if-ne p1, v2, :cond_3a
invoke-virtual {v0}, Landroid/net/wifi/WifiInfo;->getBSSID()Ljava/lang/String;
move-result-object v1
goto :goto_11
:cond_3a
const/4 v2, 0x2
if-ne p1, v2, :cond_11
invoke-virtual {v0}, Landroid/net/wifi/WifiInfo;->getSSID()Ljava/lang/String;
move-result-object v0
invoke-static {v0}, Lcom/xiaomi/push/br;->a(Ljava/lang/String;)Ljava/lang/String;
:try_end_44
.catch Ljava/lang/Exception; {:try_start_2a .. :try_end_44} :catch_46
move-result-object v1
goto :goto_11
:catch_46
move-exception v0
goto :goto_11
:cond_48
move-object v0, v1
goto :goto_26
.end method
.method private static a(Ljava/lang/String;)Ljava/lang/String;
.registers 3
const-string v0, "\""
invoke-virtual {p0, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v0
if-eqz v0, :cond_1b
const-string v0, "\""
invoke-virtual {p0, v0}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z
move-result v0
if-eqz v0, :cond_1b
const/4 v0, 0x1
invoke-virtual {p0}, Ljava/lang/String;->length()I
move-result v1
add-int/lit8 v1, v1, -0x1
invoke-virtual {p0, v0, v1}, Ljava/lang/String;->substring(II)Ljava/lang/String;
move-result-object p0
:cond_1b
return-object p0
.end method
.method public static a(I)Ljava/net/InetAddress;
.registers 4
const/4 v0, 0x4
new-array v0, v0, [B
const/4 v1, 0x0
and-int/lit16 v2, p0, 0xff
int-to-byte v2, v2
aput-byte v2, v0, v1
const/4 v1, 0x1
shr-int/lit8 v2, p0, 0x8
and-int/lit16 v2, v2, 0xff
int-to-byte v2, v2
aput-byte v2, v0, v1
const/4 v1, 0x2
shr-int/lit8 v2, p0, 0x10
and-int/lit16 v2, v2, 0xff
int-to-byte v2, v2
aput-byte v2, v0, v1
const/4 v1, 0x3
shr-int/lit8 v2, p0, 0x18
and-int/lit16 v2, v2, 0xff
int-to-byte v2, v2
aput-byte v2, v0, v1
:try_start_21
invoke-static {v0}, Ljava/net/InetAddress;->getByAddress([B)Ljava/net/InetAddress;
:try_end_24
.catch Ljava/net/UnknownHostException; {:try_start_21 .. :try_end_24} :catch_26
move-result-object v0
return-object v0
:catch_26
move-exception v0
new-instance v0, Ljava/lang/AssertionError;
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
throw v0
.end method
.method public static a(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V
.registers 5
const-string v0, "devicediscover"
const/4 v1, 0x0
invoke-virtual {p0, v0, v1}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
move-result-object v0
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
invoke-interface {v0, p1, p2}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z
return-void
.end method
.method public static b(Landroid/content/Context;)Ljava/lang/String;
.registers 3
const/4 v0, 0x0
:try_start_1
invoke-static {p0}, Lcom/xiaomi/push/br;->a(Landroid/content/Context;)Landroid/net/DhcpInfo;
move-result-object v1
if-nez v1, :cond_8
:goto_7
return-object v0
:cond_8
iget v1, v1, Landroid/net/DhcpInfo;->gateway:I
invoke-static {v1}, Lcom/xiaomi/push/br;->a(I)Ljava/net/InetAddress;
move-result-object v1
invoke-virtual {v1}, Ljava/net/InetAddress;->getHostAddress()Ljava/lang/String;
:try_end_11
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_11} :catch_13
move-result-object v0
goto :goto_7
:catch_13
move-exception v1
goto :goto_7
.end method
.method public static b(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
.registers 5
const-string v0, "devicediscover"
const/4 v1, 0x0
invoke-virtual {p0, v0, v1}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
move-result-object v0
invoke-interface {v0, p1, p2}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method public static c(Landroid/content/Context;)Ljava/lang/String;
.registers 3
const/4 v0, 0x0
:try_start_1
invoke-static {p0}, Lcom/xiaomi/push/br;->a(Landroid/content/Context;)Landroid/net/DhcpInfo;
move-result-object v1
if-nez v1, :cond_8
:goto_7
return-object v0
:cond_8
iget v1, v1, Landroid/net/DhcpInfo;->serverAddress:I
invoke-static {v1}, Lcom/xiaomi/push/br;->a(I)Ljava/net/InetAddress;
move-result-object v1
invoke-virtual {v1}, Ljava/net/InetAddress;->getHostAddress()Ljava/lang/String;
:try_end_11
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_11} :catch_13
move-result-object v0
goto :goto_7
:catch_13
move-exception v1
goto :goto_7
.end method
.method public static d(Landroid/content/Context;)Ljava/lang/String;
.registers 7
const/4 v0, 0x0
invoke-static {p0, v0}, Lcom/xiaomi/push/br;->a(Landroid/content/Context;I)Ljava/lang/String;
move-result-object v0
if-eqz v0, :cond_15
invoke-virtual {v0}, Ljava/lang/String;->isEmpty()Z
move-result v1
if-nez v1, :cond_15
const-string v1, "02:00:00:00:00:00"
invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_37
:cond_15
const/4 v2, 0x0
const/16 v1, 0x400
:try_start_18
new-array v3, v1, [C
new-instance v1, Ljava/io/FileReader;
const-string v4, "/sys/class/net/wlan0/address"
invoke-direct {v1, v4}, Ljava/io/FileReader;-><init>(Ljava/lang/String;)V
:try_end_21
.catch Ljava/io/FileNotFoundException; {:try_start_18 .. :try_end_21} :catch_38
.catch Ljava/lang/Exception; {:try_start_18 .. :try_end_21} :catch_42
.catchall {:try_start_18 .. :try_end_21} :catchall_4c
const/4 v2, 0x0
const/16 v4, 0x400
:try_start_24
invoke-virtual {v1, v3, v2, v4}, Ljava/io/FileReader;->read([CII)I
move-result v2
new-instance v4, Ljava/lang/String;
const/4 v5, 0x0
invoke-direct {v4, v3, v5, v2}, Ljava/lang/String;-><init>([CII)V
invoke-virtual {v4}, Ljava/lang/String;->trim()Ljava/lang/String;
:try_end_31
.catch Ljava/io/FileNotFoundException; {:try_start_24 .. :try_end_31} :catch_5c
.catch Ljava/lang/Exception; {:try_start_24 .. :try_end_31} :catch_5a
.catchall {:try_start_24 .. :try_end_31} :catchall_58
move-result-object v0
if-eqz v1, :cond_37
:try_start_34
invoke-virtual {v1}, Ljava/io/FileReader;->close()V
:try_end_37
.catch Ljava/lang/Exception; {:try_start_34 .. :try_end_37} :catch_54
:cond_37
:goto_37
return-object v0
:catch_38
move-exception v1
move-object v1, v2
:goto_3a
if-eqz v1, :cond_37
:try_start_3c
invoke-virtual {v1}, Ljava/io/FileReader;->close()V
:try_end_3f
.catch Ljava/lang/Exception; {:try_start_3c .. :try_end_3f} :catch_40
goto :goto_37
:catch_40
move-exception v1
goto :goto_37
:catch_42
move-exception v1
move-object v1, v2
:goto_44
if-eqz v1, :cond_37
:try_start_46
invoke-virtual {v1}, Ljava/io/FileReader;->close()V
:try_end_49
.catch Ljava/lang/Exception; {:try_start_46 .. :try_end_49} :catch_4a
goto :goto_37
:catch_4a
move-exception v1
goto :goto_37
:catchall_4c
move-exception v0
move-object v1, v2
:goto_4e
if-eqz v1, :cond_53
:try_start_50
invoke-virtual {v1}, Ljava/io/FileReader;->close()V
:try_end_53
.catch Ljava/lang/Exception; {:try_start_50 .. :try_end_53} :catch_56
:cond_53
:goto_53
throw v0
:catch_54
move-exception v1
goto :goto_37
:catch_56
move-exception v1
goto :goto_53
:catchall_58
move-exception v0
goto :goto_4e
:catch_5a
move-exception v2
goto :goto_44
:catch_5c
move-exception v2
goto :goto_3a
.end method