Index: net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java |
diff --git a/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java b/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java |
index 981e3dc5f7aa6ce57d3d75331b802f08bbe063f9..6fa7f4f952453e0380e1c3961b62a5d1c7373afc 100644 |
--- a/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java |
+++ b/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java |
@@ -14,7 +14,8 @@ import android.net.wifi.WifiManager; |
import android.telephony.TelephonyManager; |
import android.util.Log; |
-import org.chromium.base.ActivityStatus; |
+import org.chromium.base.ApplicationState; |
+import org.chromium.base.ApplicationStatus; |
/** |
* Used by the NetworkChangeNotifier to listens to platform changes in connectivity. |
@@ -22,7 +23,7 @@ import org.chromium.base.ActivityStatus; |
* ACCESS_NETWORK_STATE permission. |
*/ |
public class NetworkChangeNotifierAutoDetect extends BroadcastReceiver |
- implements ActivityStatus.StateListener { |
+ implements ApplicationStatus.ApplicationStateListener { |
/** Queries the ConnectivityManager for information about the current connection. */ |
static class ConnectivityManagerDelegate { |
@@ -107,7 +108,7 @@ public class NetworkChangeNotifierAutoDetect extends BroadcastReceiver |
mWifiManagerDelegate = new WifiManagerDelegate(context); |
mConnectionType = getCurrentConnectionType(); |
mWifiSSID = getCurrentWifiSSID(); |
- ActivityStatus.registerStateListener(this); |
+ ApplicationStatus.registerApplicationStateListener(this); |
} |
/** |
@@ -203,19 +204,13 @@ public class NetworkChangeNotifierAutoDetect extends BroadcastReceiver |
connectionTypeChanged(); |
} |
- // ActivityStatus.StateListener |
+ // ApplicationStatus.ApplicationStateListener |
@Override |
- public void onActivityStateChange(int state) { |
- if (state == ActivityStatus.RESUMED) { |
- // Note that this also covers the case where the main activity is created. The CREATED |
- // event is always followed by the RESUMED event. This is a temporary "hack" until |
- // http://crbug.com/176837 is fixed. The CREATED event can't be used reliably for now |
- // since its notification is deferred. This means that it can immediately follow a |
- // DESTROYED/STOPPED/... event which is problematic. |
- // TODO(pliard): fix http://crbug.com/176837. |
+ public void onApplicationStateChange(int newState) { |
+ if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { |
connectionTypeChanged(); |
registerReceiver(); |
- } else if (state == ActivityStatus.PAUSED) { |
+ } else if (newState == ApplicationState.HAS_PAUSED_ACTIVITIES) { |
unregisterReceiver(); |
} |
} |