RongNetworkStateChangeReceiver.smali
.class public Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;
.super Landroid/content/BroadcastReceiver;
.source "RongNetworkStateChangeReceiver.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver$RefreshIpReachableTask;
}
.end annotation
# static fields
.field private static final ALLOW_CLEAR_CACHE_TIMEOUT:J = 0x927c0L
.field private static final TAG:Ljava/lang/String; = "RongNetworkStateChangeReceiver"
# instance fields
.field private beforeNetInfo:Ljava/lang/String;
.field private clearCache:Z
.field private clearCacheStartTime:J
.field private httpDnsPrefetch:Z
.field private isFirstNotify:Z
.field private isIPv4Reachable:Z
.field private isIPv6Reachable:Z
# direct methods
.method public constructor <init>()V
.registers 3
.line 1
invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V
const/4 v0, 0x0
.line 2
iput-boolean v0, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->isFirstNotify:Z
const/4 v0, 0x1
.line 3
iput-boolean v0, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->clearCache:Z
.line 4
iput-boolean v0, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->httpDnsPrefetch:Z
const-string v1, ""
.line 5
iput-object v1, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->beforeNetInfo:Ljava/lang/String;
.line 6
iput-boolean v0, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->isIPv6Reachable:Z
.line 7
iput-boolean v0, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->isIPv4Reachable:Z
return-void
.end method
.method static synthetic access$000(Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;)Z
.registers 1
.line 1
iget-boolean p0, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->isIPv4Reachable:Z
return p0
.end method
.method static synthetic access$002(Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;Z)Z
.registers 2
.line 1
iput-boolean p1, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->isIPv4Reachable:Z
return p1
.end method
.method static synthetic access$100(Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;)Z
.registers 1
.line 1
iget-boolean p0, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->isIPv6Reachable:Z
return p0
.end method
.method static synthetic access$102(Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;Z)Z
.registers 2
.line 1
iput-boolean p1, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->isIPv6Reachable:Z
return p1
.end method
.method private allowClearCache(J)Z
.registers 6
.line 1
iget-wide v0, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->clearCacheStartTime:J
sub-long/2addr p1, v0
const-wide/32 v0, 0x927c0
cmp-long v2, p1, v0
if-lez v2, :cond_c
const/4 p1, 0x1
goto :goto_d
:cond_c
const/4 p1, 0x0
:goto_d
return p1
.end method
.method private processCacheOnNetworkChange(Landroid/content/Context;)V
.registers 9
const/4 v0, 0x2
.line 1
new-array v0, v0, [Ljava/lang/Object;
iget-boolean v1, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->clearCache:Z
invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
move-result-object v1
const/4 v2, 0x0
aput-object v1, v0, v2
iget-boolean v1, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->httpDnsPrefetch:Z
invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
move-result-object v1
const/4 v3, 0x1
aput-object v1, v0, v3
const-string v1, "Network change, clearCache(%b) httpDnsPrefetch(%b)"
invoke-static {v1, v0}, Lio/rong/imlib/httpdns/Logger;->printLog(Ljava/lang/String;[Ljava/lang/Object;)V
.line 2
invoke-static {}, Lio/rong/imlib/httpdns/HttpDnsClient;->getInstance()Lio/rong/imlib/httpdns/HttpDnsClient;
move-result-object v0
.line 3
invoke-static {p1}, Lio/rong/imlib/httpdns/RongHttpDns;->getService(Landroid/content/Context;)Lio/rong/imlib/httpdns/RongHttpDns;
move-result-object v1
.line 4
invoke-virtual {p0}, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->refreshIpReachable()V
.line 5
invoke-virtual {v1}, Lio/rong/imlib/httpdns/RongHttpDns;->getHttpDnsCache()Lio/rong/imlib/httpdns/HostCacheManager;
move-result-object v3
invoke-virtual {v3}, Lio/rong/imlib/httpdns/HostCacheManager;->getAllHosts()Ljava/util/ArrayList;
move-result-object v3
.line 6
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v4
.line 7
iget-boolean v6, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->clearCache:Z
if-eqz v6, :cond_48
invoke-direct {p0, v4, v5}, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->allowClearCache(J)Z
move-result v4
if-eqz v4, :cond_48
.line 8
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v4
iput-wide v4, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->clearCacheStartTime:J
.line 9
invoke-virtual {v1}, Lio/rong/imlib/httpdns/RongHttpDns;->getHttpDnsCache()Lio/rong/imlib/httpdns/HostCacheManager;
move-result-object v1
invoke-virtual {v1}, Lio/rong/imlib/httpdns/HostCacheManager;->clearHostCacheMemory()V
.line 10
:cond_48
iget-boolean v1, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->httpDnsPrefetch:Z
if-eqz v1, :cond_6c
.line 11
invoke-virtual {p0}, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->isIPv6Only()Z
move-result v1
if-eqz v1, :cond_5a
.line 12
new-array p1, v2, [Ljava/lang/Object;
const-string v0, "Now the network is Ipv6 Only, Will not send prefetch request. "
invoke-static {v0, p1}, Lio/rong/imlib/httpdns/Logger;->printLog(Ljava/lang/String;[Ljava/lang/Object;)V
return-void
:cond_5a
if-eqz v3, :cond_6c
.line 13
invoke-virtual {v3}, Ljava/util/ArrayList;->isEmpty()Z
move-result v1
if-eqz v1, :cond_63
goto :goto_6c
.line 14
:cond_63
new-instance v1, Lio/rong/imlib/httpdns/HttpDnsCompletion;
invoke-direct {v1, p1}, Lio/rong/imlib/httpdns/HttpDnsCompletion;-><init>(Landroid/content/Context;)V
.line 15
invoke-virtual {v0, v3, v1}, Lio/rong/imlib/httpdns/HttpDnsClient;->splitHostsAndSendRequest(Ljava/util/ArrayList;Lio/rong/imlib/httpdns/HttpDnsClient$AsyncHttpDnsCompletion;)V
nop
:cond_6c
:goto_6c
return-void
.end method
# virtual methods
.method public isIPv6Only()Z
.registers 2
.line 1
iget-boolean v0, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->isIPv4Reachable:Z
if-nez v0, :cond_a
iget-boolean v0, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->isIPv6Reachable:Z
if-eqz v0, :cond_a
const/4 v0, 0x1
goto :goto_b
:cond_a
const/4 v0, 0x0
:goto_b
return v0
.end method
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
.registers 10
const-string p2, ""
.line 1
iget-boolean v0, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->isFirstNotify:Z
const/4 v1, 0x1
if-nez v0, :cond_a
.line 2
iput-boolean v1, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->isFirstNotify:Z
return-void
:cond_a
:try_start_a
const-string v0, "connectivity"
.line 3
invoke-virtual {p1, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/net/ConnectivityManager;
if-nez v0, :cond_18
.line 4
invoke-direct {p0, p1}, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->processCacheOnNetworkChange(Landroid/content/Context;)V
return-void
.line 5
:cond_18
invoke-virtual {v0, v1}, Landroid/net/ConnectivityManager;->getNetworkInfo(I)Landroid/net/NetworkInfo;
move-result-object v2
const/4 v3, 0x0
.line 6
invoke-virtual {v0, v3}, Landroid/net/ConnectivityManager;->getNetworkInfo(I)Landroid/net/NetworkInfo;
move-result-object v0
if-eqz v2, :cond_36
.line 7
invoke-virtual {v2}, Landroid/net/NetworkInfo;->getExtraInfo()Ljava/lang/String;
move-result-object v4
if-eqz v4, :cond_36
invoke-virtual {v2}, Landroid/net/NetworkInfo;->getState()Landroid/net/NetworkInfo$State;
move-result-object v4
sget-object v5, Landroid/net/NetworkInfo$State;->CONNECTED:Landroid/net/NetworkInfo$State;
if-ne v4, v5, :cond_36
.line 8
invoke-virtual {v2}, Landroid/net/NetworkInfo;->getExtraInfo()Ljava/lang/String;
move-result-object v0
goto :goto_4c
:cond_36
if-eqz v0, :cond_4b
.line 9
invoke-virtual {v0}, Landroid/net/NetworkInfo;->getExtraInfo()Ljava/lang/String;
move-result-object v2
if-eqz v2, :cond_4b
invoke-virtual {v0}, Landroid/net/NetworkInfo;->getState()Landroid/net/NetworkInfo$State;
move-result-object v2
sget-object v4, Landroid/net/NetworkInfo$State;->CONNECTED:Landroid/net/NetworkInfo$State;
if-ne v2, v4, :cond_4b
.line 10
invoke-virtual {v0}, Landroid/net/NetworkInfo;->getExtraInfo()Ljava/lang/String;
move-result-object v0
:try_end_4a
.catch Ljava/lang/RuntimeException; {:try_start_a .. :try_end_4a} :catch_6d
goto :goto_4c
:cond_4b
move-object v0, p2
.line 11
:goto_4c
:try_start_4c
iget-object v2, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->beforeNetInfo:Ljava/lang/String;
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v2
if-nez v2, :cond_66
invoke-virtual {v0, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result p2
if-nez p2, :cond_66
const-string p2, "Current net type: %s."
.line 12
new-array v1, v1, [Ljava/lang/Object;
aput-object v0, v1, v3
invoke-static {p2, v1}, Lio/rong/imlib/httpdns/Logger;->printLog(Ljava/lang/String;[Ljava/lang/Object;)V
.line 13
invoke-direct {p0, p1}, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->processCacheOnNetworkChange(Landroid/content/Context;)V
:try_end_66
.catch Ljava/lang/RuntimeException; {:try_start_4c .. :try_end_66} :catch_68
:cond_66
move-object p2, v0
goto :goto_7f
:catch_68
move-exception p2
move-object v6, v0
move-object v0, p2
move-object p2, v6
goto :goto_6e
:catch_6d
move-exception v0
:goto_6e
const-string v1, "RongNetworkStateChangeReceiver"
const-string v2, "onReceive RuntimeException"
.line 14
invoke-static {v1, v2, v0}, Lio/rong/common/rlog/RLog;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
.line 15
:try_start_75
invoke-direct {p0, p1}, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->processCacheOnNetworkChange(Landroid/content/Context;)V
:try_end_78
.catch Ljava/lang/Exception; {:try_start_75 .. :try_end_78} :catch_79
goto :goto_7f
:catch_79
move-exception p1
const-string v0, "processCacheOnNetworkChange Exception"
.line 16
invoke-static {v1, v0, p1}, Lio/rong/common/rlog/RLog;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
.line 17
:goto_7f
iput-object p2, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->beforeNetInfo:Ljava/lang/String;
return-void
.end method
.method public refreshIpReachable()V
.registers 3
.line 1
new-instance v0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver$RefreshIpReachableTask;
invoke-direct {v0, p0}, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver$RefreshIpReachableTask;-><init>(Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;)V
const/4 v1, 0x1
.line 2
invoke-static {v1}, Ljava/util/concurrent/Executors;->newFixedThreadPool(I)Ljava/util/concurrent/ExecutorService;
move-result-object v1
.line 3
invoke-interface {v1, v0}, Ljava/util/concurrent/ExecutorService;->submit(Ljava/util/concurrent/Callable;)Ljava/util/concurrent/Future;
return-void
.end method
.method setClearCache(Z)V
.registers 2
.line 1
iput-boolean p1, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->clearCache:Z
return-void
.end method
.method setHttpDnsPrefetch(Z)V
.registers 2
.line 1
iput-boolean p1, p0, Lio/rong/imlib/httpdns/RongNetworkStateChangeReceiver;->httpDnsPrefetch:Z
return-void
.end method