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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Chris Pearce 2019-05-06 22:41:10 +00:00
parent 05af110324
commit e62032e491

View File

@ -31,6 +31,7 @@ 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;
@ -115,11 +116,16 @@ public final class GeckoRuntime implements Parcelable {
@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();
}
}