Validate test wifi/eth/bluetooth/mobile networks

While not all test networks created by TestNetworkManager should be
validated (because they can be used in self-contained tests that should
not see unexpected traffic, such as data usage tests), allowing
NetworkMonitor to validate test networks that intend to replicate actual
network management on the device is valuable for proper testing.

This change considers that a network that has both TRANSPORT_TEST and
another major transport type (wifi, ethernet, bluetooth, mobile) is
attempting to replicate actual network management on the device: this is
currently the case with EthernetManager#setIncludeTestInterfaces. In
such cases, have the system perform validation even if the network does
not have CAPABILITY_INTERNET.

Because TRANSPORT_TEST networks do not have CAPABILITY_INTERNET (as
expected from the network agent and enforced by ConnectivityService),
they still cannot become default networks, even if they gain
CAPABILITY_VALIDATED.

Bug: 156319532
Test: atest NetworkStackTests FrameworksNetTests CaptivePortalApiTest
Original-Change: https://android-review.googlesource.com/1317682
Merged-In: Ib5810dc3b589ffddc06507fb8be3066e09063a3c
Change-Id: Ib5810dc3b589ffddc06507fb8be3066e09063a3c
2 files changed