Make CALLBACK_PRECHECK actually work.

Currently, CALLBACK_PRECHECK is never fired, because we attempt
to send it just after a network has connected, before matching
requests to that network. So notifyNetworkCallbacks scans the
list of requests for the network, finds none, and does nothing.

Bug: 20038463
Change-Id: Ib0c6377c45990e358f926217d7c7defa74c1d59b
This commit is contained in:
Lorenzo Colitti
2015-04-09 14:35:26 +09:00
parent 3153bb0792
commit 97399aed2e

View File

@@ -4237,9 +4237,10 @@ public class ConnectivityService extends IConnectivityManager.Stub
networkAgent.created = true;
updateLinkProperties(networkAgent, null);
notifyIfacesChanged();
notifyNetworkCallbacks(networkAgent, ConnectivityManager.CALLBACK_PRECHECK);
networkAgent.networkMonitor.sendMessage(NetworkMonitor.CMD_NETWORK_CONNECTED);
scheduleUnvalidatedPrompt(networkAgent);
if (networkAgent.isVPN()) {
// Temporarily disable the default proxy (not global).
synchronized (mProxyLock) {
@@ -4252,9 +4253,13 @@ public class ConnectivityService extends IConnectivityManager.Stub
}
// TODO: support proxy per network.
}
// Consider network even though it is not yet validated.
rematchNetworkAndRequests(networkAgent, NascentState.NOT_JUST_VALIDATED,
ReapUnvalidatedNetworks.REAP);
// This has to happen after matching the requests, because callbacks are just requests.
notifyNetworkCallbacks(networkAgent, ConnectivityManager.CALLBACK_PRECHECK);
} else if (state == NetworkInfo.State.DISCONNECTED ||
state == NetworkInfo.State.SUSPENDED) {
networkAgent.asyncChannel.disconnect();