cee.smali
.class public Ldxoptimizer/cee;
.super Ljava/lang/Object;
.source "NetworkUtils.java"
# static fields
.field private static a:Landroid/net/ConnectivityManager;
# direct methods
.method public static a(Landroid/content/Context;)I
.registers 9
.prologue
const/4 v2, 0x5
const/4 v3, 0x3
const/4 v4, 0x1
const/4 v1, 0x2
const/4 v0, -0x1
.line 81
invoke-static {p0}, Ldxoptimizer/cee;->e(Landroid/content/Context;)Landroid/net/ConnectivityManager;
move-result-object v6
.line 82
if-nez v6, :cond_c
.line 126
:cond_b
:goto_b
return v0
.line 85
:cond_c
const/4 v5, 0x0
.line 87
:try_start_d
invoke-virtual {v6}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;
:try_end_10
.catch Ljava/lang/Exception; {:try_start_d .. :try_end_10} :catch_5d
move-result-object v5
.line 91
:goto_11
if-eqz v5, :cond_b
.line 92
invoke-virtual {v5}, Landroid/net/NetworkInfo;->getType()I
move-result v6
.line 93
invoke-virtual {v5}, Landroid/net/NetworkInfo;->getSubtype()I
move-result v5
.line 95
if-eq v6, v4, :cond_24
const/4 v7, 0x6
if-eq v6, v7, :cond_24
const/16 v7, 0x9
if-ne v6, v7, :cond_26
:cond_24
move v0, v4
.line 98
goto :goto_b
.line 99
:cond_26
if-eqz v6, :cond_2d
const/4 v4, 0x7
if-ne v6, v4, :cond_56
if-lez v5, :cond_56
.line 106
:cond_2d
if-eq v5, v3, :cond_4c
if-eq v5, v2, :cond_4c
const/4 v0, 0x6
if-eq v5, v0, :cond_4c
const/16 v0, 0x8
if-eq v5, v0, :cond_4c
const/16 v0, 0x9
if-eq v5, v0, :cond_4c
const/16 v0, 0xa
if-eq v5, v0, :cond_4c
const/16 v0, 0xc
if-eq v5, v0, :cond_4c
const/16 v0, 0xe
if-eq v5, v0, :cond_4c
const/16 v0, 0xf
if-ne v5, v0, :cond_4e
:cond_4c
move v0, v3
.line 115
goto :goto_b
.line 116
:cond_4e
const/16 v0, 0xd
if-ne v5, v0, :cond_54
move v0, v2
.line 117
goto :goto_b
:cond_54
move v0, v1
.line 119
goto :goto_b
.line 120
:cond_56
if-eq v6, v1, :cond_b
const/4 v2, 0x7
if-eq v6, v2, :cond_b
move v0, v1
.line 124
goto :goto_b
.line 88
:catch_5d
move-exception v6
goto :goto_11
.end method
.method public static a(Landroid/content/Context;Ljava/lang/String;)Ljava/net/HttpURLConnection;
.registers 8
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
const/4 v1, -0x1
.line 230
const/4 v0, 0x0
.line 235
new-instance v3, Ljava/net/URL;
invoke-direct {v3, p1}, Ljava/net/URL;-><init>(Ljava/lang/String;)V
.line 236
invoke-virtual {v3}, Ljava/net/URL;->getHost()Ljava/lang/String;
move-result-object v2
.line 237
invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v2
if-eqz v2, :cond_2e
.line 238
new-instance v0, Ljava/net/MalformedURLException;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "Malformed URL: "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {p1}, Ljava/lang/String;->toString()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/net/MalformedURLException;-><init>(Ljava/lang/String;)V
throw v0
.line 241
:cond_2e
invoke-static {p0}, Ldxoptimizer/cee;->f(Landroid/content/Context;)Z
move-result v2
if-eqz v2, :cond_62
.line 242
invoke-static {p0, p1}, Ldxoptimizer/ps;->a(Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;
move-result-object v2
.line 243
invoke-static {p0, p1}, Ldxoptimizer/ps;->b(Landroid/content/Context;Ljava/lang/String;)I
move-result v0
.line 245
:goto_3c
if-eqz v2, :cond_5b
if-eq v0, v1, :cond_5b
.line 247
:try_start_40
new-instance v1, Ljava/net/Proxy;
sget-object v4, Ljava/net/Proxy$Type;->HTTP:Ljava/net/Proxy$Type;
new-instance v5, Ljava/net/InetSocketAddress;
invoke-direct {v5, v2, v0}, Ljava/net/InetSocketAddress;-><init>(Ljava/lang/String;I)V
invoke-direct {v1, v4, v5}, Ljava/net/Proxy;-><init>(Ljava/net/Proxy$Type;Ljava/net/SocketAddress;)V
.line 249
invoke-virtual {v3, v1}, Ljava/net/URL;->openConnection(Ljava/net/Proxy;)Ljava/net/URLConnection;
move-result-object v0
check-cast v0, Ljava/net/HttpURLConnection;
:try_end_52
.catch Ljava/lang/IllegalArgumentException; {:try_start_40 .. :try_end_52} :catch_53
.line 256
:goto_52
return-object v0
.line 250
:catch_53
move-exception v0
.line 251
const-string v1, "NetworkUtils"
const-string v2, "Unexpected exception: "
invoke-static {v1, v2, v0}, Ldxoptimizer/afo;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
.line 256
:cond_5b
invoke-virtual {v3}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;
move-result-object v0
check-cast v0, Ljava/net/HttpURLConnection;
goto :goto_52
:cond_62
move-object v2, v0
move v0, v1
goto :goto_3c
.end method
.method public static b(Landroid/content/Context;)I
.registers 6
.prologue
const/4 v1, 0x4
const/4 v2, 0x1
const/4 v0, -0x1
.line 135
invoke-static {p0}, Ldxoptimizer/cee;->e(Landroid/content/Context;)Landroid/net/ConnectivityManager;
move-result-object v4
.line 136
if-nez v4, :cond_a
.line 159
:cond_9
:goto_9
return v0
.line 139
:cond_a
const/4 v3, 0x0
.line 141
:try_start_b
invoke-virtual {v4}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;
:try_end_e
.catch Ljava/lang/Exception; {:try_start_b .. :try_end_e} :catch_2c
move-result-object v3
.line 145
:goto_f
if-eqz v3, :cond_9
.line 146
invoke-virtual {v3}, Landroid/net/NetworkInfo;->getType()I
move-result v3
.line 147
if-eq v3, v2, :cond_1e
const/4 v4, 0x6
if-eq v3, v4, :cond_1e
const/16 v4, 0x9
if-ne v3, v4, :cond_20
:cond_1e
move v0, v2
.line 149
goto :goto_9
.line 150
:cond_20
if-nez v3, :cond_24
move v0, v1
.line 151
goto :goto_9
.line 152
:cond_24
const/4 v2, 0x2
if-eq v3, v2, :cond_9
const/4 v2, 0x7
if-eq v3, v2, :cond_9
move v0, v1
.line 156
goto :goto_9
.line 142
:catch_2c
move-exception v4
goto :goto_f
.end method
.method public static c(Landroid/content/Context;)Z
.registers 4
.prologue
const/4 v0, 0x0
.line 166
invoke-static {p0}, Ldxoptimizer/cee;->e(Landroid/content/Context;)Landroid/net/ConnectivityManager;
move-result-object v2
.line 167
if-nez v2, :cond_8
.line 176
:cond_7
:goto_7
return v0
.line 170
:cond_8
const/4 v1, 0x0
.line 172
:try_start_9
invoke-virtual {v2}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;
:try_end_c
.catch Ljava/lang/Exception; {:try_start_9 .. :try_end_c} :catch_17
move-result-object v1
.line 176
:goto_d
if-eqz v1, :cond_7
invoke-virtual {v1}, Landroid/net/NetworkInfo;->isConnected()Z
move-result v1
if-eqz v1, :cond_7
const/4 v0, 0x1
goto :goto_7
.line 173
:catch_17
move-exception v2
goto :goto_d
.end method
.method public static d(Landroid/content/Context;)Ljava/lang/String;
.registers 6
.prologue
const/4 v1, 0x0
.line 184
invoke-static {p0}, Ldxoptimizer/cee;->e(Landroid/content/Context;)Landroid/net/ConnectivityManager;
move-result-object v0
.line 185
if-nez v0, :cond_9
move-object v0, v1
.line 222
:goto_8
return-object v0
.line 190
:cond_9
:try_start_9
invoke-virtual {v0}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;
:try_end_c
.catch Ljava/lang/Exception; {:try_start_9 .. :try_end_c} :catch_47
move-result-object v0
.line 194
:goto_d
if-eqz v0, :cond_63
invoke-virtual {v0}, Landroid/net/NetworkInfo;->isConnected()Z
move-result v0
if-eqz v0, :cond_63
.line 199
:try_start_15
invoke-static {}, Ljava/net/NetworkInterface;->getNetworkInterfaces()Ljava/util/Enumeration;
move-result-object v3
.line 200
:cond_19
invoke-interface {v3}, Ljava/util/Enumeration;->hasMoreElements()Z
move-result v0
if-eqz v0, :cond_63
.line 201
invoke-interface {v3}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/net/NetworkInterface;
.line 202
invoke-virtual {v0}, Ljava/net/NetworkInterface;->getInetAddresses()Ljava/util/Enumeration;
move-result-object v4
.line 203
:cond_29
invoke-interface {v4}, Ljava/util/Enumeration;->hasMoreElements()Z
move-result v0
if-eqz v0, :cond_19
.line 204
invoke-interface {v4}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/net/InetAddress;
.line 205
invoke-virtual {v0}, Ljava/net/InetAddress;->getHostAddress()Ljava/lang/String;
move-result-object v2
.line 206
invoke-virtual {v0}, Ljava/net/InetAddress;->isLoopbackAddress()Z
move-result v0
if-nez v0, :cond_29
invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
:try_end_42
.catch Ljava/lang/Exception; {:try_start_15 .. :try_end_42} :catch_4a
move-result v0
if-nez v0, :cond_29
move-object v0, v2
.line 211
goto :goto_8
.line 191
:catch_47
move-exception v0
move-object v0, v1
goto :goto_d
.line 215
:catch_4a
move-exception v0
.line 216
const-string v2, "NetworkUtils"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "Failed to get network IP with exception: "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-static {v2, v0}, Ldxoptimizer/afo;->c(Ljava/lang/String;Ljava/lang/String;)V
:cond_63
move-object v0, v1
.line 222
goto :goto_8
.end method
.method private static e(Landroid/content/Context;)Landroid/net/ConnectivityManager;
.registers 3
.prologue
.line 61
:try_start_0
sget-object v0, Ldxoptimizer/cee;->a:Landroid/net/ConnectivityManager;
if-nez v0, :cond_12
.line 62
invoke-virtual {p0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
move-result-object v0
const-string v1, "connectivity"
invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/net/ConnectivityManager;
sput-object v0, Ldxoptimizer/cee;->a:Landroid/net/ConnectivityManager;
:try_end_12
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_12} :catch_15
.line 71
:cond_12
:goto_12
sget-object v0, Ldxoptimizer/cee;->a:Landroid/net/ConnectivityManager;
return-object v0
.line 65
:catch_15
move-exception v0
goto :goto_12
.end method
.method private static f(Landroid/content/Context;)Z
.registers 4
.prologue
const/4 v0, 0x0
.line 260
invoke-static {p0}, Ldxoptimizer/cee;->e(Landroid/content/Context;)Landroid/net/ConnectivityManager;
move-result-object v2
.line 261
if-nez v2, :cond_8
.line 273
:cond_7
:goto_7
return v0
.line 264
:cond_8
const/4 v1, 0x0
.line 266
:try_start_9
invoke-virtual {v2}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;
:try_end_c
.catch Ljava/lang/Exception; {:try_start_9 .. :try_end_c} :catch_17
move-result-object v1
.line 270
:goto_d
if-eqz v1, :cond_7
.line 271
invoke-virtual {v1}, Landroid/net/NetworkInfo;->getType()I
move-result v1
if-nez v1, :cond_7
const/4 v0, 0x1
goto :goto_7
.line 267
:catch_17
move-exception v2
goto :goto_d
.end method