Bug 1540573 - P2. Have GeckoRuntime listen for network link changes when in the foreground. r=snorp
☠☠ backed out by e5ce38e989b8 ☠ ☠
authorChris Pearce <cpearce@mozilla.com>
Wed, 01 May 2019 23:45:53 +0000
changeset 472228 2c4303b175ec5aa10beb766daf0bc8962e13d649
parent 472227 b49cd2b191aef78a47b2eda16d9a6f023c5778b8
child 472229 3496ca48f6e0f4abe6a2d5df947e604a0aeda6d2
push id84530
push usercpearce@mozilla.com
push dateThu, 02 May 2019 01:20:23 +0000
treeherderautoland@599e6e06599d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1540573
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1540573 - P2. Have GeckoRuntime listen for network link changes when in the foreground. r=snorp This allows Gecko to react to network link/status changes events as needed. Differential Revision: https://phabricator.services.mozilla.com/D28942
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java
@@ -26,16 +26,17 @@ import android.os.Process;
 import android.support.annotation.AnyThread;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.support.annotation.UiThread;
 import android.util.Log;
 
 import org.mozilla.gecko.EventDispatcher;
 import org.mozilla.gecko.GeckoAppShell;
+import org.mozilla.gecko.GeckoNetworkManager;
 import org.mozilla.gecko.GeckoScreenOrientation;
 import org.mozilla.gecko.GeckoSystemStateListener;
 import org.mozilla.gecko.GeckoThread;
 import org.mozilla.gecko.PrefsHelper;
 import org.mozilla.gecko.util.BundleEventListener;
 import org.mozilla.gecko.util.DebugConfig;
 import org.mozilla.gecko.util.EventCallback;
 import org.mozilla.gecko.util.GeckoBundle;
@@ -110,21 +111,26 @@ public final class GeckoRuntime implemen
         @OnLifecycleEvent(Lifecycle.Event.ON_START)
         void onStart() {
             Log.d(LOGTAG, "Lifecycle: onStart");
         }
 
         @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
         void onResume() {
             Log.d(LOGTAG, "Lifecycle: onResume");
+            // Monitor network status and send change notifications to Gecko
+            // while active.
+            GeckoNetworkManager.getInstance().start(GeckoAppShell.getApplicationContext());
         }
 
         @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
         void onPause() {
             Log.d(LOGTAG, "Lifecycle: onPause");
+            // Stop monitoring network status while inactive.
+            GeckoNetworkManager.getInstance().stop();
         }
     }
 
     private static GeckoRuntime sDefaultRuntime;
 
     /**
      * Get the default runtime for the given context.
      * This will create and initialize the runtime with the default settings.