Commit Graph

8035 Commits

Author SHA1 Message Date
Lorenzo Colitti
cc3e994f16 Minor fixes to NetworkAgentTest.
- Use a more realistic routing config (instead of a LinkAddress
  with prefix length 0, an address with a mask of 32 and a
  default route).
- Use InetAddresses to parse IP addresses since it's a public API.
- Import the NET_CAPABILITY_xxx and TRANSPORT_xxx constants for
  readability.

Bug: 173331190
Test: test-only change
Change-Id: I9703d7dd5781f60fb3d531267d3f5370cbccd64f
2020-12-12 22:57:05 +09:00
Lorenzo Colitti
977464ef5a Pass in proper NetworkCapabilities in testSetUnderlyingNetworks.
The CL that introduced testSetUnderlyingNetworks allowed tests to
pass in NetworkCapabilities when registering an agent, but
incorrectly always set the agent's capabilities anyway. This
resulted in testSetUnderlyingNetworks registering an agent with
TRANSPORT_VPN and NET_CAPABILITY_NOT_VPN.

Fix this by ensuring that createNetworkAgent either uses the
passed-in capabilities unmodified, or creates its own. Assert
that the test VPN network does not have NET_CAPABILITY_NOT_VPN.

While I'm at it, remove the manual unregistration of the callback
by using the registerNetworkCallback helper method.

Also add a little bit of extra test coverage.

Bug: 173331190
Test: test-only change
Change-Id: I114d876a1b2bf5344dd7c6fa23862df1c0a412c3
2020-12-08 01:15:32 +09:00
Lorenzo Colitti
7d04b2a26c Merge "Add a CTS test for NetworkAgent#setUnderlyingNetworks." 2020-11-28 02:49:53 +00:00
Lorenzo Colitti
e74700dd5d Merge changes I82811a97,Ic508b17e,I23ca7980
* changes:
  Add OWNERS for packages/modules/Connectivity.
  Add repo hooks for packages/modules/Connectivity.
  Add a .gitignore in packages/modules/Connectivity.
2020-11-27 10:33:30 +00:00
Treehugger Robot
de39ae42ac Merge "Fix race condition in NetworkWatchListTest" 2020-11-27 10:12:05 +00:00
Lorenzo Colitti
3657ce9cda Add a CTS test for NetworkAgent#setUnderlyingNetworks.
Bug: 173331190
Test: atest CtsNetTestCases:NetworkAgentTest#testSetUnderlyingNetworks
Change-Id: I442a618d2d50eb15dbcb8926b60fc6fd0d5b2f3e
2020-11-27 18:09:24 +09:00
Lorenzo Colitti
99fcd0bbf8 Add OWNERS for packages/modules/Connectivity.
Specify the owners here instead of including them from other
places (e.g., frameworks/base, NetworkStack) because we hope that
this project will eventually contain all the code.

Test: none
Change-Id: I82811a9758480f16654145c4d55ef784be09de2b
2020-11-27 18:09:24 +09:00
Lorenzo Colitti
a7d3c79a76 Add repo hooks for packages/modules/Connectivity.
This adds the Java and Kotlin linters.

Test: repo upload
Change-Id: Ic508b17ed0b4e33c41debbbeb7a6c0406c46a973
2020-11-27 18:09:24 +09:00
Lorenzo Colitti
1fb77ae003 Add a .gitignore in packages/modules/Connectivity.
Test: None
Change-Id: I23ca7980db01b3f32e94876fa9a0b3952cf29914
2020-11-27 18:09:21 +09:00
Remi NGUYEN VAN
d4430d28ba Merge "Add TEST_MAPPING config for CTS postsubmit" 2020-11-27 08:42:31 +00:00
Alan Stokes
36529b250a Fix race condition in NetworkWatchListTest
We were running cp to create a file and then running a command to read
the file. However were weren't waiting for the cp to finish (or,
indeed, start), so occasionally the read would fail saying the file
didn't exist.

Also added some logging, because diagnosing failure without it is
painful. Also simplify & improve file closing logic.

Some of this was previously submitted on internal master as change
I1c875102f0cce32cbbe2e3b36de913741c9abb92, but I've reverted that in
favor of this.

Bug: 168216494
Test: atest CtsNetTestCases:android.net.cts.NetworkWatchlistTest
Change-Id: I46a9db8b7a1885a9829f00bbd3233b863cfd1f5d
2020-11-26 14:27:39 +00:00
Treehugger Robot
1de9621925 Merge "Tune up TIMEOUTs of IPSec CTS for low end devices" 2020-11-25 19:56:50 +00:00
Remi NGUYEN VAN
1bc6287249 Add TEST_MAPPING config for CTS postsubmit
The new configuration runs tests on physical devices with SIM cards.
This is only done in postsubmit, as such tests can only run a few (~2) times a day due to
availability of the devices.

This configuration allows running all tests, so there is no annotation filter.

Change-Id: If95e4deeed8098327023f99e6e610331b8e86a0f
Test: TH validates TEST_MAPPING configurations
2020-11-25 18:27:48 +08:00
Junyu Lai
42fbb57b31 Merge changes from topic "TrafficStats.getTxRxBytes"
* changes:
  Exclude lingering traffic from loopback iface stats check
  Add CTS for getTx/RxBytes in TrafficStats
2020-11-25 02:35:20 +00:00
Chalard Jean
d639d12161 Merge "This bug was fixed in S, don't test for it in R" 2020-11-24 07:01:57 +00:00
Chalard Jean
e90c48c9aa This bug was fixed in S, don't test for it in R
Bug: 172401665
Test: CtsNetTestCasesLatestSdk
Change-Id: Ib9fb3ec09eeaebbb4ac1b1b458cfcc5c4f506cff
2020-11-20 17:54:26 +09:00
Cody Kesting
b9e51da2e8 Merge "Use READ_PHONE_STATE when checking Carrier Configs." 2020-11-17 17:54:09 +00:00
Yintang Gu
5c39147e5a Tune up TIMEOUTs of IPSec CTS for low end devices
Ikev2VpnTest#testStartStopVpnProfileV4 and testStartStopVpnProfileV6
contains the IKE sequences and requires the phone to send and receive
the required packet in 1000ms.
On some low end devices, the response time may exceeds this TIMEOUT
sometimes.
So we need to use larger timeouts.

Bug: 171176723
Change-Id: I005b83ffecd8ade5063000690bfd4136d82f1a07
2020-11-13 10:43:31 +08:00
Treehugger Robot
4eda64baca Merge "Add an owner for NetworkWatchlistTest." 2020-11-12 13:02:46 +00:00
Treehugger Robot
f5ae03550a Merge "Use ACCESS_WIFI_STATE when clearing wifi blacklist" 2020-11-12 05:36:38 +00:00
Treehugger Robot
2a7cf08b8e Merge "Use CONNECTIVITY_INTERNAL on Q for portal URL" 2020-11-12 05:35:20 +00:00
Alan Stokes
108f82b463 Add an owner for NetworkWatchlistTest.
Test: N/A
Change-Id: Icfbeaf60e1ff98d29c449b9fcc43c0e5ce39a20e
2020-11-10 11:36:30 +00:00
paulhu
862c8a1ea0 Fix tethering doesn't turn off issue
When user restriction turns on, all tethering functions should
be disabled. But tethering functions still work after
restrication is on. Because tethering request would be removed
from mActiveTetheringRequests after starting tethering that
will result in Tethering#isTetheringActive() always returns
false. Thus, update the design to check tethered interface to
ensure that any of tethering function is working.

Bug: 169596583
Test: atest TetheringTests
Test: Manually test that tethering function would be disabled
      and notification would show to user after restriction
      was on.
Change-Id: Icb9649a5ecdec2d029ac763b5b9b80042ad50eb9
2020-11-10 16:47:52 +08:00
junyulai
42ea4318f7 Exclude lingering traffic from loopback iface stats check
Lingering traffic from previous tests are only happens in
non-loopback interface. Stats gets from loopback interface
would not see them. Thus, exclude them from in-range check.

Test: atest TrafficStatsTest --rerun-until-failure 100
Bug: 164965653
Change-Id: Ic15c4c2e27f86b5711ada904c22734206c67d671
2020-11-10 10:11:14 +08:00
junyulai
549cc56731 Add CTS for getTx/RxBytes in TrafficStats
Test: atest TrafficStatsTest
Bug: 164965653
Change-Id: Ic3d253bbd036f40781d4f2706a67fb145ab4a575
2020-11-09 11:59:39 +08:00
Cody Kesting
a9bdde8881 Use READ_PHONE_STATE when checking Carrier Configs.
This CL Updates ConnectivityDiagnosticsManagerTest to explicitly use
the READ_PHONE_STATE permission when checking Carrier Configs for the
specified subId.

Bug: 169739061
Test: atest ConnectivityDiagnosticsManagerTest
Change-Id: I2307d7b03bcf9a918904a89be86777872a759293
2020-11-06 10:22:48 -08:00
Nikita Ioffe
06bf173b20 Merge "com.android.tethering: set min_sdk_version 30" 2020-11-06 12:46:39 +00:00
Mark Chien
220e7854bd Merge "Fix null DadProxy failure in R Tethering unit test" 2020-11-06 11:00:19 +00:00
Remi NGUYEN VAN
78cb3a9de0 Use CONNECTIVITY_INTERNAL on Q for portal URL
getCaptivePortalServerUrl requires CONNECTIVITY_INTERNAL or
MAINLINE_NETWORK_STACK on Q, and NETWORK_SETTINGS or
MAINLINE_NETWORK_STACK on R+.

Use CONNECTIVITY_INTERNAL on Q instead of NETWORK_SETTINGS to test it.

Bug: 172626873
Test: atest CtsNetTestCasesLatestSdk:ConnectivityManagerTest
Change-Id: I03309de945b198ad9b40d51d799d2619bb3179ea
2020-11-06 16:14:37 +09:00
Remi NGUYEN VAN
72c7fe9b0c Use ACCESS_WIFI_STATE when clearing wifi blacklist
Some tests using CtsNetUtils, like tethering CTS tests, do not hold
ACCESS_WIFI_STATE at install time. Use shell permissions to allow the
utility to work in such configurations.

Bug: 171621759
Test: atest CtsTetheringTest:TetheringManagerTest
Change-Id: I63e76918421e5deb59fe67a64674348fb8d20265
2020-11-06 10:46:52 +09:00
Nikita Ioffe
583e35a12e com.android.tethering: set min_sdk_version 30
Tethering is updatable apex module that was launched in R, hence it and
all it dependencies should specify min_sdk_version <= 30.

Test: m
Bug: 171668006
Bug: 171330443
Change-Id: Ic91cf96dda6419d1038b0329b920f9cd24482aef
Merged-In: Ic91cf96dda6419d1038b0329b920f9cd24482aef
(cherry picked from commit bee20e84f8)
(cherry picked from commit 1fe1e539e1)
2020-11-05 20:30:40 +00:00
markchien
290e7c452b Fix null DadProxy failure in R Tethering unit test
Tethering unit test would verify the interfaction between DadProxy and
IpServer. Since DadProxy only available in S+, the test would fail if it
build with R sdk.

Bug: 171936270
Test: atest TetheringTests in both R and S
Change-Id: Ia73d4aa59d01400d1ccfd3fdc1b721e269cae952
2020-11-05 15:28:56 +08:00
Luke Huang
fcabfc688d Fix minor bug and deflaky for DnsResolverTest
1. Add the missing countdown() in the test callback
2. Add ensureWifiConnected() to prevent no available network problem.
3. Increase the timeout for awaiting private DNS setting because
   current one might not be enough.

Bug: 168027339
Test atest

Change-Id: I91190d8644ff7a7dfaf4fa3f2d43c17f67dfac11
2020-11-04 16:03:10 +08:00
Baligh Uddin
ebff93159e Adjust visibility for tests
BUG: 167962976
Test: TH
Merged-In: Ic89c084604788b4d41cf854e5015c8ce7791c64d
Change-Id: I12e326167c6fb61a59a919cdd0198ac8f8c84772
2020-11-04 05:06:58 +00:00
Baligh Uddin
43e624246b Merge history of CTS
BUG: 167962976
Test: TH
Merged-In: Ic89c084604788b4d41cf854e5015c8ce7791c64d
Change-Id: I475d5fc915b1525f02fa70cb0694f21c3eb7d15f
2020-11-04 04:08:37 +00:00
Baligh Uddin
1711a1222c Revert "Add OWNERS block to prevent the tree from mooving during migration."
Migration of frameworks/base/packages/Tethering is complete, removing
the OWNERS block.
This reverts commit 1623eb61d5.
BUG: 167962976
Test: TH

Change-Id: Ic89c084604788b4d41cf854e5015c8ce7791c64d
2020-10-31 04:50:11 +00:00
Treehugger Robot
9670ecfaa3 Merge "Fix MultinetworkApiTest for instant mode" 2020-10-30 13:28:53 +00:00
Weilun Du
aa00145105 Fix MultinetworkApiTest for instant mode
add AppModeFull@ to MultinetworkApiTest since CHANGE_NETWORK_STATE
could not be granted in instant mode.

CHANGE_NETWORK_STATE is required to select networks that are up but
not in the foreground, for example, the mobile network after the linger
timer has expired.

Bug: 168809106
Test: atest MultinetworkApiTest
      atest MultinetworkApiTest --instant

Signed-off-by: Weilun Du <wdu@google.com>
Change-Id: I37ca1a0f58d1c2ab57f8cd4489c2cfb13b0f2d39
2020-10-30 10:22:06 +00:00
Chalard Jean
e3c9bb8545 Merge "Make sure agents start in the CONNECTING state" 2020-10-29 12:31:03 +00:00
Treehugger Robot
5ecf780e6e Merge "Don't run hotspot related tests if Soft AP is not supported" 2020-10-29 05:32:56 +00:00
Baligh Uddin
1623eb61d5 Add OWNERS block to prevent the tree from mooving during migration.
BUG: 167962976
TEST: None.
Change-Id: I49db5a11ee89645dac158ec3757180b2387e2d70
2020-10-29 03:24:01 +00:00
markchien
8705535e40 Don't run hotspot related tests if Soft AP is not supported
Also explicitly hold ACCESS_WIFI_STATE permission to avoid
no permission problem when using WifiManager#getScanResults
without shell identity.

Fix: 169219565
Test: "atest CtsTetheringTest" in cuttlefish and phyical device

Change-Id: I3d8fa7e8882bf96f61f3316a70efdf991addbcb2
2020-10-29 11:10:46 +08:00
Baligh Uddin
f814b9b1ce Add visibility rules for packages/modules/Connectivity/Tethering
BUG: 167962976
Test: TH
Change-Id: Id28881b35cf24fc9517fa11af6d8e539ab244fa6
2020-10-29 02:11:55 +00:00
Dan Shi
98716c5cdc Add all CTS tests to general-tests suite
Exempt-From-Owner-Approval: this change only adds the tests to
general-tests.zip, doesn't change any test behavior.

Bug: 171481522
Test: none
Change-Id: I1711237f00572d57f611dcd16ec9ad345a0b5b3b
2020-10-27 22:25:33 +00:00
Remi NGUYEN VAN
1cdfeec47d Merge "Move apache HTTP tests out of tests/net" 2020-10-27 06:39:25 +00:00
Remi NGUYEN VAN
438200afb9 Move apache HTTP tests out of tests/net
The apache HTTP library is part of the platform core APIs, which are
separate from the core networking APIs.

cts/tests/tests/net is planned to move to a separate git project to put
it closer to the associated connectivity module code.

Bug: 170371348
Test: m cts && cts-tradefed run cts -m CtsApacheHttpTestCases
Change-Id: I49972b21755235e280c75eec40db14f3db974ca1
2020-10-27 11:07:04 +09:00
Treehugger Robot
d75774dfe0 Merge "Add shared jarjar rule for tethering tests" 2020-10-26 11:43:59 +00:00
markchien
e3126480ba Add shared jarjar rule for tethering tests
Also jarjar com.android.net.module.util* to
com.android.networkstack.tethering.util*.

Bug: 171670016
Test: atest TetheringCoverageTests
Change-Id: I3bde9ad3c41adf36da99bd944303d88ce992201c
2020-10-26 18:20:25 +08:00
Treehugger Robot
7851370b12 Merge "Add com.google.android.resolv.apex and com.google.android.tethering.apex for CtsNetTestCasesLatestSdk." 2020-10-26 08:56:35 +00:00
Bill Yi
479e5b17ef Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I34e8bcf3c3f0a5db3522b6ff499ba1583577b250
2020-10-22 23:40:39 -07:00