Merge "Don't bother validating networks that don't satisfy the default request." into lmp-mr1-dev

This commit is contained in:
Paul Jensen
2014-11-24 18:30:34 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 3 deletions

View File

@@ -3541,6 +3541,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
private final HashMap<Messenger, NetworkAgentInfo> mNetworkAgentInfos = private final HashMap<Messenger, NetworkAgentInfo> mNetworkAgentInfos =
new HashMap<Messenger, NetworkAgentInfo>(); new HashMap<Messenger, NetworkAgentInfo>();
// Note: if mDefaultRequest is changed, NetworkMonitor needs to be updated.
private final NetworkRequest mDefaultRequest; private final NetworkRequest mDefaultRequest;
private boolean isDefaultNetwork(NetworkAgentInfo nai) { private boolean isDefaultNetwork(NetworkAgentInfo nai) {
@@ -3552,10 +3553,12 @@ public class ConnectivityService extends IConnectivityManager.Stub
int currentScore, NetworkMisc networkMisc) { int currentScore, NetworkMisc networkMisc) {
enforceConnectivityInternalPermission(); enforceConnectivityInternalPermission();
// TODO: Instead of passing mDefaultRequest, provide an API to determine whether a Network
// satisfies mDefaultRequest.
NetworkAgentInfo nai = new NetworkAgentInfo(messenger, new AsyncChannel(), NetworkAgentInfo nai = new NetworkAgentInfo(messenger, new AsyncChannel(),
new NetworkInfo(networkInfo), new LinkProperties(linkProperties), new NetworkInfo(networkInfo), new LinkProperties(linkProperties),
new NetworkCapabilities(networkCapabilities), currentScore, mContext, mTrackerHandler, new NetworkCapabilities(networkCapabilities), currentScore, mContext, mTrackerHandler,
new NetworkMisc(networkMisc)); new NetworkMisc(networkMisc), mDefaultRequest);
synchronized (this) { synchronized (this) {
nai.networkMonitor.systemReady = mSystemReady; nai.networkMonitor.systemReady = mSystemReady;
} }

View File

@@ -68,7 +68,7 @@ public class NetworkAgentInfo {
public NetworkAgentInfo(Messenger messenger, AsyncChannel ac, NetworkInfo info, public NetworkAgentInfo(Messenger messenger, AsyncChannel ac, NetworkInfo info,
LinkProperties lp, NetworkCapabilities nc, int score, Context context, Handler handler, LinkProperties lp, NetworkCapabilities nc, int score, Context context, Handler handler,
NetworkMisc misc) { NetworkMisc misc, NetworkRequest defaultRequest) {
this.messenger = messenger; this.messenger = messenger;
asyncChannel = ac; asyncChannel = ac;
network = null; network = null;
@@ -76,7 +76,7 @@ public class NetworkAgentInfo {
linkProperties = lp; linkProperties = lp;
networkCapabilities = nc; networkCapabilities = nc;
currentScore = score; currentScore = score;
networkMonitor = new NetworkMonitor(context, handler, this); networkMonitor = new NetworkMonitor(context, handler, this, defaultRequest);
networkMisc = misc; networkMisc = misc;
created = false; created = false;
validated = false; validated = false;