Merge "Fix a bug where a spurious capabilities callback is sent."
This commit is contained in:
@@ -7123,6 +7123,14 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
networkAgent.networkCapabilities.addCapability(NET_CAPABILITY_FOREGROUND);
|
networkAgent.networkCapabilities.addCapability(NET_CAPABILITY_FOREGROUND);
|
||||||
|
|
||||||
if (!createNativeNetwork(networkAgent)) return;
|
if (!createNativeNetwork(networkAgent)) return;
|
||||||
|
if (networkAgent.isVPN()) {
|
||||||
|
// Initialize the VPN capabilities to their starting values according to the
|
||||||
|
// underlying networks. This will avoid a spurious callback to
|
||||||
|
// onCapabilitiesUpdated being sent in updateAllVpnCapabilities below as
|
||||||
|
// the VPN would switch from its default, blank capabilities to those
|
||||||
|
// that reflect the capabilities of its underlying networks.
|
||||||
|
updateAllVpnsCapabilities();
|
||||||
|
}
|
||||||
networkAgent.created = true;
|
networkAgent.created = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5394,8 +5394,6 @@ public class ConnectivityServiceTest {
|
|||||||
|
|
||||||
// Even though the VPN is unvalidated, it becomes the default network for our app.
|
// Even though the VPN is unvalidated, it becomes the default network for our app.
|
||||||
callback.expectAvailableCallbacksUnvalidated(vpnNetworkAgent);
|
callback.expectAvailableCallbacksUnvalidated(vpnNetworkAgent);
|
||||||
// TODO: this looks like a spurious callback.
|
|
||||||
callback.expectCallback(CallbackEntry.NETWORK_CAPS_UPDATED, vpnNetworkAgent);
|
|
||||||
callback.assertNoCallback();
|
callback.assertNoCallback();
|
||||||
|
|
||||||
assertTrue(vpnNetworkAgent.getScore() > mEthernetNetworkAgent.getScore());
|
assertTrue(vpnNetworkAgent.getScore() > mEthernetNetworkAgent.getScore());
|
||||||
|
|||||||
Reference in New Issue
Block a user