Commit Graph

247 Commits

Author SHA1 Message Date
Chiachang Wang
84ad04f768 Merge "Change naming of excludeLocalRoutes" 2022-02-10 00:50:30 +00:00
Patrick Rohr
6b5b7b40d8 Merge changes from topic "bandwidth-limiting"
* changes:
  Add bandwidth limiting to CS
  Add setting that controls network rate limit
2022-02-09 18:00:04 +00:00
Patrick Rohr
a20843638f Add setting that controls network rate limit
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
2022-02-09 14:46:26 +01:00
Chiachang Wang
f890874970 Change naming of excludeLocalRoutes
Address API review feedback to change naming of
setExcludedLocalRoutesVpn and getter.

Bug: 217742354
Test: atest FrameworksNetTests
Change-Id: I57bbf55c7aba1c86ec8687d2431a50b37e63c6d0
2022-02-09 15:50:06 +08:00
Jean Chalard
4b66d4e244 Merge "Add and implement API for VpnManagers to request validation" 2022-02-09 06:03:45 +00:00
Chiachang Wang
865511a8c4 Add and implement API for VpnManagers to request validation
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
2022-02-08 22:47:26 +09:00
Mingguang Xu
446c376434 Merge "Address API review comments for DhcpOption object" 2022-02-08 07:30:45 +00:00
Mingguang Xu
6914a16c95 Address API review comments for DhcpOption object
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
2022-02-07 19:42:40 -08:00
Etan Cohen
1e86b3af26 Expose public APIs for IP & static IP configuration
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
2022-02-07 19:57:07 +00:00
Robert Horvath
2dac94841a Define BLOCKED_REASON_LOW_POWER_STANDBY
Bug: 190822356
Test: atest NetworkPolicyManagerServiceTest
Change-Id: I72c81ba1c3791e40a2d311cc3a06bf3b5d3727d1
2022-02-01 16:04:35 +01:00
Robert Horvath
34cba14425 Define FIREWALL_CHAIN_LOW_POWER_STANDBY
Bug: 190822356
Test: atest NetworkManagementServiceTest
Change-Id: I970eea0e1952f8074cc5c998bbd2ee1ff5a3dc92
2022-02-01 16:04:35 +01:00
Chalard Jean
41a602d2b8 Expose access UIDs.
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
2022-01-31 17:04:58 +09:00
Tyler Wear
723882126a Process DSCP QoS events for policies
New events to handle adding and removing of DSCP QoS policies.
Async indication sends status back to client if the policy
has been added, failed, or if the policy limit has been
reached.

Bug: 202871011
Change-Id: I7988d22ae625ad0dd415927d2943de4a749e6fb8
2022-01-27 10:19:27 +00:00
Chiachang Wang
e84d7d90d3 Expose local route exclusion API in NetworkAgentConfig
Bug: 184750836
Test: make update-api
Test: atest FrameworksNetTests
Change-Id: I70470ab3a945570a23607e39d18f9825d9e1d7aa
CTS-Coverage-Bug: 184750836
2022-01-27 09:53:33 +00:00
Sooraj Sasindran
7e9b25e7f9 Add getEnterpriseId api to network request
Bug: 194332512
CTS-Coverage-Bug: 216481336
Test: build
Change-Id: I1446f8eecf43f7c6d243dc82af08d04957dd60e3
2022-01-26 17:26:50 +00:00
Sooraj Sasindran
f8eb713874 Add low latency and high bandwidth network capabilities
Bug: 194332512
Test: build
Change-Id: I415ca1ba90ea54c4106f806fe855bcb84d3e38ba
2022-01-25 09:35:30 -08:00
Sooraj Sasindran
f4a58dcd45 Add support for Multiple enterprise slice
Bug: 194332512
Test: unit test
CTS-Coverage-Bug: 211133973
Change-Id: Ie8be08a7cfa9155168d1da146d02fd1643248bdc
2022-01-22 14:39:40 -08:00
Sooraj Sasindran
499117f279 Ability to specify which all applications fall under enterprise slice.
Bug: 194332512
Test: unit test
Change-Id: I94549a41aaa717add22b0a3e5035beacf6f1b8f2
2022-01-21 01:05:12 -08:00
Mark Chien
21f0d58294 Merge "Add swapActiveStatsMap API for NetworkStatsFactory" 2022-01-14 05:35:25 +00:00
Mark Chien
094de6b7c4 Merge "Add replaceFirewallChain API" 2022-01-14 05:33:58 +00:00
Mark Chien
9bba8e8c78 Merge "Add setFirewallChainEnabled API" 2022-01-14 05:33:38 +00:00
Mark Chien
c65ecacd6f Merge "Add updateFirewallRule API" 2022-01-14 05:33:22 +00:00
markchien
9c8061134c Add swapActiveStatsMap API for NetworkStatsFactory
This CL should be reverted before T sdk finalized.
This API is temporary added for the NetworkStatsFactory which is platform
code but will be moved into connectivity (tethering) mainline module.

Bug: 209935649
Test: atest CtsHostsideNetworkTests
Change-Id: I5894450f3089b2ea105722a18ddf8f1eed1c28a0
2022-01-14 10:23:26 +08:00
markchien
00a0bed534 Add replaceFirewallChain API
To deprecated firewallReplaceUidChain netd binder and move the
functionality to tethering (connectivity) mainline module, expose
replaceFirewallChain to support the caller outside the module.
Currently the API are still call to netd. Will replace with the
implementation inside tethering (connectivity) module.

Bug: 209935649
Test: atest CtsHostsideNetworkTests
Change-Id: If7a87548b0a3acda00a1455da4e4ff24a630ddc7
2022-01-14 10:23:21 +08:00
markchien
98a6f95d0f Add setFirewallChainEnabled API
To deprecated firewallEnableChildChain netd binder and move the
functionality to tethering (connectivity) mainline module, expose
setFirewallChainEnabled to support the caller outside the module.
Currently the API are still call to netd. Will replace with the
implementation inside tethering (connectivity) module.

Bug: 209935649
Test: atest CtsHostsideNetworkTests
Change-Id: I9b64c9d12260521489a87fbeae5afbee2a8ea8f6
2022-01-14 10:23:15 +08:00
markchien
e1561fa800 Add updateFirewallRule API
To deprecated firewallSetUidRule netd binder and move the functionality to
tethering (connectivity) mainline module, expose updateFirewallRule to
support the caller outside the module. Currently the API are still call
to netd. Will replace with the implementation inside tethering
(connectivity) module.

Bug: 209935649
Test: atest CtsHostsideNetworkTests
Change-Id: I0b53c999e06c2378afec0eb491815ec398c91b0b
2022-01-14 10:19:51 +08:00
Sooraj Sasindran
226131ab48 Merge "Ability for DPM to specify fallback mechanism" 2022-01-13 17:24:07 +00:00
Mark Chien
136f2d2d91 Merge "Add updateMeteredNetwork{Allow, Deny}List APIs" 2022-01-13 08:21:03 +00:00
Sooraj Sasindran
06baf4cfa1 Ability for DPM to specify fallback mechanism
Bug: 194332512
Test: unit test
Change-Id: Id4d85da8f64e7559326c4657b8833dac3ce5ce3d
2022-01-13 06:07:36 +00:00
Sooraj Sasindran
e7aee2736e Add a method to apply a set of network preferences to a user profile
Add a method to apply a set of network preferences to a user profile

Bug: 194332512
CTS-Coverage-Bug: 211133973
Test: CTS
Change-Id: I97730ea14e7c96922236fd77a591e5acadd875ba
2022-01-11 21:07:23 -08:00
markchien
738ad911c7 Add updateMeteredNetwork{Allow, Deny}List APIs
To deprecated below netd binder interfaces and move the functionality to
tethering(connectivity) mainline module:
  bandwidthAddNaughtyApp
  bandwidthRemoveNaughtyApp
  bandwidthAddNiceApp
  bandwidthRemoveNiceApp
Expose updateMeteredNetwork{Allow, Deny}List APIs to support the caller
outside the module. Currently the two APIs are still call to INetd
binders. Once functionality is moved to mainline module, will switch to
use them.

Bug: 209935649
Test: m
Change-Id: I8df720935748c2587f91a7b760cfd5a93a0fa852
2022-01-07 10:16:13 +08:00
Treehugger Robot
fbe500351e Merge "Add enterpriseSpecifier" 2021-12-23 22:25:20 +00:00
Sooraj Sasindran
4196937bdd Add enterpriseSpecifier
Add enterpriseSpecifier to network capability

Bug: 194332512
CTS-Coverage-Bug: 211133973
Test: CTS and unit test.
Change-Id: If16c8e17cee71cc6788c43a8818bcca68a00bf99
2021-12-23 09:32:20 -08:00
Taras Antoshchuk
37ff6df023 Merge "Revert "Revert "Unhide IpPrefix(InetAddress, int)""" 2021-12-23 12:41:23 +00:00
Taras Antoshchuk
839cb2692e Merge "Revert "Revert "Unhide RouteInfo#getType and related fields""" 2021-12-23 12:41:23 +00:00
Jack Yu
04bbc5b9b0 Added a new network capability MMTEL
Added NET_CAPABILITY_MMTEL to indicate a network
support MMTEL (Multimedia telephony). This is for
IMS service to request an IMS network that supports
voice or PS (VoPS for 4G, VoNR for 5G).

This was previously submitted as aosp/1927841, but
which got reverted due to breaking the mainline
build, which uses the pre-built module.

Bug: 210774375
Test: atest ConnectivityServiceTest
Change-Id: If8b691ff4999a4dbf54e7567d9ca74d743dc5ded
2021-12-21 16:31:30 +00:00
Martijn Coenen
6ebc8ba595 Revert "Added a new network capability MMTEL"
Revert "Added setup/tear down data support"

Revert "Added a new network capability MMTEL"

Revert submission 1927643-mmtel_capability

Reason for revert: b/211586152
Reverted Changes:
Ifea8b1e40:Added a new network capability MMTEL
I38655bef2:Added a new network capability MMTEL
I837606d9e:Added setup/tear down data support
I2c7b291fe:Added a new network capability MMTEL

Change-Id: Ie9b0b0d9017ef8aea7fbb56dda522e7c433144b9
2021-12-21 11:24:01 +00:00
Taras Antoshchuk
3bbbffe133 Revert "Revert "Unhide IpPrefix(InetAddress, int)""
This reverts commit 758ead6dd3.

Reason for revert: Re-landing changes not related to postsubmit failure

Change-Id: I2f705549d85af4ba45dc294e0a86d757490b1cd7
2021-12-19 11:54:56 +00:00
Taras Antoshchuk
2b3d62f3e9 Revert "Revert "Unhide RouteInfo#getType and related fields""
This reverts commit 6d1ea2bb16.

Reason for revert: Re-landing changes not related to postsubmit failure

Change-Id: If7940801518be5ddec91270b3663ddfc8b42eadb
2021-12-19 11:51:39 +00:00
Jack Yu
f322d4f5e0 Added a new network capability MMTEL
Added NET_CAPABILITY_MMTEL to indicate a network
support MMTEL (Multimedia telephony). This is for
IMS service to request an IMS network that supports
voice or PS (VoPS for 4G, VoNR for 5G).

Bug: 210774375
Test: atest ConnectivityServiceTest
Change-Id: Ifea8b1e40f65c610e925a27be873930fee2df693
2021-12-16 14:38:10 -08:00
Ayush Sharma
758ead6dd3 Revert "Unhide IpPrefix(InetAddress, int)"
Revert "Add APIs that allow to exclude routes from VPN"

Revert "Suppress NewApi warnings for @SystemApi -> public APIs"

Revert "Add VpnServiceBuilderShim for VpnService.Builder"

Revert submission 1551943-vpn-impl

Reason for revert: <DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=aosp-master&target=mainline_modules_x86_64-userdebug&lkgb=8007224&lkbb=8008168&fkbb=8007902 >, bug b/210979001
Reverted Changes:
I0e7aa077a:Add VpnServiceBuilderShim for VpnService.Builder
Ib12f5ab39:Suppress NewApi warnings for @SystemApi -> public ...
I59b9185cf:Unhide RouteInfo#getType and related fields
Ie5b62b2b2:Unhide IpPrefix(InetAddress, int)
I993a32d40:Add CTS tests for exclude VPN routes APIs
Ib24b2d3fb:Suppress NewApi warnings for @SystemApi -> public ...
Ic3b10464a:Add APIs that allow to exclude routes from VPN

Change-Id: Id0c373fb042a98c1c68807acf7fcfe456520ebe2
BUG: 210979001
2021-12-16 14:40:13 +00:00
Ayush Sharma
6d1ea2bb16 Revert "Unhide RouteInfo#getType and related fields"
Revert "Add APIs that allow to exclude routes from VPN"

Revert "Suppress NewApi warnings for @SystemApi -> public APIs"

Revert "Add VpnServiceBuilderShim for VpnService.Builder"

Revert submission 1551943-vpn-impl

Reason for revert: <DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=aosp-master&target=mainline_modules_x86_64-userdebug&lkgb=8007224&lkbb=8008168&fkbb=8007902 >, bug b/210979001
Reverted Changes:
I0e7aa077a:Add VpnServiceBuilderShim for VpnService.Builder
Ib12f5ab39:Suppress NewApi warnings for @SystemApi -> public ...
I59b9185cf:Unhide RouteInfo#getType and related fields
Ie5b62b2b2:Unhide IpPrefix(InetAddress, int)
I993a32d40:Add CTS tests for exclude VPN routes APIs
Ib24b2d3fb:Suppress NewApi warnings for @SystemApi -> public ...
Ic3b10464a:Add APIs that allow to exclude routes from VPN

Change-Id: I98d3b998e4702f56e9d5e17944238b283b29f2b2
BUG: 210979001
2021-12-16 14:40:13 +00:00
Taras Antoshchuk
a5a1b80222 Unhide IpPrefix(InetAddress, int)
Unhide IpPrefix constructor to allow its usage with the new
VpnService.Builder#excludeRoute(IpPrefix) method.

Bug: 186082280
Test: atest IpPrefixTest
Change-Id: Ie5b62b2b206def1be53a41219681b4a8bc06c1d2
2021-12-13 11:11:00 +01:00
Taras Antoshchuk
62065db8d1 Unhide RouteInfo#getType and related fields
Bug: 186082280
Test: atest RouteInfoTest
Change-Id: I59b9185cf4f8f2afd691b49cf6b4659fe36e6bf8
2021-12-13 11:11:00 +01:00
Treehugger Robot
0db3016398 Merge changes from topic "DnsException"
* changes:
  CTS DnsResolverTest for DnsException ctor
  DnsResolver: Make DnsException ctor public
2021-12-13 07:48:28 +00:00
Aswin Sankar
74cbfd5aab DnsResolver: Make DnsException ctor public
Making the DnsException constructor public is useful for apps
using DnsResolver to write their tests, and for internal packages
that may want to implement the DnsResolver.Callback interface.

Test: for regression; CTS tests in b/208479811
Bug: 208464882
Change-Id: I14641688f53721c96e6df9596a7506912ba3aec0
2021-12-10 19:30:20 +00:00
Mingguang Xu
2d87c6152d Create DhcpOption object and make it a SystemApi
This allows OEM apps to pass their custom DHCP options for establishing
network connection.

Bug: 177278970

Test: atest FrameworksNetTests
Test: atest NetworkStackTests

Signed-off-by: Mingguang Xu <mingguangxu@google.com>
Change-Id: I2b8c38ee9a948ad6edb666312c989d27a8ff904b
2021-12-09 19:37:40 -08:00
lucaslin
8b2dfa7c02 Add new APIs in NetworkCapabilities to set and get underlying networks
Previously, the caller can only know about the transport type of
the underlying network. The information might not be enough if
the device support WiFi STA+STA.
Thus, provide an API for the caller to get the correct underlying
network.

Bug: 191918368
Test: atest FrameworksNetTests:NetworkCapabilitiesTest
Change-Id: I7752b2356770f4572f6ca4cbaecaa45c09d6d72f
2021-10-15 18:07:12 +08:00
paulhu
68aacb407a Update allowed on restricted networks getter/setter
As API review feedback, setting allowed on restricted networks
should be by uid instead of package name for security reason.
Thus, update the getter/setter to return/accept set of uids.

Bug: 188085693
Test: atest FrameworksNetTests
Ignore-AOSP-First: Needs cherry-picks
Change-Id: I979bf98075e6c9c0ed7e891582843fddb62643cb
2021-05-26 16:16:57 +08:00
Lorenzo Colitti
86714b1fd2 Allow unprivileged NetworkCallbacks to see other UIDs' networks.
Currently, unprivileged apps can call getAllNetworks() to see
all networks on the system, even networks that do not apply to
them. Allow them to do this via NetworkCallbacks as well.

This is the last piece of information that was only available
through getAllNetworks, so this CL deprecates that API.

Bug: 187921303
Test: new unit tests
Test: CTS test in other CL in topic
Change-Id: I30f1021927d3c8eae6525116c61ff4a4acecff6d
2021-05-18 12:24:07 +09:00