765 lines
18 KiB
Smali
765 lines
18 KiB
Smali
.class public final Lcom/discord/utilities/io/NetworkUtils;
|
|
.super Ljava/lang/Object;
|
|
.source "NetworkUtils.kt"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/discord/utilities/io/NetworkUtils$NetworkDownloadReceiver;,
|
|
Lcom/discord/utilities/io/NetworkUtils$DownloadManagerNotFound;,
|
|
Lcom/discord/utilities/io/NetworkUtils$DownloadManagerEnqueueFailure;,
|
|
Lcom/discord/utilities/io/NetworkUtils$DownloadManagerFileNoFound;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static final INSTANCE:Lcom/discord/utilities/io/NetworkUtils;
|
|
|
|
.field public static final onDownloadListeners:Ljava/util/Map;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/Long;",
|
|
"Lkotlin/jvm/functions/Function0<",
|
|
"Lkotlin/Unit;",
|
|
">;>;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
new-instance v0, Lcom/discord/utilities/io/NetworkUtils;
|
|
|
|
invoke-direct {v0}, Lcom/discord/utilities/io/NetworkUtils;-><init>()V
|
|
|
|
sput-object v0, Lcom/discord/utilities/io/NetworkUtils;->INSTANCE:Lcom/discord/utilities/io/NetworkUtils;
|
|
|
|
new-instance v0, Ljava/util/LinkedHashMap;
|
|
|
|
invoke-direct {v0}, Ljava/util/LinkedHashMap;-><init>()V
|
|
|
|
sput-object v0, Lcom/discord/utilities/io/NetworkUtils;->onDownloadListeners:Ljava/util/Map;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final synthetic access$getOnDownloadListeners$p(Lcom/discord/utilities/io/NetworkUtils;)Ljava/util/Map;
|
|
.locals 0
|
|
|
|
sget-object p0, Lcom/discord/utilities/io/NetworkUtils;->onDownloadListeners:Ljava/util/Map;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final downloadFile(Landroid/content/Context;Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V
|
|
.locals 7
|
|
.annotation build Landroidx/annotation/RequiresPermission;
|
|
conditional = true
|
|
value = "android.permission.WRITE_EXTERNAL_STORAGE"
|
|
.end annotation
|
|
|
|
.annotation build Landroidx/annotation/UiThread;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Landroid/content/Context;",
|
|
"Landroid/net/Uri;",
|
|
"Ljava/lang/String;",
|
|
"Ljava/lang/String;",
|
|
"Lkotlin/jvm/functions/Function1<",
|
|
"-",
|
|
"Ljava/lang/String;",
|
|
"Lkotlin/Unit;",
|
|
">;",
|
|
"Lkotlin/jvm/functions/Function1<",
|
|
"-",
|
|
"Ljava/lang/Throwable;",
|
|
"Lkotlin/Unit;",
|
|
">;)V"
|
|
}
|
|
.end annotation
|
|
|
|
const-string/jumbo v0, "uri"
|
|
|
|
invoke-static {p1, v0}, Lc0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "onSuccess"
|
|
|
|
invoke-static {p4, v0}, Lc0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "onError"
|
|
|
|
invoke-static {p5, v0}, Lc0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p0, :cond_0
|
|
|
|
const-string v1, "download"
|
|
|
|
invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
move-object p0, v0
|
|
|
|
:goto_0
|
|
instance-of v1, p0, Landroid/app/DownloadManager;
|
|
|
|
if-nez v1, :cond_1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
move-object v0, p0
|
|
|
|
:goto_1
|
|
move-object v4, v0
|
|
|
|
check-cast v4, Landroid/app/DownloadManager;
|
|
|
|
const-wide/16 v0, 0x1
|
|
|
|
if-eqz v4, :cond_4
|
|
|
|
if-eqz p2, :cond_2
|
|
|
|
goto :goto_2
|
|
|
|
:cond_2
|
|
:try_start_0
|
|
invoke-virtual {p1}, Landroid/net/Uri;->getLastPathSegment()Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
:goto_2
|
|
new-instance p0, Landroid/app/DownloadManager$Request;
|
|
|
|
invoke-direct {p0, p1}, Landroid/app/DownloadManager$Request;-><init>(Landroid/net/Uri;)V
|
|
|
|
invoke-virtual {p0, p2}, Landroid/app/DownloadManager$Request;->setTitle(Ljava/lang/CharSequence;)Landroid/app/DownloadManager$Request;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0, p3}, Landroid/app/DownloadManager$Request;->setDescription(Ljava/lang/CharSequence;)Landroid/app/DownloadManager$Request;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 p1, 0x1
|
|
|
|
invoke-virtual {p0, p1}, Landroid/app/DownloadManager$Request;->setNotificationVisibility(I)Landroid/app/DownloadManager$Request;
|
|
|
|
move-result-object p0
|
|
|
|
sget-object p1, Landroid/os/Environment;->DIRECTORY_DOWNLOADS:Ljava/lang/String;
|
|
|
|
if-eqz p2, :cond_3
|
|
|
|
invoke-static {p2}, Lcom/discord/utilities/string/StringUtilsKt;->filenameSanitized(Ljava/lang/CharSequence;)Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
if-eqz p2, :cond_3
|
|
|
|
goto :goto_3
|
|
|
|
:cond_3
|
|
const-string p2, "file"
|
|
|
|
:goto_3
|
|
invoke-virtual {p0, p1, p2}, Landroid/app/DownloadManager$Request;->setDestinationInExternalPublicDir(Ljava/lang/String;Ljava/lang/String;)Landroid/app/DownloadManager$Request;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Landroid/app/DownloadManager$Request;->allowScanningByMediaScanner()V
|
|
|
|
invoke-virtual {v4, p0}, Landroid/app/DownloadManager;->enqueue(Landroid/app/DownloadManager$Request;)J
|
|
|
|
move-result-wide p0
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
move-wide v2, p0
|
|
|
|
goto :goto_4
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
invoke-interface {p5, p0}, Lkotlin/jvm/functions/Function1;->invoke(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
return-void
|
|
|
|
:cond_4
|
|
move-wide v2, v0
|
|
|
|
:goto_4
|
|
cmp-long p0, v2, v0
|
|
|
|
if-nez p0, :cond_5
|
|
|
|
new-instance p0, Lcom/discord/utilities/io/NetworkUtils$DownloadManagerNotFound;
|
|
|
|
invoke-direct {p0}, Lcom/discord/utilities/io/NetworkUtils$DownloadManagerNotFound;-><init>()V
|
|
|
|
invoke-interface {p5, p0}, Lkotlin/jvm/functions/Function1;->invoke(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
goto :goto_5
|
|
|
|
:cond_5
|
|
const-wide/16 p0, 0x0
|
|
|
|
cmp-long p2, v2, p0
|
|
|
|
if-nez p2, :cond_6
|
|
|
|
new-instance p0, Lcom/discord/utilities/io/NetworkUtils$DownloadManagerEnqueueFailure;
|
|
|
|
invoke-direct {p0}, Lcom/discord/utilities/io/NetworkUtils$DownloadManagerEnqueueFailure;-><init>()V
|
|
|
|
invoke-interface {p5, p0}, Lkotlin/jvm/functions/Function1;->invoke(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
goto :goto_5
|
|
|
|
:cond_6
|
|
sget-object p0, Lcom/discord/utilities/io/NetworkUtils;->onDownloadListeners:Ljava/util/Map;
|
|
|
|
invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object p1
|
|
|
|
new-instance p2, Lcom/discord/utilities/io/NetworkUtils$downloadFile$1;
|
|
|
|
move-object v1, p2
|
|
|
|
move-object v5, p4
|
|
|
|
move-object v6, p5
|
|
|
|
invoke-direct/range {v1 .. v6}, Lcom/discord/utilities/io/NetworkUtils$downloadFile$1;-><init>(JLandroid/app/DownloadManager;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V
|
|
|
|
invoke-interface {p0, p1, p2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
:goto_5
|
|
return-void
|
|
.end method
|
|
|
|
.method public static synthetic isDeviceConnected$default(Lcom/discord/utilities/io/NetworkUtils;Landroid/content/Context;Landroid/content/Intent;Lcom/discord/utilities/logging/Logger;ILjava/lang/Object;)Z
|
|
.locals 1
|
|
|
|
and-int/lit8 p5, p4, 0x2
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p5, :cond_0
|
|
|
|
move-object p2, v0
|
|
|
|
:cond_0
|
|
and-int/lit8 p4, p4, 0x4
|
|
|
|
if-eqz p4, :cond_1
|
|
|
|
move-object p3, v0
|
|
|
|
:cond_1
|
|
invoke-virtual {p0, p1, p2, p3}, Lcom/discord/utilities/io/NetworkUtils;->isDeviceConnected(Landroid/content/Context;Landroid/content/Intent;Lcom/discord/utilities/logging/Logger;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final getNetworkType(Landroid/content/Context;)Ljava/lang/Integer;
|
|
.locals 2
|
|
|
|
const-string v0, "context"
|
|
|
|
invoke-static {p1, v0}, Lc0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const/4 v0, 0x0
|
|
|
|
:try_start_0
|
|
const-string v1, "connectivity"
|
|
|
|
invoke-virtual {p1, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
check-cast p1, Landroid/net/ConnectivityManager;
|
|
|
|
invoke-virtual {p1}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
invoke-virtual {p1}, Landroid/net/NetworkInfo;->getType()I
|
|
|
|
move-result p1
|
|
|
|
invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object p1
|
|
|
|
move-object v0, p1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
new-instance p1, Ljava/lang/NullPointerException;
|
|
|
|
const-string v1, "null cannot be cast to non-null type android.net.ConnectivityManager"
|
|
|
|
invoke-direct {p1, v1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
:catch_0
|
|
:cond_1
|
|
:goto_0
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public final isAirplaneModeOn(Landroid/content/Context;)Z
|
|
.locals 2
|
|
|
|
const-string v0, "context"
|
|
|
|
invoke-static {p1, v0}, Lc0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
|
|
|
|
move-result-object p1
|
|
|
|
const-string v0, "airplane_mode_on"
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-static {p1, v0, v1}, Landroid/provider/Settings$Global;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
|
|
|
|
move-result p1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
:cond_0
|
|
return v1
|
|
.end method
|
|
|
|
.method public final isDeviceConnected(Landroid/content/Context;Landroid/content/Intent;Lcom/discord/utilities/logging/Logger;)Z
|
|
.locals 15
|
|
|
|
move-object/from16 v0, p1
|
|
|
|
move-object/from16 v1, p2
|
|
|
|
const-string v2, "context"
|
|
|
|
invoke-static {v0, v2}, Lc0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const/4 v6, 0x1
|
|
|
|
:try_start_0
|
|
const-string v2, "connectivity"
|
|
|
|
invoke-virtual {v0, v2}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_12
|
|
|
|
move-object v7, v0
|
|
|
|
check-cast v7, Landroid/net/ConnectivityManager;
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
const/16 v2, 0x17
|
|
|
|
const-string v8, "connectivityManager.allNetworks"
|
|
|
|
const/4 v9, 0x0
|
|
|
|
const/4 v10, 0x0
|
|
|
|
if-lt v0, v2, :cond_b
|
|
|
|
if-eqz p3, :cond_0
|
|
|
|
:try_start_1
|
|
const-string v1, "[NetworkUtils]"
|
|
|
|
new-instance v0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v2, "Checking for internet on "
|
|
|
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v7}, Landroid/net/ConnectivityManager;->getAllNetworks()[Landroid/net/Network;
|
|
|
|
move-result-object v2
|
|
|
|
array-length v2, v2
|
|
|
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
const-string v2, " networks."
|
|
|
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
const/4 v3, 0x0
|
|
|
|
const/4 v4, 0x4
|
|
|
|
const/4 v5, 0x0
|
|
|
|
move-object/from16 v0, p3
|
|
|
|
invoke-static/range {v0 .. v5}, Lcom/discord/utilities/logging/Logger;->i$default(Lcom/discord/utilities/logging/Logger;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;ILjava/lang/Object;)V
|
|
|
|
:cond_0
|
|
invoke-virtual {v7}, Landroid/net/ConnectivityManager;->getAllNetworks()[Landroid/net/Network;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-static {v11, v8}, Lc0/n/c/j;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
array-length v8, v11
|
|
|
|
const/4 v12, 0x0
|
|
|
|
:goto_0
|
|
if-ge v12, v8, :cond_9
|
|
|
|
aget-object v13, v11, v12
|
|
|
|
invoke-virtual {v7, v13}, Landroid/net/ConnectivityManager;->getNetworkCapabilities(Landroid/net/Network;)Landroid/net/NetworkCapabilities;
|
|
|
|
move-result-object v14
|
|
|
|
if-eqz p3, :cond_1
|
|
|
|
const-string v1, "[NetworkUtils]"
|
|
|
|
new-instance v0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v2, "Capabilities for network "
|
|
|
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
const-string v2, ", are: "
|
|
|
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
const/16 v2, 0x2e
|
|
|
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
const/4 v3, 0x0
|
|
|
|
const/4 v4, 0x4
|
|
|
|
const/4 v5, 0x0
|
|
|
|
move-object/from16 v0, p3
|
|
|
|
invoke-static/range {v0 .. v5}, Lcom/discord/utilities/logging/Logger;->i$default(Lcom/discord/utilities/logging/Logger;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;ILjava/lang/Object;)V
|
|
|
|
:cond_1
|
|
if-eqz v14, :cond_2
|
|
|
|
const/16 v0, 0xc
|
|
|
|
invoke-virtual {v14, v0}, Landroid/net/NetworkCapabilities;->hasCapability(I)Z
|
|
|
|
move-result v0
|
|
|
|
if-eq v0, v6, :cond_6
|
|
|
|
:cond_2
|
|
if-eqz v14, :cond_3
|
|
|
|
invoke-virtual {v14, v6}, Landroid/net/NetworkCapabilities;->hasTransport(I)Z
|
|
|
|
move-result v0
|
|
|
|
if-eq v0, v6, :cond_6
|
|
|
|
:cond_3
|
|
if-eqz v14, :cond_4
|
|
|
|
invoke-virtual {v14, v10}, Landroid/net/NetworkCapabilities;->hasTransport(I)Z
|
|
|
|
move-result v0
|
|
|
|
if-eq v0, v6, :cond_6
|
|
|
|
:cond_4
|
|
if-eqz v14, :cond_5
|
|
|
|
const/4 v0, 0x3
|
|
|
|
invoke-virtual {v14, v0}, Landroid/net/NetworkCapabilities;->hasTransport(I)Z
|
|
|
|
move-result v0
|
|
|
|
if-eq v0, v6, :cond_6
|
|
|
|
:cond_5
|
|
if-eqz v14, :cond_7
|
|
|
|
const/4 v0, 0x4
|
|
|
|
invoke-virtual {v14, v0}, Landroid/net/NetworkCapabilities;->hasTransport(I)Z
|
|
|
|
move-result v0
|
|
|
|
if-ne v0, v6, :cond_7
|
|
|
|
:cond_6
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_7
|
|
const/4 v0, 0x0
|
|
|
|
:goto_1
|
|
if-eqz v0, :cond_8
|
|
|
|
move-object v9, v13
|
|
|
|
goto :goto_2
|
|
|
|
:cond_8
|
|
add-int/lit8 v12, v12, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_9
|
|
:goto_2
|
|
if-eqz v9, :cond_a
|
|
|
|
goto/16 :goto_9
|
|
|
|
:cond_a
|
|
const/4 v6, 0x0
|
|
|
|
goto/16 :goto_9
|
|
|
|
:cond_b
|
|
invoke-virtual {v7}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v1, :cond_c
|
|
|
|
const-string v2, "networkInfo"
|
|
|
|
invoke-virtual {v1, v2}, Landroid/content/Intent;->getParcelableExtra(Ljava/lang/String;)Landroid/os/Parcelable;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Landroid/net/NetworkInfo;
|
|
|
|
goto :goto_3
|
|
|
|
:cond_c
|
|
move-object v1, v9
|
|
|
|
:goto_3
|
|
const/4 v2, 0x2
|
|
|
|
new-array v3, v2, [Landroid/net/NetworkInfo;
|
|
|
|
aput-object v0, v3, v10
|
|
|
|
aput-object v1, v3, v6
|
|
|
|
invoke-virtual {v7}, Landroid/net/ConnectivityManager;->getAllNetworks()[Landroid/net/Network;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0, v8}, Lc0/n/c/j;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
new-instance v1, Ljava/util/ArrayList;
|
|
|
|
array-length v4, v0
|
|
|
|
invoke-direct {v1, v4}, Ljava/util/ArrayList;-><init>(I)V
|
|
|
|
array-length v4, v0
|
|
|
|
const/4 v5, 0x0
|
|
|
|
:goto_4
|
|
if-ge v5, v4, :cond_d
|
|
|
|
aget-object v8, v0, v5
|
|
|
|
invoke-virtual {v7, v8}, Landroid/net/ConnectivityManager;->getNetworkInfo(Landroid/net/Network;)Landroid/net/NetworkInfo;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-interface {v1, v8}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
|
|
|
|
add-int/lit8 v5, v5, 0x1
|
|
|
|
goto :goto_4
|
|
|
|
:cond_d
|
|
const-string v0, "$this$plus"
|
|
|
|
invoke-static {v3, v0}, Lc0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "elements"
|
|
|
|
invoke-static {v1, v0}, Lc0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-interface {v1}, Ljava/util/Collection;->size()I
|
|
|
|
move-result v0
|
|
|
|
add-int/2addr v0, v2
|
|
|
|
invoke-static {v3, v0}, Ljava/util/Arrays;->copyOf([Ljava/lang/Object;I)[Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-interface {v1}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v1
|
|
|
|
:goto_5
|
|
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v3
|
|
|
|
if-eqz v3, :cond_e
|
|
|
|
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v3
|
|
|
|
add-int/lit8 v4, v2, 0x1
|
|
|
|
aput-object v3, v0, v2
|
|
|
|
move v2, v4
|
|
|
|
goto :goto_5
|
|
|
|
:cond_e
|
|
const-string v1, "result"
|
|
|
|
invoke-static {v0, v1}, Lc0/n/c/j;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
array-length v1, v0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
:goto_6
|
|
if-ge v2, v1, :cond_11
|
|
|
|
aget-object v3, v0, v2
|
|
|
|
move-object v4, v3
|
|
|
|
check-cast v4, Landroid/net/NetworkInfo;
|
|
|
|
if-eqz v4, :cond_f
|
|
|
|
invoke-virtual {v4}, Landroid/net/NetworkInfo;->isConnectedOrConnecting()Z
|
|
|
|
move-result v4
|
|
|
|
if-ne v4, v6, :cond_f
|
|
|
|
const/4 v4, 0x1
|
|
|
|
goto :goto_7
|
|
|
|
:cond_f
|
|
const/4 v4, 0x0
|
|
|
|
:goto_7
|
|
if-eqz v4, :cond_10
|
|
|
|
move-object v9, v3
|
|
|
|
goto :goto_8
|
|
|
|
:cond_10
|
|
add-int/lit8 v2, v2, 0x1
|
|
|
|
goto :goto_6
|
|
|
|
:cond_11
|
|
:goto_8
|
|
check-cast v9, Landroid/net/NetworkInfo;
|
|
|
|
if-eqz v9, :cond_a
|
|
|
|
goto :goto_9
|
|
|
|
:cond_12
|
|
new-instance v0, Ljava/lang/NullPointerException;
|
|
|
|
const-string v1, "null cannot be cast to non-null type android.net.ConnectivityManager"
|
|
|
|
invoke-direct {v0, v1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
:try_end_1
|
|
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0
|
|
|
|
:catch_0
|
|
:goto_9
|
|
return v6
|
|
.end method
|