Add SocketKeepalive.start with parameter to enable dynamic
keepalive mode based on the existence of TCP connections.
This supports IPSec mode to notify KeepaliveTracker to disable
keepalive when keepalive is unnecessary to improve battery life.
Keepalive is controlled by periodically TCP socket status check
for both enable and disable. This is a transition commit and
is expected to be updated based on the socket creation or
destroy.
Bug: 259000745
Test: m ; atest FrameworksNetTests
Change-Id: Ie4d598d69a73c4931c7d0b6dfde0e459e5dca6b4
Create a new API - setVpnNetworkPreference() for the caller to
set VPN as the preference network.
VPN will be disconnected when its underlying network is gone.
To prevent packets going through an underlying network when the
underlying network is back but VPN is not connected yet, set VPN
as the only preferred network for specific apps.
Bug: 231749077
Test: 1. atest FrameworksNetTests
2. Create a test app to register default network and check if
the VPN is the only default network for the test app.
Change-Id: Iabcd38e2fec2aefedbf78d20e338f222d83a9e7f
Add VpnTransportInfo.areLongLivedTcpConnectionsExpensive() in API
surface to allow privileged apps to know whether the long-lived
TCP connections should be expensive in the VPN network.
This is expected to be used combined with getBypassable()
because connections should always go through a VPN that is not
bypassable.
Bug: 259000745
Test: atest FrameworksNetTests
Change-Id: Ic9bcdf43f252f22d12a1136902cc8bbf9cc731f5
Some callers (e.g. iwlan) need to learn about system default
network but they cannot have NETWORK_SETTINGS permission.
To allow them to use this API but prevent from misuse by
unprivileged apps, enforce USE_RESTRICTED_NETWORKS for this API.
Test: atest com.android.server.ConnectivityServiceTest#testRegisterPrivilegedDefaultCallbacksRequireNetworkSettings android.net.cts.ConnectivityManagerTest#testRegisterNetworkCallback
Fix: 242456635
Change-Id: I80ab27445af874328c9c0f4814a8fbf035ae5df4
Expose API to use QoSCallback for UDP socket.
- Constructor of QosSocketInfo with DatagramSocket
- matchesProtocol(int protocol) in QosFilter
- Constructor of SocketNotConnectedException &
SocketRemoteAddressChangedException
Add CTS test cases for exposed API.
Bug: 233292861
Test: atest CtsNetTestCases
Change-Id: I52ff881b71b31c0f97c08200cd811205c25fcb44
Revert submission 1387135-st02
Reason for revert: Usage of TYPE_CNAME in a library shared among
modules does not interact well with current module release process
Reverted Changes:
Ib5616c65c:[ST02.2] Use the getters of DnsHeader
I5e58f99b0:[ST02.1] Add TYPE_CNAME constant to DnsResolver
I0c1547cbc:[ST02] Add methods for synthesizing DNS packets
Change-Id: I5aa9f28f1268f966f62041193ceb7c8bef994579
This would be needed for subsequent patches that synthesizing DNS
packets for testing purpose.
Bug: 139774492
Test: atest DnsPacketTest DnsResolverTest
Change-Id: I5e58f99b09b693f167178e56f008be8b42d9417a
* changes:
TestNetworkInterface: add support for MacAddress and MTU
TestNetworkService: add support for creating iface without carrier
TestNetworkService: Add support for toggling carrier on tun/tap
TestNetworkService: Fix TestNetworkInterface parcel flags
Both MacAddress and MTU size are often needed in tests and very painful
to get a hold of without system server permissions.
Test: TH
Change-Id: Ie1a91959916ea39277e76aa1b61f38d59a5d2a90
This change allows tests to mock NetworkAgent, and the methods
required for ensuring that the VPN is migrating properly.
Bug: 235853154
Test: Treehugger
Change-Id: I49333c010cc7f3d60ffd39f853777bfc52de3a89
This change allows tests to mock NetworkAgent, and the methods
required for ensuring that the VPN is migrating properly.
Bug: 235853154
Test: Treehugger
Change-Id: If4de0935a3c8627ca12db52ff223834f9f7237e8
As requested by API council.
Also fix lint errors in the test.
Fix: 217366078
Test: existing tests modified in this CL
Change-Id: I8f7cd0e78bf29aeb52ec6a08a5d635d25fa2205d
setUnderlyingNetworks() is mainly for the NetworkAgents who hold
the NETWORK_FACTORY to set its underlying networks.
And the underlying networks are only visible and useful for the
caller of getNetworkCapabilities() or the receiver of
onCapabilitiesChanged() who hold one of NETWORK_FACTORY,
NETWORK_SETTINGS and MAINLINE_NETWORK_STACK permissions.
Otherwise, the underlying networks field will be cleard before
sending.
Bug: 205738644
Test: atest CtsNetTestCases:ConnectivityManagerTest
atest CtsHostsideNetworkTests:HostsideVpnTests
atest FrameworksNetTests
Change-Id: Ife7630d9676a31ee5ab977cb1b87aec3b6fd7080
Use int array for included and excluded uids so that uses
same data type as in PreferentialNetworkServiceConfig
Bug: 217365439
Test: ran connectivity service unit tests
Change-Id: I9ac7e6498df2fd20b8397b2c110296e019c7389e
This is useful for link layers that disconnect but know they will
reconnect to a similar network soon, and do not want the device
to switch to another network until the reconnect happens. An
example is wifi switching to another network that is on a
different subnet without the device switching to cellular data.
This works by immediately destroying the network, so the link
layer can reuse the same interface name for the new network. It
would be possible to delay destroying the network until the new
network connects, but in practice this does not seem useful,
because the if the link layer reuses the interface, then the
interface will be undergoing reconfiguration, and will likely
not be usable for app traffic.
This CL also moves the call to onNetworkDestroyed into
destroyNativeNetwork. This is needed to ensure that the new
API calls onNetworkDestroyed even though most teardown
operations have not happened. This causes onNetworkDestroyed to
happen before the netId is marked free, but that shouldn't cause
any behavioural changes because netId allocation is an
implementation detail of ConnectivityService and is not
observable by apps or system components.
Bug: 216567577
Test: builds, boots
Test: atest FrameworksNetTests FrameworksNetIntegrationTests
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Test: atest CtsNetTestCases:android.net.cts.NetworkAgentTest#testDestroyAndAwaitReplacement
Change-Id: I9f9e022fef66b31a29cce560413321075e992756
Split the updateXXX methods into an addXXX and removeXXX instead of using
a boolean parameter to indicate whether the uid should be added or removed
Bug: 218494748
Test: atest FrameworksNetTests
Change-Id: I868cf35c8f51b25d8719e618c6c48a5cd642da7f
swapActiveStatsMap is temporary added for the NetworkStatsFactory to
call BpfNetMaps#swapActiveStatsMap in tethering mainline module. Now
NetworkStatsFactory already be mainlined, calling BpfNetMaps#swapActiveStatsMap
directly.
Bug: 218494448
Test: atest ConnectivityCoverageTests
atest FrameworksNetTests
Change-Id: I3358e4ac5fb7ed0964273afdbccd1b4128ca7645
The API won't modify the passed NetworkCapabilities and
LinkProperties, but redactNetworkCapabilitiesForPackage and
redactLinkPropertiesForPackage sound like they will. To reduce
the confusion, rename the API with prefix "getRedacted".
Also modify the javadoc to describe more about what the API will
do if the given UID doesn't have location permission.
Bug: 220367512
Test: atest CtsNetTestCases
Change-Id: I964f1062da1ae96df9b369b911486da1379b8a19
Update API name from getVpnRequiresValidation to
isVpnValidationRequired according to API review feedback.
Test: atest FrameworksNetTests
Bug: 220129160
Change-Id: I1025f4c35b320c14e872eaffd7ed82658a5f3d0c
Some system components like VPN need to know how to redact
NetworkCapabilities & LinkProperties that they received from
the system but need to send to third-party applications with
less privilege than themselves. To make sure the redaction is
consistent, expose system API methods to do it that are wired
to the same redaction code used by ConnectivityService.
Bug: 191413541
Test: atest CtsNetTestCases, which includes new CTS for these
Change-Id: Ia3ae4755b5192884c147d6828f96cedac000a25b
The INGRESS_RATE_LIMIT_BYTES_PER_SECOND setting controls the rate limit
for internet networks. If set to -1, no rate limit applies. There is
one global rate limit that will be applied to all networks with
NET_CAPABILITY_INTERNET.
Test: atest ConnectivitySettingsManagerTest
Bug: 157552970
Change-Id: Ia82aa867686d484ce46734f76d4a48bf864eff84
Address API review feedback to change naming of
setExcludedLocalRoutesVpn and getter.
Bug: 217742354
Test: atest FrameworksNetTests
Change-Id: I57bbf55c7aba1c86ec8687d2431a50b37e63c6d0
This adds a new API that lets VPN apps using VpnManager request
that the platform run its basic validation check on the resulting
network.
Bug: 184750836
Test: atest FrameworksNetTests
Change-Id: I00092eee857d3e33529b19461cfd5dd060a0fe20
Add a link to javadoc for the allowed types and use the lint annotation
to suppress compilation errors instead of modifying the baseline file.
Bug: 213240318
Test: atest FrameworksNetTests
Test: atest NetworkStackTests
Signed-off-by: Mingguang Xu <mingguangxu@google.com>
Change-Id: I2a83cc19baa25068326517b30a9afdea19536af9
Create public API for IP and static IP configuration.
Bug: 209840828
Test: atest android.net.cts.IpConfigurationTest
Test: atest android.net.cts.StaticIpConfigurationTest
Test: atest android.net.dhcp.DhcpResultsParcelableUtilTest
Change-Id: I720f168d1023806970919ca5dd44239a276826b6
CTS already have basic tests for this since they run the common tests,
which were using these hidden methods already.
Test: CtsNetTestCases
Change-Id: Id5e5b911f5c63bdd3b05e5ac1d3dd89c1c525ab7