[Android] Revert "Init network status at monitor registration"

Geoffrey Métais git at videolan.org
Wed Sep 20 14:22:55 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Sep 20 14:15:42 2017 +0200| [7db209ca75e48452aafa2c828c65b6d2ca6ab73a] | committer: Geoffrey Métais

Revert "Init network status at monitor registration"

This reverts commit 19d1e2ca37c31ae32b42ed5e126f4bfb049c7167.

> https://code.videolan.org/videolan/vlc-android/commit/7db209ca75e48452aafa2c828c65b6d2ca6ab73a
---

 vlc-android/src/org/videolan/vlc/ExternalMonitor.java | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
index 79872293e..3b28795c5 100644
--- a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
+++ b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
@@ -51,8 +51,8 @@ import java.util.List;
 
 public class ExternalMonitor extends BroadcastReceiver {
     public final static String TAG = "VLC/ExternalMonitor";
-    private static volatile boolean connected = false;
-    private static volatile boolean mobile = false;
+    private static volatile boolean connected = true;
+    private static volatile boolean mobile = true;
     private static volatile boolean vpn = false;
     private static final ExternalMonitor instance = new ExternalMonitor();
     private static final List<NetworkObserver> networkObservers = new LinkedList<>();
@@ -70,21 +70,6 @@ public class ExternalMonitor extends BroadcastReceiver {
         filter.addAction(Intent.ACTION_MEDIA_EJECT);
         filter.addDataScheme("file");
         ctx.registerReceiver(instance, filter);
-        instance.init();
-    }
-
-    private void init() {
-        if (cm == null)
-            cm = (ConnectivityManager) VLCApplication.getAppContext().getSystemService(
-                    Context.CONNECTIVITY_SERVICE);
-        if (cm == null)
-            return;
-        final NetworkInfo networkInfo = cm.getActiveNetworkInfo();
-        if (networkInfo == null)
-            return;
-        connected = networkInfo.isConnected();
-        mobile = networkInfo.getType() == ConnectivityManager.TYPE_MOBILE;
-        vpn = updateVPNStatus();
     }
 
     static void unregister(Context ctx) {



More information about the Android mailing list