Allow server connections over mobile data
isNetworkEnabled() was calling getNetworkInfo(TYPE_WIFI) when onlyWifiAllowed=true, blocking server access on cellular. Now always uses getActiveNetworkInfo() so any active connection is accepted. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f89b3fdb00
commit
8d35af3d82
1 changed files with 15 additions and 34 deletions
|
|
@ -1469,58 +1469,39 @@
|
|||
.end method
|
||||
|
||||
.method public isNetworkEnabled(Z)Z
|
||||
.locals 4
|
||||
.locals 3
|
||||
.param p1, "onlyWifiAllowed" # Z
|
||||
|
||||
.prologue
|
||||
const/4 v2, 0x1
|
||||
|
||||
.line 502
|
||||
const-string v3, "connectivity"
|
||||
const-string v0, "connectivity"
|
||||
|
||||
invoke-virtual {p0, v3}, Lcom/mojang/minecraftpe/MainActivity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
||||
invoke-virtual {p0, v0}, Lcom/mojang/minecraftpe/MainActivity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
check-cast v0, Landroid/net/ConnectivityManager;
|
||||
|
||||
.line 503
|
||||
.local v0, "cm":Landroid/net/ConnectivityManager;
|
||||
if-eqz p1, :cond_0
|
||||
|
||||
invoke-virtual {v0, v2}, Landroid/net/ConnectivityManager;->getNetworkInfo(I)Landroid/net/NetworkInfo;
|
||||
|
||||
move-result-object v1
|
||||
|
||||
.line 506
|
||||
.local v1, "info":Landroid/net/NetworkInfo;
|
||||
:goto_0
|
||||
if-eqz v1, :cond_1
|
||||
|
||||
invoke-virtual {v1}, Landroid/net/NetworkInfo;->isConnected()Z
|
||||
|
||||
move-result v3
|
||||
|
||||
if-eqz v3, :cond_1
|
||||
|
||||
:goto_1
|
||||
return v2
|
||||
|
||||
.line 503
|
||||
.end local v1 # "info":Landroid/net/NetworkInfo;
|
||||
:cond_0
|
||||
# Always check any active network, ignore onlyWifiAllowed
|
||||
invoke-virtual {v0}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;
|
||||
|
||||
move-result-object v1
|
||||
|
||||
goto :goto_0
|
||||
if-eqz v1, :cond_false
|
||||
|
||||
.line 506
|
||||
.restart local v1 # "info":Landroid/net/NetworkInfo;
|
||||
:cond_1
|
||||
invoke-virtual {v1}, Landroid/net/NetworkInfo;->isConnected()Z
|
||||
|
||||
move-result v0
|
||||
|
||||
if-eqz v0, :cond_false
|
||||
|
||||
return v2
|
||||
|
||||
:cond_false
|
||||
const/4 v2, 0x0
|
||||
|
||||
goto :goto_1
|
||||
return v2
|
||||
.end method
|
||||
|
||||
.method native nativeBackPressed()V
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue