f.smali
.class public Lyl/f;
.super Ljava/lang/Object;
.source "PingTask.java"
# interfaces
.implements Ljava/lang/Runnable;
# static fields
.field public static final a:Ljava/util/regex/Pattern;
.field public static final b:Ljava/util/regex/Pattern;
.field public static c:Ljava/util/List;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/List<",
"Ljava/lang/String;",
">;"
}
.end annotation
.end field
# direct methods
.method public static constructor <clinit>()V
.registers 1
const-string v0, "(\\d+.\\d+)/(\\d+.\\d+)/(\\d+.\\d+)/(\\d+.\\d+)"
invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
move-result-object v0
sput-object v0, Lyl/f;->a:Ljava/util/regex/Pattern;
const-string v0, "(\\d+) packets transmitted, (\\d+) (?:packets )?received, (\\d+\\.?\\d*)% packet loss"
invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
move-result-object v0
sput-object v0, Lyl/f;->b:Ljava/util/regex/Pattern;
return-void
.end method
.method public constructor <init>()V
.registers 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
# virtual methods
.method public final a()Ljava/util/List;
.registers 5
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/List<",
"Ljava/lang/String;",
">;"
}
.end annotation
sget-object v0, Lyl/f;->c:Ljava/util/List;
if-eqz v0, :cond_5
return-object v0
:cond_5
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
invoke-static {}, Lcom/shopee/shopeetracker/ShopeeTracker;->getInstance()Lcom/shopee/shopeetracker/ShopeeTracker;
move-result-object v1
invoke-virtual {v1}, Lcom/shopee/shopeetracker/ShopeeTracker;->getConfig()Lcom/shopee/shopeetracker/model/Config;
move-result-object v1
if-eqz v1, :cond_41
invoke-static {}, Lcom/shopee/shopeetracker/ShopeeTracker;->getInstance()Lcom/shopee/shopeetracker/ShopeeTracker;
move-result-object v2
invoke-virtual {v2}, Lcom/shopee/shopeetracker/ShopeeTracker;->getTrackingMeta()Lcom/shopee/shopeetracker/bimodel/TrackingMeta;
move-result-object v2
iget-object v2, v2, Lcom/shopee/shopeetracker/bimodel/TrackingMeta;->locale:Ljava/lang/String;
invoke-virtual {v1}, Lcom/shopee/shopeetracker/model/Config;->getPingUrlList()Ljava/util/List;
move-result-object v1
invoke-static {}, Lcom/shopee/shopeetracker/ShopeeTracker;->getInstance()Lcom/shopee/shopeetracker/ShopeeTracker;
move-result-object v3
invoke-virtual {v3}, Lcom/shopee/shopeetracker/ShopeeTracker;->getConfig()Lcom/shopee/shopeetracker/model/Config;
move-result-object v3
invoke-virtual {v3, v2}, Lcom/shopee/shopeetracker/model/Config;->getRegionConfig(Ljava/lang/String;)Lcom/shopee/shopeetracker/model/RegionConfig;
move-result-object v2
const/4 v3, 0x0
if-eqz v2, :cond_35
invoke-virtual {v2}, Lcom/shopee/shopeetracker/model/RegionConfig;->getRegionIcmpUrls()Ljava/util/List;
move-result-object v3
:cond_35
if-eqz v1, :cond_3a
invoke-interface {v0, v1}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z
:cond_3a
if-eqz v3, :cond_3f
invoke-interface {v0, v3}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z
:cond_3f
sput-object v0, Lyl/f;->c:Ljava/util/List;
:cond_41
sget-object v0, Lyl/f;->c:Ljava/util/List;
return-object v0
.end method
.method public final a(Ljava/lang/String;)V
.registers 10
const-string v0, "packet loss"
const/4 v1, 0x0
:try_start_3
invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;
move-result-object v2
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "ping -c 3 -w 10 "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-virtual {v2, v3}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/Process;->waitFor()I
move-result v3
:try_end_20
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_20} :catch_12d
.catch Ljava/lang/InterruptedException; {:try_start_3 .. :try_end_20} :catch_118
.catch Ljava/lang/Exception; {:try_start_3 .. :try_end_20} :catch_103
.catchall {:try_start_3 .. :try_end_20} :catchall_100
const-string v4, "pingtest"
if-eqz v3, :cond_39
:try_start_24
new-instance p1, Ljava/lang/StringBuilder;
invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V
const-string v0, "status code = "
invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-static {v4, p1}, Lcom/shopee/shopeetracker/utils/Logger;->debug(Ljava/lang/String;Ljava/lang/String;)V
return-void
:cond_39
invoke-virtual {v2}, Ljava/lang/Process;->getInputStream()Ljava/io/InputStream;
move-result-object v2
:try_end_3d
.catch Ljava/io/IOException; {:try_start_24 .. :try_end_3d} :catch_12d
.catch Ljava/lang/InterruptedException; {:try_start_24 .. :try_end_3d} :catch_118
.catch Ljava/lang/Exception; {:try_start_24 .. :try_end_3d} :catch_103
.catchall {:try_start_24 .. :try_end_3d} :catchall_100
:try_start_3d
new-instance v3, Ljava/io/BufferedReader;
new-instance v5, Ljava/io/InputStreamReader;
invoke-direct {v5, v2}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V
invoke-direct {v3, v5}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
:try_end_47
.catch Ljava/io/IOException; {:try_start_3d .. :try_end_47} :catch_fc
.catch Ljava/lang/InterruptedException; {:try_start_3d .. :try_end_47} :catch_f8
.catch Ljava/lang/Exception; {:try_start_3d .. :try_end_47} :catch_f4
.catchall {:try_start_3d .. :try_end_47} :catchall_ef
:try_start_47
new-instance v1, Lzl/d;
invoke-direct {v1}, Lzl/d;-><init>()V
iput-object p1, v1, Lzl/d;->a:Ljava/lang/String;
invoke-static {}, Lcom/shopee/shopeetracker/ShopeeTracker;->getInstance()Lcom/shopee/shopeetracker/ShopeeTracker;
move-result-object p1
invoke-virtual {p1}, Lcom/shopee/shopeetracker/ShopeeTracker;->getContext()Landroid/content/Context;
move-result-object p1
invoke-static {p1}, Lcom/shopee/shopeetracker/utils/NetworkUtils;->getNetworkOperator(Landroid/content/Context;)Ljava/lang/String;
move-result-object p1
iput-object p1, v1, Lzl/d;->d:Ljava/lang/String;
:cond_5c
:goto_5c
invoke-virtual {v3}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
move-result-object p1
if-eqz p1, :cond_ce
const-string v5, "rtt"
invoke-virtual {p1, v5}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v5
if-eqz v5, :cond_9a
sget-object v5, Lyl/f;->a:Ljava/util/regex/Pattern;
invoke-virtual {v5, p1}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
move-result-object p1
invoke-virtual {p1}, Ljava/util/regex/Matcher;->find()Z
move-result v5
if-eqz v5, :cond_5c
const/4 v5, 0x2
invoke-virtual {p1, v5}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;
move-result-object v6
invoke-static {v6}, Ljava/lang/Double;->parseDouble(Ljava/lang/String;)D
move-result-wide v6
iput-wide v6, v1, Lzl/d;->b:D
new-instance v6, Ljava/lang/StringBuilder;
invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {p1, v5}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;
move-result-object p1
invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string p1, "latency"
invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-static {v4, p1}, Lcom/shopee/shopeetracker/utils/Logger;->debug(Ljava/lang/String;Ljava/lang/String;)V
goto :goto_5c
:cond_9a
invoke-virtual {p1, v0}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
move-result v5
if-eqz v5, :cond_5c
sget-object v5, Lyl/f;->b:Ljava/util/regex/Pattern;
invoke-virtual {v5, p1}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
move-result-object p1
invoke-virtual {p1}, Ljava/util/regex/Matcher;->find()Z
move-result v5
if-eqz v5, :cond_5c
const/4 v5, 0x3
invoke-virtual {p1, v5}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;
move-result-object v6
invoke-static {v6}, Ljava/lang/Double;->parseDouble(Ljava/lang/String;)D
move-result-wide v6
iput-wide v6, v1, Lzl/d;->c:D
new-instance v6, Ljava/lang/StringBuilder;
invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {p1, v5}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;
move-result-object p1
invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v6, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-static {v4, p1}, Lcom/shopee/shopeetracker/utils/Logger;->debug(Ljava/lang/String;Ljava/lang/String;)V
goto :goto_5c
:cond_ce
invoke-static {}, Lcom/shopee/shopeetracker/TrackerFactory;->getPerformance()Lyl/c;
move-result-object p1
invoke-interface {p1, v1}, Lyl/c;->a(Lzl/b;)V
invoke-virtual {v3}, Ljava/io/BufferedReader;->close()V
:try_end_d8
.catch Ljava/io/IOException; {:try_start_47 .. :try_end_d8} :catch_ed
.catch Ljava/lang/InterruptedException; {:try_start_47 .. :try_end_d8} :catch_eb
.catch Ljava/lang/Exception; {:try_start_47 .. :try_end_d8} :catch_e9
.catchall {:try_start_47 .. :try_end_d8} :catchall_e7
if-eqz v2, :cond_e2
:try_start_da
invoke-virtual {v2}, Ljava/io/InputStream;->close()V
:try_end_dd
.catch Ljava/lang/Exception; {:try_start_da .. :try_end_dd} :catch_de
goto :goto_e2
:catch_de
move-exception p1
invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V
:cond_e2
:goto_e2
:try_start_e2
invoke-virtual {v3}, Ljava/io/BufferedReader;->close()V
:try_end_e5
.catch Ljava/lang/Exception; {:try_start_e2 .. :try_end_e5} :catch_142
goto/16 :goto_146
:catchall_e7
move-exception p1
goto :goto_f1
:catch_e9
move-exception p1
goto :goto_f6
:catch_eb
move-exception p1
goto :goto_fa
:catch_ed
move-exception p1
goto :goto_fe
:catchall_ef
move-exception p1
move-object v3, v1
:goto_f1
move-object v1, v2
goto/16 :goto_148
:catch_f4
move-exception p1
move-object v3, v1
:goto_f6
move-object v1, v2
goto :goto_105
:catch_f8
move-exception p1
move-object v3, v1
:goto_fa
move-object v1, v2
goto :goto_11a
:catch_fc
move-exception p1
move-object v3, v1
:goto_fe
move-object v1, v2
goto :goto_12f
:catchall_100
move-exception p1
move-object v3, v1
goto :goto_148
:catch_103
move-exception p1
move-object v3, v1
:goto_105
:try_start_105
invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V
:try_end_108
.catchall {:try_start_105 .. :try_end_108} :catchall_147
if-eqz v1, :cond_112
:try_start_10a
invoke-virtual {v1}, Ljava/io/InputStream;->close()V
:try_end_10d
.catch Ljava/lang/Exception; {:try_start_10a .. :try_end_10d} :catch_10e
goto :goto_112
:catch_10e
move-exception p1
invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V
:cond_112
:goto_112
if-eqz v3, :cond_146
:try_start_114
invoke-virtual {v3}, Ljava/io/BufferedReader;->close()V
:try_end_117
.catch Ljava/lang/Exception; {:try_start_114 .. :try_end_117} :catch_142
goto :goto_146
:catch_118
move-exception p1
move-object v3, v1
:goto_11a
:try_start_11a
invoke-virtual {p1}, Ljava/lang/InterruptedException;->printStackTrace()V
:try_end_11d
.catchall {:try_start_11a .. :try_end_11d} :catchall_147
if-eqz v1, :cond_127
:try_start_11f
invoke-virtual {v1}, Ljava/io/InputStream;->close()V
:try_end_122
.catch Ljava/lang/Exception; {:try_start_11f .. :try_end_122} :catch_123
goto :goto_127
:catch_123
move-exception p1
invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V
:cond_127
:goto_127
if-eqz v3, :cond_146
:try_start_129
invoke-virtual {v3}, Ljava/io/BufferedReader;->close()V
:try_end_12c
.catch Ljava/lang/Exception; {:try_start_129 .. :try_end_12c} :catch_142
goto :goto_146
:catch_12d
move-exception p1
move-object v3, v1
:goto_12f
:try_start_12f
invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V
:try_end_132
.catchall {:try_start_12f .. :try_end_132} :catchall_147
if-eqz v1, :cond_13c
:try_start_134
invoke-virtual {v1}, Ljava/io/InputStream;->close()V
:try_end_137
.catch Ljava/lang/Exception; {:try_start_134 .. :try_end_137} :catch_138
goto :goto_13c
:catch_138
move-exception p1
invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V
:cond_13c
:goto_13c
if-eqz v3, :cond_146
:try_start_13e
invoke-virtual {v3}, Ljava/io/BufferedReader;->close()V
:try_end_141
.catch Ljava/lang/Exception; {:try_start_13e .. :try_end_141} :catch_142
goto :goto_146
:catch_142
move-exception p1
invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V
:cond_146
:goto_146
return-void
:catchall_147
move-exception p1
:goto_148
if-eqz v1, :cond_152
:try_start_14a
invoke-virtual {v1}, Ljava/io/InputStream;->close()V
:try_end_14d
.catch Ljava/lang/Exception; {:try_start_14a .. :try_end_14d} :catch_14e
goto :goto_152
:catch_14e
move-exception v0
invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V
:cond_152
:goto_152
if-eqz v3, :cond_15c
:try_start_154
invoke-virtual {v3}, Ljava/io/BufferedReader;->close()V
:try_end_157
.catch Ljava/lang/Exception; {:try_start_154 .. :try_end_157} :catch_158
goto :goto_15c
:catch_158
move-exception v0
invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V
:cond_15c
:goto_15c
goto :goto_15e
:goto_15d
throw p1
:goto_15e
goto :goto_15d
.end method
.method public run()V
.registers 8
const-string v0, "PingTask"
:try_start_2
invoke-static {}, Lcom/shopee/shopeetracker/ShopeeTracker;->isInitialized()Z
move-result v1
if-eqz v1, :cond_7a
invoke-static {}, Lcom/shopee/shopeetracker/ShopeeTracker;->getInstance()Lcom/shopee/shopeetracker/ShopeeTracker;
move-result-object v1
invoke-virtual {v1}, Lcom/shopee/shopeetracker/ShopeeTracker;->getConfig()Lcom/shopee/shopeetracker/model/Config;
move-result-object v1
if-nez v1, :cond_13
goto :goto_7a
:cond_13
invoke-static {}, Lcom/shopee/shopeetracker/ShopeeTracker;->getInstance()Lcom/shopee/shopeetracker/ShopeeTracker;
move-result-object v1
invoke-virtual {v1}, Lcom/shopee/shopeetracker/ShopeeTracker;->getContext()Landroid/content/Context;
move-result-object v1
invoke-static {v1}, Lbm/b;->a(Landroid/content/Context;)Z
move-result v1
if-eqz v1, :cond_22
return-void
:cond_22
invoke-static {}, Lcom/shopee/shopeetracker/ShopeeTracker;->getInstance()Lcom/shopee/shopeetracker/ShopeeTracker;
move-result-object v1
invoke-virtual {v1}, Lcom/shopee/shopeetracker/ShopeeTracker;->getTrackingMeta()Lcom/shopee/shopeetracker/bimodel/TrackingMeta;
move-result-object v1
iget-object v1, v1, Lcom/shopee/shopeetracker/bimodel/TrackingMeta;->locale:Ljava/lang/String;
invoke-static {}, Lcom/shopee/shopeetracker/ShopeeTracker;->getInstance()Lcom/shopee/shopeetracker/ShopeeTracker;
move-result-object v2
invoke-virtual {v2}, Lcom/shopee/shopeetracker/ShopeeTracker;->getConfig()Lcom/shopee/shopeetracker/model/Config;
move-result-object v2
invoke-virtual {v2, v1}, Lcom/shopee/shopeetracker/model/Config;->getRegionConfig(Ljava/lang/String;)Lcom/shopee/shopeetracker/model/RegionConfig;
move-result-object v1
if-nez v1, :cond_3b
return-void
:cond_3b
invoke-virtual {v1}, Lcom/shopee/shopeetracker/model/RegionConfig;->getRegionIcmpSamplingRate()D
move-result-wide v1
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "sampling rate = "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3, v1, v2}, Ljava/lang/StringBuilder;->append(D)Ljava/lang/StringBuilder;
const-string v4, "%"
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v0, v3}, Lcom/shopee/shopeetracker/utils/Logger;->debug(Ljava/lang/String;Ljava/lang/String;)V
invoke-static {}, Ljava/lang/Math;->random()D
move-result-wide v3
const-wide/high16 v5, 0x4059000000000000L # 100.0
div-double/2addr v1, v5
cmpg-double v5, v3, v1
if-gez v5, :cond_83
invoke-virtual {p0}, Lyl/f;->a()Ljava/util/List;
move-result-object v1
const/4 v2, 0x0
:goto_68
invoke-interface {v1}, Ljava/util/List;->size()I
move-result v3
if-ge v2, v3, :cond_83
invoke-interface {v1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v3
check-cast v3, Ljava/lang/String;
invoke-virtual {p0, v3}, Lyl/f;->a(Ljava/lang/String;)V
:try_end_77
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_77} :catch_7b
add-int/lit8 v2, v2, 0x1
goto :goto_68
:cond_7a
:goto_7a
return-void
:catch_7b
move-exception v1
invoke-virtual {v1}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;
move-result-object v1
invoke-static {v0, v1}, Lcom/shopee/shopeetracker/utils/Logger;->debug(Ljava/lang/String;Ljava/lang/String;)V
:cond_83
return-void
.end method