Commit Graph

98 Commits

Author SHA1 Message Date
Chiachang Wang
978370cb9c Merge "Rename getVpnRequiresValidation to isVpnValidationRequired" 2022-03-03 00:10:54 +00:00
Chiachang Wang
7ec6ae74c8 Rename getVpnRequiresValidation to isVpnValidationRequired
Update API name from getVpnRequiresValidation to
isVpnValidationRequired according to API review feedback.

Test: atest FrameworksNetTests
Bug: 220129160
Change-Id: I1025f4c35b320c14e872eaffd7ed82658a5f3d0c
2022-03-02 01:02:45 +00:00
Remi NGUYEN VAN
3b81323e4a Fix testing with/without connectivity module
Add missing @ConnectivityModuleTest annotations to tests that cover
functionalities that were introduced in a newer connectivity module
update.

Also add CtsNetTestCasesLatestSdk to postsubmit with only APK modules
installed, and with only the connectivity/tethering module installed.
This can then be moved to presubmit to catch such issues before they are
merged.

While doing this cleanup the TEST_MAPPING file in tests/ and merge its
contents into the root TEST_MAPPING file. This does not change anything
for "postsubmit" tests as they are run independently of changes. It only
causes FrameworksNetIntegrationTests to run in presubmit on any change
in modules/Connectivity/ instead of only on modules/Connectivity/tests/
changes, which is how it should be.

Bug: 218611855
Test: TH needs to test TEST_MAPPING
Change-Id: I26629a35d8c2df3db33180ecc22d49d538ad3b8b
2022-02-16 15:22:30 +09:00
Remi NGUYEN VAN
106569b856 Merge "Allow test+other networks to have specifiers" 2022-02-14 05:31:20 +00:00
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
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
Chalard Jean
9a30acf744 Add accessUids to NetworkCapabilities.
For now, all entry points reject this. Followup changes
will allow the supported use cases.

Test: new unit tests and CTS for this in this patch
Change-Id: I7262811a2e46336d3bb63c80886fc0578a36da94
2022-01-31 17:04:58 +09: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
Chiachang Wang
b04664d7a6 Merge "Update the SDK for the tests with intended target in T+" 2022-01-21 06:34:29 +00:00
Chiachang Wang
7212fbee14 Update the SDK for the tests with intended target in T+
Correct the SDK for those tests are expected running in T+
device. Check @IgnoreUpTo(S) may be incorrect after receiving
patches before T release.

Refer to temporary constant definition in DevSdkIgnoreRule until
the SDK constant being pushed into AOSP and synced with branch
used for mainline.

BUg: 215294242
Test: atest CtsNetTestCases CtsNetTestCasesLatestSdk
Change-Id: Ide6a241f7944dd1e75bc33b21aa29471a5df94c6
2022-01-20 10:30:19 +08:00
Remi NGUYEN VAN
e347301890 Mark connectivity module tests as such
Add @ConnectivityModuleTest to tests for classes that are mainly used to
back the connectivity (tethering) module, in particular data classes.

This causes the test not to be run in NetworkStack/CaptivePortalLogin
MTS tests when the connectivity (tethering) module is not installed.
Skipping such tests is necessary in that configuration as they may test
behavior that is new in the latest update, and data classes backing the
connectivity module would not be affected by
NetworkStack/CaptivePortalLogin updates anyway.

Bug: 211075897
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I6163cd998fc78765b903fdb7acd21e652bc711c9
2022-01-18 16:55:44 +09:00
Remi NGUYEN VAN
8bc36966d4 Do not verify field count in tests used in CTS
Tests in tests/common and tests/cts are run as part of CtsNetTestCases.
Many used assertFieldCountEquals in parceling/unparceling tests to
ensure that unexpected fields were not added, or that they were not
missed when testing parceling/unparceling.

However with many of the classes updatable through module updates, the
field count may change in the future, breaking CTS tests.

Stop checking for the field count, as it would break on module releases,
and its value is lower than the maintenance cost.

Bug: 205901761
Test: atest CtsNetTestCases
Change-Id: I79854741f7e834574d4825bb737ef507785310fe
2022-01-18 16:55:32 +09:00
Remi NGUYEN VAN
1bce54f287 Allow test+other networks to have specifiers
Allow adding a network specifier to networks that have two transports,
if one of them is TRANSPORT_TEST.

This allows creating test ethernet networks that have a network
specifier.

Bug: 175199512
Test: atest NetworkCapabilitiesTest
Change-Id: I2ced91926dff21fbe143258f33f3d42004a954c7
2022-01-12 12:00:41 +09:00
Chiachang Wang
e4ee88f108 Merge "Add NetworkProviderTest#testRegisterNetworkOffer back into test" 2021-12-28 09:24:16 +00:00
Chiachang Wang
a7b3d00968 Merge "Allow VPN network agent to exclude local traffic" 2021-12-28 07:45:20 +00:00
Chiachang Wang
bb754d6cc5 Allow VPN network agent to exclude local traffic
Add API to allow network agent to set whether the local traffic
is excluded from the network. This commit is nonfunctional
currently but only storing the boolean inside the NAI.

Bug: 184750836
Test: atest FrameworksNetTests
Change-Id: I3799216ac8fdf22eb4bcabc6c6136d8edbf69360
2021-12-28 11:13:21 +08:00
Chiachang Wang
69761b4c1c Add NetworkProviderTest#testRegisterNetworkOffer back into test
This test was temporarily disabled because prebuilt module is not
updated in the branch. Now the prebuilt was S already, so add the
test back to test to ensure the coverage.

Test: atest FrameworksNetTests CtsNetTestCases
Bug: 189074532
Change-Id: I510f457d2869c2904404fe7ef55828e84636e4c5
2021-12-27 03:30:47 +00: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
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
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
Chalard Jean
f4802fa4c2 Genericize NC#hasSameUids
This will be used by another set of UIDs in a future patch

Test: FrameworksNetTests
Change-Id: I2c5d18ef93e73b702723814592ef3f3baf5dfbc4
2021-12-16 23:03:42 +09:00
Chalard Jean
bdf4f2987d Remove NetworkCapabilities#combine*
This is no longer used outside of tests, and can be safely
removed.

Also this family of methods is fairly confusing, as while
it's well defined for some members, many later additions
had to be written so as to dissallow some combinations when
the workings of this family of methods didn't match the
semantics of some members, making them possibly dangerous
to use and at least exhibit difficult to understand semantics.

Test: FrameworksNetTests
      m
Change-Id: Ia69c20afa16c2153839891f6e33331caa9da33ff
2021-12-13 21:15:34 +09: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
Remi NGUYEN VAN
daa03defee Fix NetworkCapabilitiesTest on S
Mark NetworkCapabilitiesTest as ConnectivityModuleTest so that it is
only run in MTS with the Connectivity module installed, and fix
parceling tests to use the right number of fields in that case.

NetworkCapabilitiesTest is only useful to test the Connectivity module,
and not other modules like NetworkStack, as it is a unit test of a class
in the Connectivity module.

Bug: 205901761
Test: atest NetworkCapabilitiesTest
Change-Id: I10ba0f866bc7a39b2c90bdde12a79feefea2d5ee
2021-11-11 12:30:07 +09: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
Chiachang Wang
33076dddff Merge "Separate test into reasonable multiple tests" am: 26a7e61417
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1793478

Change-Id: I9193477c6744c6f9a1f7e7e14e0c98e4348b262d
2021-09-07 03:01:39 +00:00
Xin Li
e534ce4c55 Merge "Merge sc-dev-plus-aosp-without-vendor@7634622" into stage-aosp-master 2021-08-17 18:15:09 +00:00
Chiachang Wang
d525a64ead Separate test into reasonable multiple tests
The test actually verifies multiple behaviors and mutates the
networkCapabilities. Thus, refactor the method to keep the
tests easier to follow up.

Bug: 191918212
Test: atest android.net.NetworkCapabilitiesTest
Change-Id: Ibad1a0569d26d92f94153bee323cef5a1c30d8d4
2021-08-17 16:02:09 +08:00
Remi NGUYEN VAN
5b8e2e9935 Fix NetworkCapabilities MTS on S, CTS on S+module
restrictCapabilitiesForTestNetwork was renamed after S release to be
included in a mainline release, but this causes the MTS test to fail on
S if the Connectivity module is not updated, and CTS to fail if the
connectivity module is updated.

Mark the test as @ConnectivityModuleTest so it can be skipped on
non-connectivity module MTS tests (such as NetworkStack tests), and add
back the previous method name to keep CTS passing.

Bug: 196755836
Test: atest NetworkCapabilitiesTest
Change-Id: Ibd6c2e62e5949ec6d93e9f6e4fc05129c29b94f8
2021-08-16 18:03:37 +09:00
Xin Li
3ec4468fb7 Merge sc-dev-plus-aosp-without-vendor@7634622
Merged-In: I5a33f959c8ae5a34584f57508f392038e44062e7
Change-Id: Ib4e5e75ee8bbe19806bdc2f69590d164fb75774b
2021-08-14 06:31:05 +00:00
Chiachang Wang
c07315aa08 The net cap value should be bit shifted before &ing
The check intends to do the bit & operation. The net cap value
should be shifted against the original capabilities.

Also fix the typo in the method name.

Bug: 191918212
Test: atest FrameworksNetTests
Change-Id: I98396b2538f36fe8b29d27a544a2dfb3060bc9c5
2021-08-11 14:55:00 +08:00
Junyu Lai
d92c090c61 Temporarily disable the test since prebuilt module is not updated am: c42a54f2a7
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15328937

Change-Id: I46fb4cad43fee89a6d4453c84db867cfc6374493
2021-07-21 03:04:50 +00:00
Junyu Lai
c42a54f2a7 Temporarily disable the test since prebuilt module is not updated
This CL is subject to be reverted in a few days when the prebuilt
Connectivity module is updated.

Ignore-AOSP-First: This is for sc-dev and its downstreams only
Test: android.net.NetworkProviderTest
Bug: 189074532
Change-Id: I512552400960668c0ba91a8d997d1e2747209538
2021-07-20 05:58:08 +00:00
Junyu Lai
135f50679f Consider NetworkOffer is unneeded if it cannot satisfy the request
Currently, to prevent from network connect-teardown-loops that
caused by inaccurate reports, e.g. the provider always provides
a better network than the offer, the NetworkOffer is considered
needed if its provider is currently serving the request. This
is because there is no accurate way to know whether the offer is
corresponding to the network that is currently serving the
request.

However, if the offer cannot even satisfies the request, consider
the offer is needed does not make any sense. Since it can
never be the one that currently serving the request, nor be
the one that might beat current satisfier.

Test: android.net.NetworkProviderTest
Bug: 189074532
Original-Change: https://android-review.googlesource.com/1731452
Merged-In: Ie3ea59f980c3767782b8e6b03e401c02f664f9bd
Change-Id: Ie3ea59f980c3767782b8e6b03e401c02f664f9bd
2021-07-20 05:43:44 +00:00
Remi NGUYEN VAN
1e79e9322b Merge "Use TRANSPORT_USB from the SDK" am: ca688d62d3 am: 048ef34b88
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764734

Change-Id: I7ff0480df0d7997ea68422d1fe315fa94c5a0556
2021-07-15 09:02:04 +00:00
Remi NGUYEN VAN
732584bcb8 Use TRANSPORT_USB from the SDK
Stop using the stopgap TRANSPORT_USB from NetworkCapabilitiesUtil, which
is being removed.

Bug: 184158327
Test: atest NetworkCapabilitiesTest
Change-Id: I6bbb35d39ff67d6f53b389689dc9f1067e64f962
2021-07-14 16:35:11 +09:00
lucaslin
eadb0add66 Ignore checking TRANSPORT_USB when Android version is older than S
There is a new transport type - TRANSPORT_USB(8) in Android S,
so when the test tries to add this new transport type in older
Android version, it cannot pass the transport type validation and
make test fail.

(clean cherry-pick of change in downstream branch history)
Original change ID before project move:
I38816173b04ea198d99f64f45e9271ac2641e4ac

Bug: 184158327
Test: run CtsNetTestCasesLatestSdk on Android R & Q
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ib0368241771d287c09c0e4463f91122533f85a27
2021-07-14 16:28:58 +09:00
Junyu Lai
8b1a98ff38 Merge "Consider NetworkOffer is unneeded if it cannot satisfy the request" am: b028fc7cf1 am: ce077a3ad0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1731452

Change-Id: Iaff7fca5582c454e651e1ca8042d28968a0148c1
2021-07-05 09:27:16 +00:00