Fix missing onLost NetworkCallbacks when network loses capability
If a network no longer satisfies a NetworkRequest, send the onLost NetworkCallback. If it was a real request (not listen) then update the NetworkFactories. To test this change I created a little infrastructure to fake different Internet connectivity probe results during tests. This allowed me to rewrite some of ConnectivityServiceTest's logic for validating networks. This brought to light a couple issues that I had to address to keep tests passing: 1. testUnlingeringDoesNotValidate was relying on a bad side-effect of my old method of ConnectivityServiceTest's logic for validating networks, so I rewrote the test. 2. ConnectivityService was not sending out NetworkCallbacks for WiFi when Cellular was validated. I'm including a fix for this in this CL also. Bug:22220234 Change-Id: I29314f38189817f8b2561a213c4f9e8522696663
This commit is contained in:
@@ -626,6 +626,7 @@ public final class NetworkCapabilities implements Parcelable {
|
||||
case NET_CAPABILITY_TRUSTED: capabilities += "TRUSTED"; break;
|
||||
case NET_CAPABILITY_NOT_VPN: capabilities += "NOT_VPN"; break;
|
||||
case NET_CAPABILITY_VALIDATED: capabilities += "VALIDATED"; break;
|
||||
case NET_CAPABILITY_CAPTIVE_PORTAL: capabilities += "CAPTIVE_PORTAL"; break;
|
||||
}
|
||||
if (++i < types.length) capabilities += "&";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user