diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2014-08-13 13:43:32 -0700 |
---|---|---|
committer | Robert Greenwalt <rgreenwalt@google.com> | 2014-08-13 13:43:32 -0700 |
commit | fb68f8fbe0213841f393f8bdb5313e4e44f4f116 (patch) | |
tree | d4f30ea57fd1cd5f1755c8b59c5c5e9e2a3749ae /services | |
parent | 8e083ec0444e52cb203228bcf1c1cd34bcc4e70d (diff) | |
download | frameworks_base-fb68f8fbe0213841f393f8bdb5313e4e44f4f116.zip frameworks_base-fb68f8fbe0213841f393f8bdb5313e4e44f4f116.tar.gz frameworks_base-fb68f8fbe0213841f393f8bdb5313e4e44f4f116.tar.bz2 |
Don't send NetworkMonitor bcast until systemReady
bug:16913951
Change-Id: I26c5c3353c2d8821452f81765875958d5b9d385b
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/ConnectivityService.java | 16 | ||||
-rw-r--r-- | services/core/java/com/android/server/connectivity/NetworkMonitor.java | 4 |
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: |