aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android/org
diff options
context:
space:
mode:
authorAlexander Tkachev2016-07-19 18:43:00 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commita13e03e988f85a67366f2ffe39bae67576e425bc (patch)
tree5c41114e9bc54ca203877c76d48bb245d1b653c0 /backends/platform/android/org
parent0c1c274abdbdb4183d9a08669082227aa912b1ea (diff)
downloadscummvm-rg350-a13e03e988f85a67366f2ffe39bae67576e425bc.tar.gz
scummvm-rg350-a13e03e988f85a67366f2ffe39bae67576e425bc.tar.bz2
scummvm-rg350-a13e03e988f85a67366f2ffe39bae67576e425bc.zip
CLOUD: Add Networking::Connection::isLimited()
`false` everywhere by default, but works on Android (`true` if not Wi-Fi).
Diffstat (limited to 'backends/platform/android/org')
-rw-r--r--backends/platform/android/org/scummvm/scummvm/ScummVM.java1
-rw-r--r--backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java12
2 files changed, 13 insertions, 0 deletions
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVM.java b/backends/platform/android/org/scummvm/scummvm/ScummVM.java
index 50642805a4..47dcb32b22 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVM.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVM.java
@@ -54,6 +54,7 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
abstract protected void getDPI(float[] values);
abstract protected void displayMessageOnOSD(String msg);
abstract protected void openUrl(String url);
+ abstract protected boolean isConnectionLimited();
abstract protected void setWindowCaption(String caption);
abstract protected void showVirtualKeyboard(boolean enable);
abstract protected String[] getSysArchives();
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index 2f3701a557..225496ca0d 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -2,10 +2,13 @@ package org.scummvm.scummvm;
import android.app.Activity;
import android.app.AlertDialog;
+import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.media.AudioManager;
import android.net.Uri;
+import android.net.wifi.WifiManager;
+import android.net.wifi.WifiInfo;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
@@ -80,6 +83,15 @@ public class ScummVMActivity extends Activity {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
+ @Override
+ protected boolean isConnectionLimited() {
+ WifiManager wifiMgr = (WifiManager)getSystemService(Context.WIFI_SERVICE);
+ if (wifiMgr != null && wifiMgr.isWifiEnabled()) {
+ WifiInfo wifiInfo = wifiMgr.getConnectionInfo();
+ return (wifiInfo == null || wifiInfo.getNetworkId() == -1); //WiFi is on, but it's not connected to any network
+ }
+ return true;
+ }
@Override
protected void setWindowCaption(final String caption) {