summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2014-08-13 23:23:04 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-13 23:16:37 +0000
commit57e383b1cc72aea93b0041d69afa31a02597338a (patch)
treebfcbc07d1ec7b5042b4e621cc4f14034886d0d8f /services
parenteb0cefa965fbc37d45a0f7e91be5bab53e0e22a7 (diff)
parentfb68f8fbe0213841f393f8bdb5313e4e44f4f116 (diff)
downloadframeworks_base-57e383b1cc72aea93b0041d69afa31a02597338a.zip
frameworks_base-57e383b1cc72aea93b0041d69afa31a02597338a.tar.gz
frameworks_base-57e383b1cc72aea93b0041d69afa31a02597338a.tar.bz2
Merge "Don't send NetworkMonitor bcast until systemReady" into lmp-dev
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/ConnectivityService.java16
-rw-r--r--services/core/java/com/android/server/connectivity/NetworkMonitor.java4
2 files changed, 20 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index b229c4f3..dd5a7ea 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -372,6 +372,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
*/
private static final int EVENT_EXPIRE_NET_TRANSITION_WAKELOCK = 24;
+ /**
+ * Used internally to indicate the system is ready.
+ */
+ private static final int EVENT_SYSTEM_READY = 25;
+
/** Handler used for internal events. */
final private InternalHandler mHandler;
@@ -1437,6 +1442,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
final IntentFilter filter = new IntentFilter(Intent.ACTION_USER_PRESENT);
mContext.registerReceiver(mUserPresentReceiver, filter);
}
+
+ mHandler.sendMessage(mHandler.obtainMessage(EVENT_SYSTEM_READY));
}
private BroadcastReceiver mUserPresentReceiver = new BroadcastReceiver() {
@@ -2270,6 +2277,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
handleReleaseNetworkRequest((NetworkRequest) msg.obj, msg.arg1);
break;
}
+ case EVENT_SYSTEM_READY: {
+ for (NetworkAgentInfo nai : mNetworkAgentInfos.values()) {
+ nai.networkMonitor.systemReady = true;
+ }
+ break;
+ }
}
}
}
@@ -4108,6 +4121,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
new NetworkInfo(networkInfo), new LinkProperties(linkProperties),
new NetworkCapabilities(networkCapabilities), currentScore, mContext, mTrackerHandler,
networkMisc);
+ synchronized (this) {
+ nai.networkMonitor.systemReady = mSystemReady;
+ }
if (VDBG) log("registerNetworkAgent " + nai);
mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_AGENT, nai));
}
diff --git a/services/core/java/com/android/server/connectivity/NetworkMonitor.java b/services/core/java/com/android/server/connectivity/NetworkMonitor.java
index ae5eda3..5057994 100644
--- a/services/core/java/com/android/server/connectivity/NetworkMonitor.java
+++ b/services/core/java/com/android/server/connectivity/NetworkMonitor.java
@@ -217,6 +217,8 @@ public class NetworkMonitor extends StateMachine {
private String mServer;
private boolean mIsCaptivePortalCheckEnabled = false;
+ public boolean systemReady = false;
+
private State mDefaultState = new DefaultState();
private State mOfflineState = new OfflineState();
private State mValidatedState = new ValidatedState();
@@ -709,6 +711,8 @@ public class NetworkMonitor extends StateMachine {
return;
}
+ if (systemReady == false) return;
+
Intent latencyBroadcast = new Intent(ACTION_NETWORK_CONDITIONS_MEASURED);
switch (mNetworkAgentInfo.networkInfo.getType()) {
case ConnectivityManager.TYPE_WIFI: